From f489ce6d4b8083297c6f7ec1ffce5980e43e9f0a Mon Sep 17 00:00:00 2001 From: Mohamed ELIDRISSI <67818913+elidrissidev@users.noreply.github.com> Date: Thu, 18 Dec 2025 14:14:00 +0100 Subject: [PATCH 1/4] Upgrade janephp and increase minimum supported PHP version to 8.1 --- composer.json | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index e0b770c1..17c9e500 100644 --- a/composer.json +++ b/composer.json @@ -9,15 +9,14 @@ } ], "require": { - "php": "^8.0", + "php": "^8.1", "ext-curl": "*", "ext-json": "*", - "jane-php/open-api-runtime": "^7.6", - "php-http/curl-client": "^2.3", - "symfony/polyfill-php81": "^1.28" + "jane-php/open-api-runtime": "^7.10", + "php-http/curl-client": "^2.3" }, "require-dev": { - "jane-php/open-api-3": "^7.6", + "jane-php/open-api-3": "^7.10", "nyholm/psr7": "^1.8", "phpunit/phpunit": "^9.6" }, @@ -39,7 +38,7 @@ "php-http/discovery": true }, "platform": { - "php": "8.0" + "php": "8.1" }, "sort-packages": true } From 300d39d6addda1cae52812f68145447106d70dcf Mon Sep 17 00:00:00 2001 From: Mohamed ELIDRISSI <67818913+elidrissidev@users.noreply.github.com> Date: Thu, 18 Dec 2025 14:22:48 +0100 Subject: [PATCH 2/4] Update generated files under API namespace --- src/Api/Client.php | 380 +- src/Api/Endpoint/AcceptanceAuditPreCheck.php | 13 +- src/Api/Endpoint/AddressValidation.php | 15 +- src/Api/Endpoint/AuthorizeClient.php | 9 +- src/Api/Endpoint/ChemicalReferenceData.php | 13 +- src/Api/Endpoint/Delete.php | 12 +- .../Endpoint/DeprecatedAddressValidation.php | 15 +- src/Api/Endpoint/DeprecatedDelete.php | 12 +- src/Api/Endpoint/DeprecatedLocator.php | 16 +- src/Api/Endpoint/DeprecatedPickupCancel.php | 14 +- src/Api/Endpoint/DeprecatedPickupCreation.php | 14 +- .../Endpoint/DeprecatedPreNotification.php | 14 +- .../DeprecatedPushToImageRepository.php | 16 +- src/Api/Endpoint/DeprecatedQuantumView.php | 14 +- src/Api/Endpoint/DeprecatedRate.php | 15 +- src/Api/Endpoint/DeprecatedShipment.php | 20 +- src/Api/Endpoint/DeprecatedUpload.php | 16 +- src/Api/Endpoint/DeprecatedVoidShipment.php | 20 +- src/Api/Endpoint/FreightCancelPickup.php | 3 +- src/Api/Endpoint/FreightPickup.php | 5 +- src/Api/Endpoint/FreightRate.php | 5 +- src/Api/Endpoint/FreightShip.php | 5 +- src/Api/Endpoint/GenerateToken.php | 13 +- .../GetSingleTrackResponseUsingGET.php | 16 +- src/Api/Endpoint/LabelRecovery.php | 13 +- src/Api/Endpoint/LandedCost.php | 13 +- src/Api/Endpoint/Locator.php | 16 +- src/Api/Endpoint/PickupCancel.php | 14 +- src/Api/Endpoint/PickupCreation.php | 14 +- .../PickupGetPoliticalDivision1List.php | 12 +- .../PickupGetServiceCenterFacilities.php | 14 +- src/Api/Endpoint/PickupPendingStatus.php | 14 +- src/Api/Endpoint/PickupRate.php | 14 +- src/Api/Endpoint/PreNotification.php | 14 +- ...ocessSubscriptionTypeForTrackingNumber.php | 44 +- src/Api/Endpoint/PushToImageRepository.php | 16 +- src/Api/Endpoint/QuantumView.php | 14 +- src/Api/Endpoint/Rate.php | 15 +- src/Api/Endpoint/RefreshToken.php | 13 +- src/Api/Endpoint/Shipment.php | 20 +- src/Api/Endpoint/TimeInTransit.php | 35 +- src/Api/Endpoint/Upload.php | 16 +- src/Api/Endpoint/VoidShipment.php | 20 +- .../Model/AcceptanceAuditPreCheckRequest.php | 20 +- .../AcceptanceAuditPreCheckRequestRequest.php | 24 +- ...AcceptanceAuditPreCheckRequestShipment.php | 38 +- .../Model/AcceptanceAuditPreCheckResponse.php | 38 +- ...nceAuditPreCheckResponsePackageResults.php | 50 +- ...cceptanceAuditPreCheckResponseResponse.php | 12 - ...AcceptanceAuditPreCheckShipmentPackage.php | 102 +- src/Api/Model/AccessPointInformation.php | 6 - ...ccessPointInformationAccessPointStatus.php | 32 +- ...tInformationBusinessClassificationList.php | 8 +- ...cessPointInformationPrivateNetworkList.php | 8 +- src/Api/Model/Activity.php | 6 - .../AlertDetailElementLevelInformation.php | 44 +- .../Model/AlternateDeliveryAddressAddress.php | 28 +- ...lternateRatesResponseAlternateRateType.php | 28 +- ...OptionCodeTransportationPickUpSchedule.php | 8 +- ...eLocationAttributesPickUpPickUpDetails.php | 28 +- ...utesTransportationPickUpSchedulePickUp.php | 48 +- src/Api/Model/BillReceiverAddress.php | 48 +- src/Api/Model/BillShipperCreditCard.php | 76 +- src/Api/Model/BillThirdPartyAddress.php | 48 +- src/Api/Model/BrokerageFeeItems.php | 28 +- src/Api/Model/CN22FormCN22Content.php | 24 +- src/Api/Model/CODCODBillingOption.php | 28 +- src/Api/Model/CODCODPaymentMethod.php | 28 +- src/Api/Model/CODCODValue.php | 64 +- .../Model/CODTurnInPageImageImageFormat.php | 40 +- .../Model/CandidateAddressClassification.php | 28 +- src/Api/Model/ChargeCardCardAddress.php | 24 +- src/Api/Model/ChemicalDataChemicalDetail.php | 304 +- ...ChemicalDataPackageQuantityLimitDetail.php | 72 +- .../ChemicalReferenceDataRequestRequest.php | 46 +- .../Model/ChemicalReferenceDataResponse.php | 6 - ...micalReferenceDataResponseChemicalData.php | 6 - .../ChemicalReferenceDataResponseResponse.php | 6 - src/Api/Model/CommodityCommodityValue.php | 28 +- src/Api/Model/CommodityDimensions.php | 84 +- src/Api/Model/CommodityNMFCCommodity.php | 48 +- src/Api/Model/CommodityPackagingType.php | 20 +- src/Api/Model/ContactsForwardAgent.php | 32 +- src/Api/Model/ContactsProducer.php | 40 +- .../Model/ControlLogReceiptImageFormat.php | 44 +- .../DCRAvailabilityUnavailableReason.php | 32 +- src/Api/Model/DeclaredValueType.php | 44 +- src/Api/Model/DeleteResponseResponse.php | 8 +- src/Api/Model/DeliveryBillToAccount.php | 36 +- src/Api/Model/DeliveryDate.php | 12 - .../DeliveryLocationAddressArtifactFormat.php | 8 +- .../Model/DeliveryPackageReferenceNumber.php | 28 +- .../Model/DeliveryShipmentReferenceNumber.php | 28 +- src/Api/Model/DeliveryTime.php | 48 +- src/Api/Model/Destination.php | 24 +- src/Api/Model/DimWeightUnitOfMeasurement.php | 36 +- src/Api/Model/DistanceUnitOfMeasurement.php | 24 +- src/Api/Model/DocumentsPackingList.php | 6 - .../Model/DropLocationAdditionalComments.php | 8 +- src/Api/Model/DropLocationIVR.php | 40 +- .../Model/DropLocationLocationAttribute.php | 50 +- src/Api/Model/DropLocationOperatingHours.php | 8 +- .../Model/DropLocationServiceOfferingList.php | 8 +- src/Api/Model/DropOffFacilitiesAddress.php | 28 +- src/Api/Model/DropOffFacilitiesDistance.php | 44 +- .../Model/DropOffFacilitiesFacilityTime.php | 6 - .../DropOffFacilitiesLocalizedInstruction.php | 20 +- .../Model/DryIceWeightUnitOfMeasurement.php | 28 +- .../Model/EEIInformationDDTCInformation.php | 20 +- src/Api/Model/EEIInformationLicense.php | 64 +- src/Api/Model/EMailInformationEMail.php | 40 +- src/Api/Model/EMailInformationEMailType.php | 36 +- src/Api/Model/EmsResponse.php | 566 +- src/Api/Model/ErrorResponse.php | 6 - src/Api/Model/ErrorResponseWrapper.php | 6 - src/Api/Model/ExceptionBillToAccount.php | 40 +- .../Model/ExceptionPackageReferenceNumber.php | 28 +- .../ExceptionShipmentReferenceNumber.php | 28 +- src/Api/Model/ExceptionUpdatedAddress.php | 8 +- .../Model/ExcludeFromResultPostalCodeList.php | 6 - .../ExistingShipmentIDConfirmationNumber.php | 40 +- src/Api/Model/FREIGHTPICKUPRequestWrapper.php | 6 - src/Api/Model/FREIGHTSHIPRequestWrapper.php | 6 - src/Api/Model/FRSPaymentInformationType.php | 32 +- src/Api/Model/FacilityTimeDayOfWeek.php | 48 +- ...ureNotificationFailureNotificationCode.php | 32 +- .../FreightOptionsDestinationAddress.php | 44 +- src/Api/Model/FreightPickupRequest.php | 150 +- src/Api/Model/FreightPickupRequestPOM.php | 40 +- src/Api/Model/FreightPickupRequestRequest.php | 20 +- .../FreightPickupRequestShipmentDetail.php | 20 +- src/Api/Model/FreightRateRequest.php | 104 +- ...FreightRateRequestAlternateRateOptions.php | 32 +- src/Api/Model/FreightRateRequestCommodity.php | 60 +- .../Model/FreightRateRequestPickupRequest.php | 20 +- src/Api/Model/FreightRateRequestRequest.php | 48 +- ...eightRateRequestShipmentServiceOptions.php | 72 +- src/Api/Model/FreightRateResponse.php | 38 +- ...ightRateResponseAlternateRatesResponse.php | 6 - src/Api/Model/FreightRateResponseResponse.php | 6 - ...ipPickupNotificationsEMailNotification.php | 32 +- src/Api/Model/FreightShipRequestRequest.php | 68 +- src/Api/Model/FreightShipRequestShipment.php | 72 +- .../FreightShipResponseShipmentResults.php | 26 +- src/Api/Model/FreightShipShipmentShipFrom.php | 20 +- ...ightShipShipmentShipmentServiceOptions.php | 78 +- ...tShipmentInformationFreightDensityInfo.php | 6 - src/Api/Model/GenericBillToAccount.php | 44 +- .../Model/GenericPackageReferenceNumber.php | 20 +- .../Model/GenericShipmentReferenceNumber.php | 20 +- src/Api/Model/HandlingChargeAmount.php | 48 +- src/Api/Model/HazMatHazMatChemicalRecord.php | 28 +- .../Model/HighValueReportImageImageFormat.php | 32 +- src/Api/Model/ImagePrintFormat.php | 28 +- .../IncludeCriteriaServiceOfferingList.php | 6 - src/Api/Model/InquireNumbers.php | 6 - src/Api/Model/InternationalFormsCN22Form.php | 86 +- src/Api/Model/InternationalFormsContacts.php | 20 +- .../InternationalFormsEEIFilingOption.php | 32 +- src/Api/Model/InternationalFormsProduct.php | 120 +- .../InternationalFormsUPSPremiumCareForm.php | 48 +- src/Api/Model/LabelDeliveryEMail.php | 84 +- ...veryLabelSpecificationLabelImageFormat.php | 48 +- ...coveryLabelSpecificationLabelStockSize.php | 56 +- src/Api/Model/LabelRecoveryRequest.php | 192 +- .../LabelRecoveryRequestLabelDelivery.php | 28 +- src/Api/Model/LabelRecoveryRequestRequest.php | 36 +- .../Model/LabelRecoveryRequestTranslate.php | 124 +- ...LabelRecoveryRequestUPSPremiumCareForm.php | 48 +- src/Api/Model/LabelRecoveryResponse.php | 12 - .../LabelRecoveryResponseLabelResults.php | 20 +- src/Api/Model/LabelResultsLabelImage.php | 52 +- .../LabelResultsMailInnovationsLabelImage.php | 20 +- src/Api/Model/LabelResultsReceipt.php | 24 +- src/Api/Model/LandedCostRequest.php | 28 +- src/Api/Model/LandedCostRequestShipment.php | 222 +- src/Api/Model/LocationAttributeOptionCode.php | 56 +- src/Api/Model/LocationAttributeOptionType.php | 36 +- ...ocationSearchCriteriaAccessPointSearch.php | 24 +- ...ionSearchCriteriaFreightWillCallSearch.php | 138 +- ...LocationSearchCriteriaOpenTimeCriteria.php | 48 +- .../LocationSearchCriteriaSearchOption.php | 50 +- .../LocationSearchCriteriaServiceSearch.php | 12 - src/Api/Model/LocatorRequest.php | 60 +- .../LocatorRequestLocationSearchCriteria.php | 38 +- src/Api/Model/LocatorRequestOriginAddress.php | 44 +- src/Api/Model/LocatorRequestRequest.php | 76 +- .../Model/LocatorRequestServiceGeoUnit.php | 40 +- src/Api/Model/LocatorRequestSortCriteria.php | 36 +- src/Api/Model/LocatorRequestTranslate.php | 24 +- .../Model/LocatorRequestUnitOfMeasurement.php | 32 +- src/Api/Model/LocatorResponse.php | 20 +- src/Api/Model/LocatorResponseResponse.php | 30 +- .../Model/LocatorResponseSearchResults.php | 72 +- src/Api/Model/ManifestBillToAccount.php | 36 +- src/Api/Model/ManifestPackage.php | 68 +- src/Api/Model/ManifestPackageDimensions.php | 20 +- .../ManifestPackagePackageServiceOptions.php | 36 +- .../Model/ManifestPackageReferenceNumber.php | 28 +- .../ManifestPackageServiceOptionsCOD.php | 28 +- src/Api/Model/ManifestShipToAddress.php | 30 +- src/Api/Model/ManifestShipperAddress.php | 30 +- src/Api/Model/OperatingHoursStandardHours.php | 56 +- ...OptionCodeTransportationPickUpSchedule.php | 8 +- .../Model/OriginAddressAddressKeyFormat.php | 44 +- .../OriginAddressOriginSearchCriteria.php | 56 +- src/Api/Model/OriginBillToAccount.php | 36 +- .../Model/OriginPackageReferenceNumber.php | 28 +- .../Model/OriginShipmentReferenceNumber.php | 28 +- src/Api/Model/OverSeasLegDimensions.php | 60 +- src/Api/Model/OverSeasLegValue.php | 40 +- src/Api/Model/POMPickupNotifications.php | 6 - src/Api/Model/Package.php | 48 - src/Api/Model/PackageChemicalRecord.php | 324 +- .../Model/PackagePackageServiceOptions.php | 114 +- src/Api/Model/PackagePackaging.php | 116 +- src/Api/Model/PackagePackagingType.php | 76 +- src/Api/Model/PackageReferenceNumber.php | 60 +- .../PackageResultsChemicalRecordResults.php | 20 +- src/Api/Model/PackageResultsForm.php | 24 +- .../Model/PackageResultsNegotiatedCharges.php | 44 +- .../PackageResultsServiceOptionsCharges.php | 24 +- src/Api/Model/PackageResultsShippingLabel.php | 8 +- .../Model/PackageResultsShippingReceipt.php | 24 +- ...kageServiceOptionsDeliveryConfirmation.php | 28 +- src/Api/Model/PackageServiceOptionsHazMat.php | 360 +- .../PackageServiceOptionsNotification.php | 36 +- ...PackageServiceOptionsNotificationEMail.php | 100 +- src/Api/Model/PackageSimpleRate.php | 40 +- src/Api/Model/PackageUPSPremier.php | 24 +- .../Model/PackageWeightUnitOfMeasurement.php | 56 +- src/Api/Model/PackingListHandlingUnit.php | 6 - src/Api/Model/PaymentInformationPayer.php | 20 +- ...aymentInformationShipmentBillingOption.php | 32 +- .../PaymentInformationShipmentCharge.php | 112 +- src/Api/Model/PickupCancelRequest.php | 44 +- src/Api/Model/PickupCancelResponse.php | 20 +- .../Model/PickupCancelResponseGWNStatus.php | 52 +- src/Api/Model/PickupCreationRequest.php | 408 +- .../PickupCreationRequestPickupAddress.php | 72 +- .../PickupCreationRequestPickupDateInfo.php | 124 +- .../PickupCreationRequestPickupPiece.php | 80 +- .../Model/PickupCreationRequestRequest.php | 44 +- .../Model/PickupCreationRequestShipper.php | 20 +- .../PickupCreationRequestTotalWeight.php | 44 +- src/Api/Model/PickupCreationResponse.php | 24 +- .../PickupCreationResponseRateResult.php | 40 +- .../PickupCreationResponseRateStatus.php | 52 +- ...reationResponseWeekendServiceTerritory.php | 28 +- src/Api/Model/PickupFacilitiesAddress.php | 28 +- .../PickupFacilitiesFacilityTimeDayOfWeek.php | 48 +- ...ickupGetServiceCenterFacilitiesRequest.php | 26 +- ...terFacilitiesRequestDestinationAddress.php | 28 +- ...viceCenterFacilitiesRequestPickupPiece.php | 40 +- ...acilitiesResponseServiceCenterLocation.php | 6 - .../PickupNotificationsEMailNotification.php | 20 +- src/Api/Model/PickupPendingStatusRequest.php | 20 +- src/Api/Model/PickupPendingStatusResponse.php | 6 - ...ckupPendingStatusResponsePendingStatus.php | 140 +- src/Api/Model/PickupRateRequest.php | 228 +- .../Model/PickupRateRequestPickupAddress.php | 68 +- .../Model/PickupRateRequestPickupDateInfo.php | 76 +- src/Api/Model/PickupRateRequestRequest.php | 44 +- .../Model/PickupRateRequestShipperAccount.php | 20 +- src/Api/Model/PickupRateResponse.php | 24 +- .../Model/PickupRateResponseRateResult.php | 24 +- src/Api/Model/PickupRateResponseResponse.php | 6 - ...kupRateResponseWeekendServiceTerritory.php | 56 +- src/Api/Model/PickupRequestPOM.php | 20 +- .../Model/PreAlertNotificationTextMessage.php | 52 +- .../PreAlertNotificationVoiceMessage.php | 52 +- .../PreNotificationPackageChemicalRecord.php | 80 +- .../Model/PreNotificationRequestShipment.php | 38 +- .../Model/PreNotificationResponseResponse.php | 8 +- .../Model/PreNotificationShipmentPackage.php | 6 - src/Api/Model/ProductPackingListInfo.php | 6 - src/Api/Model/ProductScheduleB.php | 6 - .../Model/ProductWeightUnitOfMeasurement.php | 28 +- .../Model/PushToImageRepositoryRequest.php | 4 +- .../PushToImageRepositoryResponseResponse.php | 8 +- .../QuantumViewEventsSubscriptionEvents.php | 8 +- src/Api/Model/QuantumViewRequest.php | 30 +- .../QuantumViewResponseQuantumViewEvents.php | 8 +- src/Api/Model/QuantumViewResponseResponse.php | 28 +- .../RateAlternateDeliveryAddressAddress.php | 44 +- .../RatePackagePackageServiceOptions.php | 96 +- .../Model/RatePackageServiceOptionsHazMat.php | 6 - src/Api/Model/RateRequestRequest.php | 44 +- src/Api/Model/RateRequestShipment.php | 48 +- src/Api/Model/RateResponse.php | 8 +- src/Api/Model/RateResponseRatedShipment.php | 124 +- src/Api/Model/RateResponseResponse.php | 16 +- src/Api/Model/RateResultChargeDetail.php | 68 +- src/Api/Model/RateResultDisclaimer.php | 40 +- src/Api/Model/RateResultTaxCharges.php | 20 +- .../RateShipmentShipmentServiceOptions.php | 148 +- src/Api/Model/RateShipmentShipper.php | 36 +- .../Model/RatedPackageNegotiatedCharges.php | 8 +- src/Api/Model/RatedPackageSimpleRate.php | 40 +- .../Model/RatedShipmentFRSShipmentData.php | 8 +- .../RatedShipmentNegotiatedRateCharges.php | 16 +- src/Api/Model/RatedShipmentRatedPackage.php | 24 +- src/Api/Model/ReceiptImageImageFormat.php | 28 +- src/Api/Model/ReferenceWeight.php | 48 +- src/Api/Model/ResponseError.php | 16 +- src/Api/Model/ResponseResponseStatus.php | 20 +- src/Api/Model/ScheduleBUnitOfMeasurement.php | 28 +- src/Api/Model/SearchOptionOptionCode.php | 28 +- src/Api/Model/SearchOptionOptionType.php | 48 +- src/Api/Model/SearchOptionRelation.php | 40 +- src/Api/Model/SearchResultsDropLocation.php | 352 +- ...ServiceCenterLocationDropOffFacilities.php | 34 +- .../ServiceCenterLocationPickupFacilities.php | 72 +- .../ServiceOfferingListServiceOffering.php | 68 +- src/Api/Model/ServiceSearchServiceCode.php | 36 +- .../Model/ServiceSearchServiceOptionCode.php | 40 +- src/Api/Model/Services.php | 408 +- src/Api/Model/ShipFromTaxIDType.php | 20 +- src/Api/Model/ShipFromVendorInfo.php | 76 +- src/Api/Model/ShipToAddress.php | 120 +- src/Api/Model/Shipment.php | 12 - src/Api/Model/ShipmentChargeBillReceiver.php | 32 +- src/Api/Model/ShipmentChargeBillShipper.php | 112 +- .../Model/ShipmentChargeBillThirdParty.php | 32 +- src/Api/Model/ShipmentCommodity.php | 20 +- src/Api/Model/ShipmentDGSignatoryInfo.php | 72 +- .../Model/ShipmentDeliveryTimeInformation.php | 50 +- src/Api/Model/ShipmentDetailPackagingType.php | 20 +- src/Api/Model/ShipmentDetailWeight.php | 24 +- src/Api/Model/ShipmentDocuments.php | 6 - src/Api/Model/ShipmentExistingShipmentID.php | 20 +- .../ShipmentFreightShipmentInformation.php | 20 +- src/Api/Model/ShipmentPackage.php | 30 +- src/Api/Model/ShipmentPaymentDetails.php | 6 - src/Api/Model/ShipmentPaymentInformation.php | 6 - src/Api/Model/ShipmentPickupRequest.php | 116 +- src/Api/Model/ShipmentReference.php | 40 +- .../ShipmentRequestLabelSpecification.php | 118 +- src/Api/Model/ShipmentRequestRequest.php | 84 +- src/Api/Model/ShipmentRequestShipment.php | 442 +- src/Api/Model/ShipmentResponseResponse.php | 8 +- .../Model/ShipmentResponseShipmentResults.php | 252 +- src/Api/Model/ShipmentResultsDisclaimer.php | 24 +- src/Api/Model/ShipmentResultsDocuments.php | 12 - .../Model/ShipmentResultsFRSShipmentData.php | 8 +- src/Api/Model/ShipmentResultsForm.php | 24 +- .../Model/ShipmentResultsImageImageFormat.php | 24 +- .../ShipmentResultsNegotiatedRateCharges.php | 44 +- .../Model/ShipmentResultsPackageResults.php | 184 +- .../Model/ShipmentResultsShipmentCharges.php | 120 +- src/Api/Model/ShipmentReturnService.php | 84 +- .../ShipmentServiceOptionsCallTagARS.php | 52 +- .../ShipmentServiceOptionsDeclaredValue.php | 64 +- ...mentServiceOptionsDeliveryConfirmation.php | 24 +- ...ShipmentServiceOptionsEMailInformation.php | 6 - ...pmentServiceOptionsExcessDeclaredValue.php | 20 +- .../ShipmentServiceOptionsHandlingCharge.php | 56 +- ...ipmentServiceOptionsInternationalForms.php | 302 +- .../ShipmentServiceOptionsLabelMethod.php | 36 +- .../ShipmentServiceOptionsNotification.php | 76 +- src/Api/Model/ShipmentShipFrom.php | 60 +- src/Api/Model/ShipmentShipTo.php | 28 +- .../Model/ShipmentShipmentIndicationType.php | 28 +- .../Model/ShipmentShipmentRatingOptions.php | 92 +- .../Model/ShipmentShipmentServiceOptions.php | 156 +- src/Api/Model/ShipmentShipper.php | 168 +- .../ShipmentTotalWeightUnitOfMeasurement.php | 36 +- src/Api/Model/ShipperAccount.php | 20 +- src/Api/Model/ShipperAddress.php | 92 +- src/Api/Model/ShipperChargeCard.php | 84 +- src/Api/Model/ShipperPhone.php | 52 +- .../ShippingAvailabilityUnavailableReason.php | 44 +- src/Api/Model/ShippingReceiptImageFormat.php | 24 +- src/Api/Model/StandardHoursDayOfWeek.php | 48 +- src/Api/Model/SubscriptionEventsDateRange.php | 40 +- .../SubscriptionEventsSubscriptionFile.php | 60 +- .../SubscriptionEventsSubscriptionStatus.php | 88 +- src/Api/Model/SubscriptionFileDelivery.php | 16 +- src/Api/Model/SubscriptionFileException.php | 16 +- src/Api/Model/SubscriptionFileGeneric.php | 132 +- src/Api/Model/SubscriptionFileManifest.php | 140 +- src/Api/Model/SubscriptionFileOrigin.php | 16 +- src/Api/Model/SubscriptionFileStatusType.php | 28 +- src/Api/Model/TimeInTransitRequest.php | 572 +- src/Api/Model/TimeInTransitResponse.php | 24 - src/Api/Model/TrackApiResponse.php | 6 - src/Api/Model/TrackResponse.php | 6 - .../Model/TrackSubsServiceErrorResponse.php | 6 - .../TransportationPickUpSchedulePickUp.php | 48 +- ...emiumCareFormLanguageForUPSPremiumCare.php | 24 +- ...UltimateConsigneeUltimateConsigneeType.php | 40 +- src/Api/Model/UnitUnitOfMeasurement.php | 28 +- src/Api/Model/UploadRequest.php | 6 - .../Model/UploadRequestUserCreatedForm.php | 28 +- .../UploadResponseFormsHistoryDocumentID.php | 8 +- src/Api/Model/UploadResponseResponse.php | 8 +- src/Api/Model/ValidationList.php | 12 - src/Api/Model/ValueCWT.php | 64 +- src/Api/Model/ValueCube.php | 64 +- src/Api/Model/VoidShipmentResponse.php | 8 +- src/Api/Model/Warning.php | 12 - src/Api/Model/XAVRequest.php | 40 +- src/Api/Model/XAVRequestAddressKeyFormat.php | 48 +- src/Api/Model/XAVRequestRequest.php | 52 +- src/Api/Model/XAVRequestWrapper.php | 6 - src/Api/Model/XAVResponse.php | 8 +- .../XAVResponseAddressClassification.php | 44 +- src/Api/Model/XAVResponseCandidate.php | 6 - src/Api/Model/XAVResponseResponse.php | 8 +- ...ceptanceAuditPreCheckRequestNormalizer.php | 178 +- ...eAuditPreCheckRequestRequestNormalizer.php | 186 +- ...AuditPreCheckRequestShipmentNormalizer.php | 241 +- ...eptanceAuditPreCheckResponseNormalizer.php | 242 +- ...eCheckResponsePackageResultsNormalizer.php | 221 +- ...uditPreCheckResponseResponseNormalizer.php | 245 +- ...AuditPreCheckResponseServiceNormalizer.php | 144 +- ...AuditPreCheckShipmentPackageNormalizer.php | 301 +- ...CheckShipmentShipFromAddressNormalizer.php | 222 +- ...reCheckShipmentShipToAddressNormalizer.php | 222 +- ...InformationAccessPointStatusNormalizer.php | 159 +- ...PointInformationAvailabilityNormalizer.php | 167 +- ...onBusinessClassificationListNormalizer.php | 162 +- .../AccessPointInformationNormalizer.php | 148 +- ...nformationPrivateNetworkListNormalizer.php | 162 +- ...PointSearchExcludeFromResultNormalizer.php | 229 +- ...ssPointSearchIncludeCriteriaNormalizer.php | 186 +- ...ocationAddressArtifactFormatNormalizer.php | 186 +- src/Api/Normalizer/ActivityNormalizer.php | 278 +- ...dditionalCommentsCommentTypeNormalizer.php | 159 +- ...atAddressExtendedInformationNormalizer.php | 186 +- src/Api/Normalizer/AddressNormalizer.php | 345 +- ...ustedHeightUnitOfMeasurementNormalizer.php | 163 +- ...ustedWeightUnitOfMeasurementNormalizer.php | 163 +- ...etailElementLevelInformationNormalizer.php | 185 +- ...ernateDeliveryAddressAddressNormalizer.php | 228 +- ...tesResponseAlternateRateTypeNormalizer.php | 163 +- ...sponseBillableShipmentWeightNormalizer.php | 159 +- ...esResponseFreightDensityRateNormalizer.php | 159 +- .../AlternateRatesResponseRateNormalizer.php | 178 +- ...teRatesResponseTimeInTransitNormalizer.php | 144 +- .../AlternateTrackingNumberNormalizer.php | 167 +- .../AvailabilityDCRAvailabilityNormalizer.php | 167 +- ...labilityShippingAvailabilityNormalizer.php | 167 +- ...LocationAttributesOptionCodeNormalizer.php | 216 +- ...TransportationPickUpScheduleNormalizer.php | 162 +- ...LocationAttributesOptionTypeNormalizer.php | 159 +- ...ttributesPickUpPickUpDetailsNormalizer.php | 163 +- ...ortationPickUpSchedulePickUpNormalizer.php | 159 +- .../BillReceiverAddressNormalizer.php | 148 +- .../BillShipperCreditCardNormalizer.php | 206 +- .../BillThirdPartyAddressNormalizer.php | 163 +- ...pmentWeightUnitOfMeasurementNormalizer.php | 163 +- ...llingWeightUnitOfMeasurementNormalizer.php | 163 +- .../BrokerageFeeItemsNormalizer.php | 176 +- ...onListBusinessClassificationNormalizer.php | 159 +- ...CN22ContentCN22ContentWeightNormalizer.php | 159 +- ...ntentWeightUnitOfMeasurementNormalizer.php | 163 +- .../CN22FormCN22ContentNormalizer.php | 242 +- src/Api/Normalizer/CODCODAmountNormalizer.php | 159 +- .../CODCODBillingOptionNormalizer.php | 163 +- .../CODCODPaymentMethodNormalizer.php | 163 +- src/Api/Normalizer/CODCODValueNormalizer.php | 159 +- src/Api/Normalizer/CODRemitToNormalizer.php | 237 +- ...ODTurnInPageImageImageFormatNormalizer.php | 163 +- .../CODTurnInPageImageNormalizer.php | 159 +- ...ndidateAddressClassificationNormalizer.php | 159 +- .../CandidateAddressKeyFormatNormalizer.php | 374 +- .../Normalizer/CandidateAddressNormalizer.php | 293 +- .../ChargeCardCardAddressNormalizer.php | 244 +- .../ChemicalDataChemicalDetailNormalizer.php | 446 +- ...taPackageQuantityLimitDetailNormalizer.php | 207 +- ...DataProperShippingNameDetailNormalizer.php | 144 +- ...ChemicalReferenceDataRequestNormalizer.php | 197 +- ...lReferenceDataRequestRequestNormalizer.php | 208 +- ...enceDataResponseChemicalDataNormalizer.php | 206 +- ...hemicalReferenceDataResponseNormalizer.php | 185 +- ...eferenceDataResponseResponseNormalizer.php | 204 +- .../CommodityAdjustedWeightNormalizer.php | 159 +- .../CommodityCommodityValueNormalizer.php | 163 +- .../CommodityDimensionsNormalizer.php | 185 +- .../CommodityNMFCCommodityNormalizer.php | 167 +- .../Normalizer/CommodityNMFCNormalizer.php | 163 +- .../CommodityPackagingTypeNormalizer.php | 163 +- .../Normalizer/CommodityWeightNormalizer.php | 159 +- .../ConfirmationNumberTypeNormalizer.php | 159 +- .../ContactsForwardAgentNormalizer.php | 172 +- ...ontactsIntermediateConsigneeNormalizer.php | 159 +- .../Normalizer/ContactsProducerNormalizer.php | 278 +- .../Normalizer/ContactsSoldToNormalizer.php | 281 +- .../ContactsUltimateConsigneeNormalizer.php | 178 +- ...ControlLogReceiptImageFormatNormalizer.php | 163 +- .../CreditCardAddressNormalizer.php | 228 +- ...OODSUTILITYAPCRequestWrapperNormalizer.php | 144 +- ...ODSUTILITYAPCResponseWrapperNormalizer.php | 144 +- ...USGOODSUTILITYRequestWrapperNormalizer.php | 144 +- ...SGOODSUTILITYResponseWrapperNormalizer.php | 144 +- ...vailabilityUnavailableReasonNormalizer.php | 159 +- ...InformationUnitOfMeasurementNormalizer.php | 163 +- .../DangerousGoodsPhoneNormalizer.php | 163 +- ...erousGoodsTransportationModeNormalizer.php | 163 +- .../DeclaredValueTypeNormalizer.php | 163 +- .../Normalizer/DeleteRequestNormalizer.php | 172 +- .../DeleteRequestRequestNormalizer.php | 186 +- .../Normalizer/DeleteResponseNormalizer.php | 144 +- .../DeleteResponseResponseNormalizer.php | 204 +- .../DeliveryActivityLocationNormalizer.php | 144 +- .../DeliveryBillToAccountNormalizer.php | 159 +- src/Api/Normalizer/DeliveryCODNormalizer.php | 148 +- src/Api/Normalizer/DeliveryDateNormalizer.php | 167 +- .../DeliveryDeliveryLocationNormalizer.php | 201 +- .../DeliveryInformationNormalizer.php | 186 +- ...ocationAddressArtifactFormatNormalizer.php | 460 +- ...liveryPackageReferenceNumberNormalizer.php | 201 +- ...iveryShipmentReferenceNumberNormalizer.php | 201 +- ...eliveryTimeInformationPickupNormalizer.php | 163 +- ...mationReturnContractServicesNormalizer.php | 163 +- src/Api/Normalizer/DeliveryTimeNormalizer.php | 186 +- src/Api/Normalizer/DestinationNormalizer.php | 172 +- .../DimWeightUnitOfMeasurementNormalizer.php | 163 +- ...ionalWeightUnitOfMeasurementNormalizer.php | 163 +- .../DimensionsUnitOfMeasurementNormalizer.php | 163 +- .../DistanceUnitOfMeasurementNormalizer.php | 163 +- .../Normalizer/DocumentsFormsNormalizer.php | 172 +- .../Normalizer/DocumentsImageNormalizer.php | 172 +- .../DocumentsPackingListNormalizer.php | 227 +- ...cationAccessPointInformationNormalizer.php | 278 +- ...opLocationAdditionalCommentsNormalizer.php | 162 +- ...DropLocationAddressKeyFormatNormalizer.php | 269 +- .../DropLocationDistanceNormalizer.php | 159 +- .../DropLocationGeocodeNormalizer.php | 159 +- .../Normalizer/DropLocationIVRNormalizer.php | 163 +- ...LocationLocalizedInstructionNormalizer.php | 159 +- ...ropLocationLocationAttributeNormalizer.php | 177 +- .../DropLocationLocationImageNormalizer.php | 167 +- .../DropLocationOperatingHoursNormalizer.php | 168 +- ...LocationPromotionInformationNormalizer.php | 159 +- ...pLocationServiceOfferingListNormalizer.php | 162 +- .../DropLocationSortCodeNormalizer.php | 167 +- ...pLocationSpecialInstructionsNormalizer.php | 144 +- .../DropOffFacilitiesAddressNormalizer.php | 233 +- .../DropOffFacilitiesDistanceNormalizer.php | 167 +- ...ropOffFacilitiesFacilityTimeNormalizer.php | 162 +- ...cilitiesLocalizedInstructionNormalizer.php | 167 +- .../DryIceDryIceWeightNormalizer.php | 159 +- ...ryIceWeightUnitOfMeasurementNormalizer.php | 163 +- .../EEIFilingOptionShipperFiledNormalizer.php | 222 +- .../EEIFilingOptionUPSFiledNormalizer.php | 144 +- ...EIInformationDDTCInformationNormalizer.php | 299 +- .../EEIInformationLicenseNormalizer.php | 207 +- .../EMailInformationEMailNormalizer.php | 197 +- .../EMailInformationEMailTypeNormalizer.php | 163 +- ...InformationElementIdentifierNormalizer.php | 159 +- src/Api/Normalizer/EmsResponseNormalizer.php | 657 +- .../ErrorErrorLocationNormalizer.php | 167 +- src/Api/Normalizer/ErrorNormalizer.php | 167 +- .../Normalizer/ErrorResponseNormalizer.php | 148 +- .../ErrorResponseWrapperNormalizer.php | 168 +- src/Api/Normalizer/ErrorsNormalizer.php | 228 +- .../EstimatedArrivalArrivalNormalizer.php | 163 +- .../EstimatedArrivalPickupNormalizer.php | 163 +- .../ExceptionActivityLocationNormalizer.php | 144 +- .../ExceptionBillToAccountNormalizer.php | 159 +- ...eptionPackageReferenceNumberNormalizer.php | 201 +- .../ExceptionResolutionNormalizer.php | 163 +- ...ptionShipmentReferenceNumberNormalizer.php | 201 +- .../ExceptionUpdatedAddressNormalizer.php | 395 +- ...ludeFromResultPostalCodeListNormalizer.php | 162 +- ...ShipmentIDConfirmationNumberNormalizer.php | 159 +- ...HTPICKUPCANCELRequestWrapperNormalizer.php | 144 +- ...TPICKUPCANCELResponseWrapperNormalizer.php | 144 +- .../FREIGHTPICKUPRequestWrapperNormalizer.php | 144 +- ...FREIGHTPICKUPResponseWrapperNormalizer.php | 144 +- .../FREIGHTRATERequestWrapperNormalizer.php | 144 +- .../FREIGHTRATEResponseWrapperNormalizer.php | 144 +- .../FREIGHTSHIPRequestWrapperNormalizer.php | 144 +- .../FREIGHTSHIPResponseWrapperNormalizer.php | 144 +- ...FRSPaymentInformationAddressNormalizer.php | 163 +- .../FRSPaymentInformationTypeNormalizer.php | 163 +- ...ipmentDataFreightDensityRateNormalizer.php | 159 +- ...FRSShipmentDataHandlingUnitsNormalizer.php | 191 +- ...entDataTransportationChargesNormalizer.php | 185 +- .../FacilityTimeDayOfWeekNormalizer.php | 260 +- .../FactorUnitOfMeasurementNormalizer.php | 163 +- ...ationFailureNotificationCodeNormalizer.php | 167 +- src/Api/Normalizer/FormImageNormalizer.php | 159 +- src/Api/Normalizer/FormsFormatNormalizer.php | 159 +- src/Api/Normalizer/FormsTypeNormalizer.php | 159 +- .../ForwardAgentAddressNormalizer.php | 249 +- .../FreightCancelPickupRequestNormalizer.php | 159 +- ...htCancelPickupRequestRequestNormalizer.php | 148 +- .../FreightCancelPickupResponseNormalizer.php | 159 +- ...CancelPickupResponseResponseNormalizer.php | 182 +- .../FreightCancelStatusNormalizer.php | 159 +- ...ghtDensityInfoAdjustedHeightNormalizer.php | 159 +- ...ightDensityInfoHandlingUnitsNormalizer.php | 172 +- ...ghtOptionsDestinationAddressNormalizer.php | 201 +- ...FreightOptionsShipmentDetailNormalizer.php | 167 +- ...ptionsShipmentServiceOptionsNormalizer.php | 186 +- ...kupRequestExistingShipmentIDNormalizer.php | 159 +- .../FreightPickupRequestNormalizer.php | 508 +- .../FreightPickupRequestPOMNormalizer.php | 186 +- .../FreightPickupRequestRequestNormalizer.php | 167 +- ...reightPickupRequestRequesterNormalizer.php | 206 +- ...FreightPickupRequestShipFromNormalizer.php | 206 +- .../FreightPickupRequestShipToNormalizer.php | 207 +- ...tPickupRequestShipmentDetailNormalizer.php | 206 +- ...equestShipmentServiceOptionsNormalizer.php | 207 +- .../FreightPickupResponseNormalizer.php | 159 +- ...reightPickupResponseResponseNormalizer.php | 182 +- .../FreightPickupShipToAddressNormalizer.php | 250 +- .../FreightRateCODRemitToNormalizer.php | 178 +- ...tRatePaymentInformationPayerNormalizer.php | 197 +- ...eRequestAlternateRateOptionsNormalizer.php | 163 +- .../FreightRateRequestCommodityNormalizer.php | 351 +- ...FreightRateRequestGFPOptionsNormalizer.php | 167 +- ...htRateRequestHandlingUnitOneNormalizer.php | 159 +- ...htRateRequestHandlingUnitTwoNormalizer.php | 159 +- ...ateRequestHandlingUnitWeightNormalizer.php | 159 +- ...ightRateRequestHandlingUnitsNormalizer.php | 172 +- .../FreightRateRequestNormalizer.php | 534 +- ...ateRequestPaymentInformationNormalizer.php | 159 +- ...ightRateRequestPickupRequestNormalizer.php | 163 +- .../FreightRateRequestRequestNormalizer.php | 186 +- .../FreightRateRequestServiceNormalizer.php | 163 +- .../FreightRateRequestShipFromNormalizer.php | 182 +- .../FreightRateRequestShipToNormalizer.php | 182 +- ...equestShipmentServiceOptionsNormalizer.php | 375 +- ...sponseAlternateRatesResponseNormalizer.php | 236 +- ...sponseBillableShipmentWeightNormalizer.php | 159 +- ...FreightRateResponseCommodityNormalizer.php | 197 +- ...ateResponseDimensionalWeightNormalizer.php | 159 +- ...teResponseFreightDensityRateNormalizer.php | 159 +- ...ghtRateResponseHandlingUnitsNormalizer.php | 185 +- .../FreightRateResponseNormalizer.php | 475 +- .../FreightRateResponseRateNormalizer.php | 159 +- .../FreightRateResponseResponseNormalizer.php | 204 +- .../FreightRateResponseServiceNormalizer.php | 163 +- ...ghtRateResponseTimeInTransitNormalizer.php | 144 +- ...eResponseTotalShipmentChargeNormalizer.php | 159 +- .../FreightRateShipFromAddressNormalizer.php | 278 +- .../FreightRateShipToAddressNormalizer.php | 278 +- ...eightShipCommodityDimensionsNormalizer.php | 172 +- ...htShipPOMPickupNotificationsNormalizer.php | 178 +- .../FreightShipPayerAddressNormalizer.php | 231 +- ...tificationsEMailNotificationNormalizer.php | 159 +- .../FreightShipRemitToAddressNormalizer.php | 231 +- .../FreightShipRequestNormalizer.php | 159 +- .../FreightShipRequestRequestNormalizer.php | 182 +- .../FreightShipRequestShipmentNormalizer.php | 534 +- .../FreightShipResponseNormalizer.php | 159 +- .../FreightShipResponseResponseNormalizer.php | 182 +- ...tShipResponseShipmentResultsNormalizer.php | 416 +- .../FreightShipShipFromAddressNormalizer.php | 231 +- .../FreightShipShipToAddressNormalizer.php | 231 +- ...ipShipmentPaymentInformationNormalizer.php | 159 +- ...ServiceOptionsDangerousGoodsNormalizer.php | 159 +- .../FreightShipShipmentShipFromNormalizer.php | 266 +- .../FreightShipShipmentShipToNormalizer.php | 272 +- ...ipmentShipmentServiceOptionsNormalizer.php | 418 +- ...nformationFreightDensityInfoNormalizer.php | 206 +- ...ghtShipmentServiceOptionsCODNormalizer.php | 185 +- ...erviceOptionsDeliveryOptionsNormalizer.php | 278 +- ...tServiceOptionsPickupOptionsNormalizer.php | 257 +- ...illCallSearchFacilityAddressNormalizer.php | 292 +- .../GFPOptionsOnCallInformationNormalizer.php | 148 +- ...GenerateTokenSuccessResponseNormalizer.php | 419 +- .../Normalizer/GenericActivityNormalizer.php | 167 +- .../GenericBillToAccountNormalizer.php | 159 +- .../GenericFailureNotificationNormalizer.php | 167 +- ...enericPackageReferenceNumberNormalizer.php | 201 +- .../Normalizer/GenericServiceNormalizer.php | 163 +- .../Normalizer/GenericShipToNormalizer.php | 186 +- ...nericShipmentReferenceNumberNormalizer.php | 201 +- ...odeCandidateAddressKeyFormatNormalizer.php | 269 +- .../GeocodeCandidateGeocodeNormalizer.php | 159 +- .../HandlingChargeAmountNormalizer.php | 159 +- .../HandlingUnitCommodityNormalizer.php | 314 +- .../HandlingUnitOneTypeNormalizer.php | 159 +- .../HandlingUnitTwoTypeNormalizer.php | 159 +- ...andlingUnitUnitOfMeasurementNormalizer.php | 163 +- ...gUnitWeightUnitOfMeasurementNormalizer.php | 163 +- .../HandlingUnitsAdjustedHeightNormalizer.php | 159 +- .../HandlingUnitsDimensionsNormalizer.php | 185 +- .../HandlingUnitsTypeNormalizer.php | 159 +- ...ndlingUnitsUnitOfMeasurementNormalizer.php | 163 +- .../HazMatHazMatChemicalRecordNormalizer.php | 581 +- ...hValueReportImageImageFormatNormalizer.php | 163 +- .../HighValueReportImageNormalizer.php | 159 +- src/Api/Normalizer/ImageFormatNormalizer.php | 159 +- .../Normalizer/ImageImageFormatNormalizer.php | 163 +- .../Normalizer/ImagePrintFormatNormalizer.php | 163 +- .../Normalizer/ImagePrintSizeNormalizer.php | 159 +- src/Api/Normalizer/ImageTypeNormalizer.php | 159 +- ...riaMerchantAccountNumberListNormalizer.php | 160 +- .../IncludeCriteriaSearchFilterNormalizer.php | 207 +- ...eCriteriaServiceOfferingListNormalizer.php | 162 +- .../Normalizer/InquireNumbersNormalizer.php | 168 +- ...BasicFlexibleParcelIndicatorNormalizer.php | 159 +- ...endedFlexibleParcelIndicatorNormalizer.php | 159 +- ...ansitFlexibleParcelIndicatorNormalizer.php | 159 +- ...IntermediateConsigneeAddressNormalizer.php | 249 +- ...ernationalFormsBlanketPeriodNormalizer.php | 159 +- .../InternationalFormsCN22FormNormalizer.php | 260 +- .../InternationalFormsContactsNormalizer.php | 228 +- .../InternationalFormsDiscountNormalizer.php | 144 +- ...nationalFormsEEIFilingOptionNormalizer.php | 222 +- ...rnationalFormsFreightChargesNormalizer.php | 144 +- ...ationalFormsInsuranceChargesNormalizer.php | 144 +- ...ternationalFormsOtherChargesNormalizer.php | 159 +- .../InternationalFormsProductNormalizer.php | 563 +- ...ionalFormsUPSPremiumCareFormNormalizer.php | 200 +- ...nationalFormsUserCreatedFormNormalizer.php | 160 +- src/Api/Normalizer/JaneObjectNormalizer.php | 7768 ++++++----------- .../LABELRECOVERYRequestWrapperNormalizer.php | 144 +- ...LABELRECOVERYResponseWrapperNormalizer.php | 144 +- .../LOCATORRequestWrapperNormalizer.php | 144 +- .../LOCATORResponseWrapperNormalizer.php | 144 +- ...ODTurnInPageImageImageFormatNormalizer.php | 163 +- .../LRCODTurnInPageImageNormalizer.php | 159 +- src/Api/Normalizer/LRFormImageNormalizer.php | 159 +- ...RRequestTransactionReferenceNormalizer.php | 148 +- .../LRResponseResponseStatusNormalizer.php | 159 +- ...ResponseTransactionReferenceNormalizer.php | 148 +- .../LabelDeliveryEMailNormalizer.php | 272 +- .../LabelImageLabelImageFormatNormalizer.php | 144 +- .../LabelRecoveryFormImageNormalizer.php | 159 +- ...abelRecoveryImageImageFormatNormalizer.php | 163 +- ...pecificationLabelImageFormatNormalizer.php | 163 +- ...lSpecificationLabelStockSizeNormalizer.php | 159 +- ...RecoveryRequestLabelDeliveryNormalizer.php | 167 +- ...eryRequestLabelSpecificationNormalizer.php | 186 +- .../LabelRecoveryRequestNormalizer.php | 314 +- ...coveryRequestReferenceValuesNormalizer.php | 159 +- .../LabelRecoveryRequestRequestNormalizer.php | 186 +- ...abelRecoveryRequestTranslateNormalizer.php | 172 +- ...eryRequestUPSPremiumCareFormNormalizer.php | 159 +- ...ecoveryResponseCODTurnInPageNormalizer.php | 144 +- .../LabelRecoveryResponseFormNormalizer.php | 144 +- ...overyResponseHighValueReportNormalizer.php | 144 +- ...RecoveryResponseLabelResultsNormalizer.php | 257 +- .../LabelRecoveryResponseNormalizer.php | 306 +- ...abelRecoveryResponseResponseNormalizer.php | 182 +- ...eryResponseTrackingCandidateNormalizer.php | 201 +- .../Normalizer/LabelResultsFormNormalizer.php | 144 +- .../LabelResultsLabelImageNormalizer.php | 237 +- ...ltsMailInnovationsLabelImageNormalizer.php | 237 +- .../LabelResultsReceiptNormalizer.php | 186 +- ...abelSpecificationInstructionNormalizer.php | 163 +- ...pecificationLabelImageFormatNormalizer.php | 163 +- ...lSpecificationLabelStockSizeNormalizer.php | 159 +- .../LandedCostRequestNormalizer.php | 209 +- .../LandedCostRequestShipmentNormalizer.php | 338 +- .../LandedCostResponseNormalizer.php | 144 +- .../LandedCostResponseShipmentNormalizer.php | 498 +- ...ostResponseShipmentPerfStatsNormalizer.php | 172 +- .../LocationAttributeOptionCodeNormalizer.php | 216 +- .../LocationAttributeOptionTypeNormalizer.php | 159 +- src/Api/Normalizer/LocationNormalizer.php | 176 +- ...rchCriteriaAccessPointSearchNormalizer.php | 278 +- ...riteriaFreightWillCallSearchNormalizer.php | 226 +- ...archCriteriaOpenTimeCriteriaNormalizer.php | 186 +- ...onSearchCriteriaSearchOptionNormalizer.php | 196 +- ...nSearchCriteriaServiceSearchNormalizer.php | 228 +- ...equestLocationSearchCriteriaNormalizer.php | 319 +- .../Normalizer/LocatorRequestNormalizer.php | 358 +- .../LocatorRequestOriginAddressNormalizer.php | 182 +- .../LocatorRequestRequestNormalizer.php | 178 +- ...LocatorRequestServiceGeoUnitNormalizer.php | 159 +- .../LocatorRequestSortCriteriaNormalizer.php | 148 +- .../LocatorRequestTranslateNormalizer.php | 148 +- ...atorRequestUnitOfMeasurementNormalizer.php | 144 +- .../LocatorResponseGeocodeNormalizer.php | 159 +- .../Normalizer/LocatorResponseNormalizer.php | 191 +- .../LocatorResponseResponseNormalizer.php | 201 +- ...LocatorResponseSearchResultsNormalizer.php | 290 +- ...nsLabelImageLabelImageFormatNormalizer.php | 144 +- .../ManifestBillToAccountNormalizer.php | 159 +- .../ManifestCustomsValueNormalizer.php | 144 +- .../ManifestPackageDimensionsNormalizer.php | 172 +- .../Normalizer/ManifestPackageNormalizer.php | 375 +- ...PackagePackageServiceOptionsNormalizer.php | 251 +- ...ManifestPackagePackageWeightNormalizer.php | 144 +- ...nifestPackageReferenceNumberNormalizer.php | 182 +- ...festPackageServiceOptionsCODNormalizer.php | 167 +- .../ManifestReferenceNumberNormalizer.php | 182 +- .../Normalizer/ManifestServiceNormalizer.php | 163 +- .../ManifestShipToAddressNormalizer.php | 299 +- .../Normalizer/ManifestShipToNormalizer.php | 333 +- ...nifestShipmentServiceOptionsNormalizer.php | 178 +- .../ManifestShipperAddressNormalizer.php | 293 +- .../Normalizer/ManifestShipperNormalizer.php | 293 +- .../ManifestUAPAddressNormalizer.php | 207 +- src/Api/Normalizer/MilestonesNormalizer.php | 281 +- ...tiatedChargesItemizedChargesNormalizer.php | 212 +- ...edRateChargesItemizedChargesNormalizer.php | 212 +- ...otiatedRateChargesTaxChargesNormalizer.php | 159 +- ...tiatedRateChargesTotalChargeNormalizer.php | 159 +- ...ChargesTotalChargesWithTaxesNormalizer.php | 159 +- .../NotificationEMailNormalizer.php | 240 +- .../NotificationLocaleNormalizer.php | 159 +- .../NotificationTextMessageNormalizer.php | 144 +- .../NotificationVoiceMessageNormalizer.php | 144 +- .../OperatingHoursStandardHoursNormalizer.php | 177 +- ...TransportationPickUpScheduleNormalizer.php | 162 +- .../OriginActivityLocationNormalizer.php | 144 +- ...riginAddressAddressKeyFormatNormalizer.php | 332 +- .../OriginAddressGeocodeNormalizer.php | 159 +- ...nAddressOriginSearchCriteriaNormalizer.php | 182 +- .../OriginBillToAccountNormalizer.php | 159 +- ...OriginPackageReferenceNumberNormalizer.php | 201 +- ...riginShipmentReferenceNumberNormalizer.php | 201 +- .../OverSeasLegDimensionsNormalizer.php | 206 +- .../Normalizer/OverSeasLegValueNormalizer.php | 167 +- ...DOCUMENTDeleteRequestWrapperNormalizer.php | 144 +- ...OCUMENTDeleteResponseWrapperNormalizer.php | 144 +- ...ERLESSDOCUMENTRequestWrapperNormalizer.php | 144 +- ...RLESSDOCUMENTResponseWrapperNormalizer.php | 144 +- ...DOCUMENTUploadRequestWrapperNormalizer.php | 144 +- ...OCUMENTUploadResponseWrapperNormalizer.php | 144 +- .../PICKUPCancelRequestWrapperNormalizer.php | 144 +- .../PICKUPCancelResponseWrapperNormalizer.php | 144 +- ...PICKUPCreationRequestWrapperNormalizer.php | 144 +- ...ICKUPCreationResponseWrapperNormalizer.php | 144 +- .../PICKUPPendingRequestWrapperNormalizer.php | 144 +- ...PICKUPPendingResponseWrapperNormalizer.php | 144 +- .../PICKUPPolDivRequestWrapperNormalizer.php | 144 +- .../PICKUPPolDivResponseWrapperNormalizer.php | 144 +- .../PICKUPRequestWrapperNormalizer.php | 144 +- .../PICKUPResponseWrapperNormalizer.php | 144 +- ...CKUPServCenterRequestWrapperNormalizer.php | 144 +- ...KUPServCenterResponseWrapperNormalizer.php | 144 +- .../POMPickupNotificationsNormalizer.php | 208 +- ...RENOTIFICATIONRequestWrapperNormalizer.php | 144 +- ...ENOTIFICATIONResponseWrapperNormalizer.php | 144 +- .../Normalizer/PackageActivityNormalizer.php | 167 +- .../Normalizer/PackageAddressNormalizer.php | 216 +- .../PackageChemicalRecordNormalizer.php | 518 +- .../Normalizer/PackageCommodityNormalizer.php | 163 +- .../Normalizer/PackageDimWeightNormalizer.php | 167 +- .../PackageDimensionalWeightNormalizer.php | 159 +- .../PackageDimensionsNormalizer.php | 185 +- ...kageHazMatPackageInformationNormalizer.php | 207 +- .../PackageLevelResultStatusNormalizer.php | 159 +- src/Api/Normalizer/PackageNormalizer.php | 760 +- ...PackagePackageServiceOptionsNormalizer.php | 416 +- .../PackagePackageWeightNormalizer.php | 159 +- .../Normalizer/PackagePackagingNormalizer.php | 163 +- .../PackagePackagingTypeNormalizer.php | 163 +- .../PackageReferenceNumberNormalizer.php | 182 +- .../PackageResultsAccessorialNormalizer.php | 163 +- ...kageResultsBaseServiceChargeNormalizer.php | 159 +- ...ResultsChemicalRecordResultsNormalizer.php | 222 +- .../PackageResultsFormNormalizer.php | 216 +- ...ackageResultsItemizedChargesNormalizer.php | 212 +- ...kageResultsNegotiatedChargesNormalizer.php | 168 +- .../PackageResultsRateModifierNormalizer.php | 172 +- ...ResultsServiceOptionsChargesNormalizer.php | 159 +- .../PackageResultsShippingLabelNormalizer.php | 259 +- ...ackageResultsShippingReceiptNormalizer.php | 159 +- .../PackageResultsSimpleRateNormalizer.php | 144 +- ...ServiceOptionsAccessPointCODNormalizer.php | 159 +- ...geServiceOptionsCODCODAmountNormalizer.php | 159 +- .../PackageServiceOptionsCODNormalizer.php | 159 +- ...eServiceOptionsDeclaredValueNormalizer.php | 178 +- ...eOptionsDeliveryConfirmationNormalizer.php | 163 +- .../PackageServiceOptionsDryIceNormalizer.php | 178 +- .../PackageServiceOptionsHazMatNormalizer.php | 743 +- ...ckageServiceOptionsInsuranceNormalizer.php | 186 +- ...geServiceOptionsInsuredValueNormalizer.php | 163 +- ...viceOptionsNotificationEMailNormalizer.php | 290 +- ...geServiceOptionsNotificationNormalizer.php | 159 +- ...eOptionsShipperDeclaredValueNormalizer.php | 159 +- .../PackageSimpleRateNormalizer.php | 163 +- .../PackageUPSPremierNormalizer.php | 172 +- ...ckageWeightUnitOfMeasurementNormalizer.php | 163 +- .../PackingListHandlingUnitNormalizer.php | 277 +- ...ingListInfoPackageAssociatedNormalizer.php | 178 +- .../PackingListReferenceNormalizer.php | 163 +- .../PackingListShipFromNormalizer.php | 251 +- .../PackingListShipToNormalizer.php | 251 +- .../PalletInformationDimensionsNormalizer.php | 185 +- src/Api/Normalizer/PayerAddressNormalizer.php | 249 +- src/Api/Normalizer/PayerPhoneNormalizer.php | 163 +- ...PaymentDetailsShipmentChargeNormalizer.php | 222 +- .../PaymentInformationNormalizer.php | 260 +- .../PaymentInformationPayerNormalizer.php | 266 +- ...rmationShipmentBillingOptionNormalizer.php | 163 +- ...entInformationShipmentChargeNormalizer.php | 222 +- .../PickUpPickUpDetailsNormalizer.php | 163 +- .../PickupAddressPhoneNormalizer.php | 163 +- .../PickupCancelRequestNormalizer.php | 178 +- .../PickupCancelRequestRequestNormalizer.php | 148 +- ...ickupCancelResponseGWNStatusNormalizer.php | 163 +- .../PickupCancelResponseNormalizer.php | 178 +- ...PickupCancelResponseResponseNormalizer.php | 182 +- ...reationRequestFreightOptionsNormalizer.php | 222 +- .../PickupCreationRequestNormalizer.php | 570 +- ...CreationRequestPickupAddressNormalizer.php | 372 +- ...reationRequestPickupDateInfoNormalizer.php | 172 +- ...upCreationRequestPickupPieceNormalizer.php | 185 +- ...PickupCreationRequestRequestNormalizer.php | 167 +- ...PickupCreationRequestShipperNormalizer.php | 167 +- ...upCreationRequestTotalWeightNormalizer.php | 159 +- ...pCreationRequestTrackingDataNormalizer.php | 148 +- ...ckingDataWithReferenceNumberNormalizer.php | 185 +- .../PickupCreationResponseNormalizer.php | 237 +- ...upCreationResponseRateResultNormalizer.php | 367 +- ...upCreationResponseRateStatusNormalizer.php | 163 +- ...ckupCreationResponseResponseNormalizer.php | 182 +- ...ponseWeekendServiceTerritoryNormalizer.php | 159 +- .../PickupFacilitiesAddressNormalizer.php | 215 +- ...ilitiesFacilityTimeDayOfWeekNormalizer.php | 260 +- ...PickupFacilitiesFacilityTimeNormalizer.php | 144 +- ...oliticalDivision1ListRequestNormalizer.php | 159 +- ...lDivision1ListRequestRequestNormalizer.php | 148 +- ...liticalDivision1ListResponseNormalizer.php | 185 +- ...ivision1ListResponseResponseNormalizer.php | 182 +- ...iesRequestDestinationAddressNormalizer.php | 201 +- ...rviceCenterFacilitiesRequestNormalizer.php | 251 +- ...cilitiesRequestOriginAddressNormalizer.php | 251 +- ...FacilitiesRequestPickupPieceNormalizer.php | 159 +- ...nterFacilitiesRequestRequestNormalizer.php | 148 +- ...viceCenterFacilitiesResponseNormalizer.php | 159 +- ...erFacilitiesResponseResponseNormalizer.php | 182 +- ...esponseServiceCenterLocationNormalizer.php | 189 +- ...tificationsEMailNotificationNormalizer.php | 187 +- .../PickupPendingStatusRequestNormalizer.php | 172 +- ...pPendingStatusRequestRequestNormalizer.php | 148 +- .../PickupPendingStatusResponseNormalizer.php | 177 +- ...gStatusResponsePendingStatusNormalizer.php | 296 +- ...endingStatusResponseResponseNormalizer.php | 182 +- .../PickupRateRequestNormalizer.php | 296 +- ...ckupRateRequestPickupAddressNormalizer.php | 221 +- ...kupRateRequestPickupDateInfoNormalizer.php | 172 +- .../PickupRateRequestRequestNormalizer.php | 186 +- ...kupRateRequestShipperAccountNormalizer.php | 159 +- .../PickupRateResponseNormalizer.php | 197 +- ...PickupRateResponseRateResultNormalizer.php | 327 +- .../PickupRateResponseResponseNormalizer.php | 204 +- ...ponseWeekendServiceTerritoryNormalizer.php | 159 +- .../Normalizer/PickupRequestPOMNormalizer.php | 172 +- .../PickupRequestRequesterNormalizer.php | 206 +- .../PostalCodeListPostalCodeNormalizer.php | 163 +- ...lertNotificationEMailMessageNormalizer.php | 163 +- .../PreAlertNotificationLocaleNormalizer.php | 159 +- ...AlertNotificationTextMessageNormalizer.php | 144 +- ...lertNotificationVoiceMessageNormalizer.php | 144 +- ...icationPackageChemicalRecordNormalizer.php | 587 +- .../PreNotificationRequestNormalizer.php | 159 +- ...reNotificationRequestRequestNormalizer.php | 148 +- ...eNotificationRequestShipmentNormalizer.php | 265 +- .../PreNotificationResponseNormalizer.php | 144 +- ...NotificationResponseResponseNormalizer.php | 204 +- ...eNotificationShipmentPackageNormalizer.php | 251 +- ...ationShipmentShipFromAddressNormalizer.php | 234 +- ...icationShipmentShipToAddressNormalizer.php | 234 +- ...ateNetworkListPrivateNetworkNormalizer.php | 159 +- .../Normalizer/ProducerAddressNormalizer.php | 249 +- .../Normalizer/ProducerPhoneNormalizer.php | 163 +- .../ProductEEIInformationNormalizer.php | 186 +- .../ProductExcludeFromFormNormalizer.php | 160 +- .../ProductNetCostDateRangeNormalizer.php | 159 +- .../ProductPackingListInfoNormalizer.php | 162 +- .../ProductProductWeightNormalizer.php | 159 +- .../Normalizer/ProductScheduleBNormalizer.php | 218 +- src/Api/Normalizer/ProductUnitNormalizer.php | 172 +- ...oductWeightUnitOfMeasurementNormalizer.php | 163 +- ...equestFormsHistoryDocumentIDNormalizer.php | 160 +- ...PushToImageRepositoryRequestNormalizer.php | 310 +- ...mageRepositoryRequestRequestNormalizer.php | 186 +- ...ushToImageRepositoryResponseNormalizer.php | 163 +- ...geRepositoryResponseResponseNormalizer.php | 204 +- .../QUANTUMVIEWRequestWrapperNormalizer.php | 144 +- .../QUANTUMVIEWResponseWrapperNormalizer.php | 144 +- ...ViewEventsSubscriptionEventsNormalizer.php | 242 +- .../QuantumViewRequestNormalizer.php | 204 +- .../QuantumViewRequestRequestNormalizer.php | 163 +- ...ewRequestSubscriptionRequestNormalizer.php | 206 +- .../QuantumViewResponseNormalizer.php | 178 +- ...iewResponseQuantumViewEventsNormalizer.php | 177 +- .../QuantumViewResponseResponseNormalizer.php | 217 +- .../RATERequestWrapperNormalizer.php | 144 +- .../RATEResponseWrapperNormalizer.php | 144 +- ...ernateDeliveryAddressAddressNormalizer.php | 284 +- .../RateBillThirdPartyAddressNormalizer.php | 244 +- src/Api/Normalizer/RateFactorNormalizer.php | 163 +- ...PackagePackageServiceOptionsNormalizer.php | 375 +- ...eServiceOptionsDeclaredValueNormalizer.php | 159 +- ...eOptionsDeliveryConfirmationNormalizer.php | 144 +- ...ePackageServiceOptionsDryIceNormalizer.php | 197 +- ...ePackageServiceOptionsHazMatNormalizer.php | 242 +- .../RatePackageUPSPremierNormalizer.php | 144 +- ...equestCustomerClassificationNormalizer.php | 163 +- src/Api/Normalizer/RateRequestNormalizer.php | 197 +- .../RateRequestPickupTypeNormalizer.php | 163 +- .../RateRequestRequestNormalizer.php | 182 +- .../RateRequestShipmentNormalizer.php | 657 +- src/Api/Normalizer/RateResponseNormalizer.php | 177 +- .../RateResponseRatedShipmentNormalizer.php | 624 +- .../RateResponseResponseNormalizer.php | 245 +- .../RateResultChargeDetailNormalizer.php | 216 +- .../RateResultDisclaimerNormalizer.php | 159 +- .../RateResultTaxChargesNormalizer.php | 159 +- ...mentAlternateDeliveryAddressNormalizer.php | 163 +- ...ateShipmentChargeBillShipperNormalizer.php | 144 +- ...ShipmentChargeBillThirdPartyNormalizer.php | 159 +- ...hipmentFRSPaymentInformationNormalizer.php | 182 +- .../RateShipmentPackageNormalizer.php | 375 +- ...eOptionsDeliveryConfirmationNormalizer.php | 144 +- ...iceOptionsRestrictedArticlesNormalizer.php | 320 +- .../RateShipmentShipFromNormalizer.php | 182 +- .../RateShipmentShipToNormalizer.php | 182 +- ...ipmentShipmentServiceOptionsNormalizer.php | 614 +- .../RateShipmentShipperNormalizer.php | 201 +- src/Api/Normalizer/RateTypeNormalizer.php | 159 +- .../RatedPackageAccessorialNormalizer.php | 163 +- ...atedPackageBaseServiceChargeNormalizer.php | 159 +- .../RatedPackageBillingWeightNormalizer.php | 159 +- ...llingWeightUnitOfMeasurementNormalizer.php | 159 +- .../RatedPackageItemizedChargesNormalizer.php | 212 +- ...atedPackageNegotiatedChargesNormalizer.php | 168 +- .../RatedPackageRateModifierNormalizer.php | 172 +- ...PackageServiceOptionsChargesNormalizer.php | 159 +- .../RatedPackageSimpleRateNormalizer.php | 144 +- .../RatedPackageTotalChargesNormalizer.php | 159 +- ...PackageTransportationChargesNormalizer.php | 159 +- ...tedShipmentBaseServiceChargeNormalizer.php | 159 +- .../RatedShipmentBillingWeightNormalizer.php | 159 +- .../RatedShipmentDisclaimerNormalizer.php | 159 +- ...RatedShipmentFRSShipmentDataNormalizer.php | 202 +- ...RatedShipmentItemizedChargesNormalizer.php | 212 +- ...hipmentNegotiatedRateChargesNormalizer.php | 245 +- .../RatedShipmentRatedPackageNormalizer.php | 414 +- ...edShipmentRatedShipmentAlertNormalizer.php | 159 +- .../RatedShipmentServiceNormalizer.php | 163 +- ...hipmentServiceOptionsChargesNormalizer.php | 159 +- .../RatedShipmentTaxChargesNormalizer.php | 159 +- .../RatedShipmentTimeInTransitNormalizer.php | 237 +- .../RatedShipmentTotalChargesNormalizer.php | 159 +- ...hipmentTotalChargesWithTaxesNormalizer.php | 159 +- ...hipmentTransportationChargesNormalizer.php | 159 +- .../ReceiptImageImageFormatNormalizer.php | 163 +- src/Api/Normalizer/ReceiptImageNormalizer.php | 159 +- ...eiptSpecificationImageFormatNormalizer.php | 163 +- .../Normalizer/ReferenceNumberNormalizer.php | 167 +- ...ferenceValuesReferenceNumberNormalizer.php | 144 +- .../Normalizer/ReferenceWeightNormalizer.php | 159 +- .../RefreshTokenSuccessResponseNormalizer.php | 375 +- .../Normalizer/RemitToAddressNormalizer.php | 249 +- src/Api/Normalizer/RemitToPhoneNormalizer.php | 163 +- .../RequestShipmentItemsNormalizer.php | 323 +- .../RequestTransactionReferenceNormalizer.php | 148 +- .../Normalizer/RequesterPhoneNormalizer.php | 163 +- .../ResponseAlertDetailNormalizer.php | 178 +- .../Normalizer/ResponseAlertNormalizer.php | 159 +- .../Normalizer/ResponseErrorNormalizer.php | 291 +- .../ResponseResponseStatusNormalizer.php | 159 +- .../ResponseShipmentItemsNormalizer.php | 296 +- ...ResponseTransactionReferenceNormalizer.php | 148 +- .../SHIPRequestWrapperNormalizer.php | 144 +- .../SHIPResponseWrapperNormalizer.php | 144 +- .../ScheduleBUnitOfMeasurementNormalizer.php | 163 +- .../SearchOptionOptionCodeNormalizer.php | 144 +- .../SearchOptionOptionTypeNormalizer.php | 144 +- .../SearchOptionRelationNormalizer.php | 144 +- ...sAvailableLocationAttributesNormalizer.php | 159 +- .../SearchResultsDropLocationNormalizer.php | 1014 +-- ...earchResultsGeocodeCandidateNormalizer.php | 178 +- ...curityV1OauthRefreshPostBodyNormalizer.php | 159 +- ...SecurityV1OauthTokenPostBodyNormalizer.php | 182 +- ...terLocationDropOffFacilitiesNormalizer.php | 328 +- ...nterLocationPickupFacilitiesNormalizer.php | 299 +- src/Api/Normalizer/ServiceNormalizer.php | 186 +- ...eOfferingListServiceOfferingNormalizer.php | 159 +- .../ServiceSearchServiceCodeNormalizer.php | 144 +- ...rviceSearchServiceOptionCodeNormalizer.php | 144 +- ...rviceSummaryEstimatedArrivalNormalizer.php | 296 +- .../ServiceSummaryServiceNormalizer.php | 148 +- src/Api/Normalizer/ServicesNormalizer.php | 506 +- .../Normalizer/ShipFromAddressNormalizer.php | 250 +- .../Normalizer/ShipFromPhoneNormalizer.php | 163 +- .../ShipFromTaxIDTypeNormalizer.php | 163 +- .../ShipFromVendorInfoNormalizer.php | 178 +- .../Normalizer/ShipToAddressNormalizer.php | 249 +- src/Api/Normalizer/ShipToPhoneNormalizer.php | 163 +- ...mentAlternateDeliveryAddressNormalizer.php | 191 +- .../ShipmentChargeBillReceiverNormalizer.php | 163 +- .../ShipmentChargeBillShipperNormalizer.php | 186 +- ...ShipmentChargeBillThirdPartyNormalizer.php | 201 +- ...mentChargesBaseServiceChargeNormalizer.php | 159 +- ...ipmentChargesItemizedChargesNormalizer.php | 212 +- ...ChargesServiceOptionsChargesNormalizer.php | 159 +- .../ShipmentChargesTaxChargesNormalizer.php | 159 +- .../ShipmentChargesTotalChargesNormalizer.php | 159 +- ...ChargesTotalChargesWithTaxesNormalizer.php | 159 +- ...ChargesTransportationChargesNormalizer.php | 159 +- .../ShipmentCommodityNormalizer.php | 348 +- .../ShipmentDGSignatoryInfoNormalizer.php | 257 +- ...pmentDeliveryTimeInformationNormalizer.php | 202 +- .../ShipmentDetailPackagingTypeNormalizer.php | 163 +- ...pmentDetailPalletInformationNormalizer.php | 148 +- .../ShipmentDetailWeightNormalizer.php | 159 +- .../ShipmentDocumentsNormalizer.php | 189 +- .../ShipmentExistingShipmentIDNormalizer.php | 163 +- ...hipmentFRSPaymentInformationNormalizer.php | 178 +- ...ntFreightShipmentInformationNormalizer.php | 167 +- .../ShipmentHandlingUnitOneNormalizer.php | 159 +- .../ShipmentHandlingUnitTwoNormalizer.php | 159 +- .../ShipmentHandlingUnitsNormalizer.php | 172 +- .../ShipmentInvoiceLineTotalNormalizer.php | 159 +- src/Api/Normalizer/ShipmentNormalizer.php | 287 +- .../Normalizer/ShipmentPackageNormalizer.php | 523 +- .../ShipmentPaymentDetailsNormalizer.php | 181 +- .../ShipmentPaymentInformationNormalizer.php | 181 +- .../ShipmentPickupRequestNormalizer.php | 237 +- ...omotionalDiscountInformationNormalizer.php | 159 +- .../ShipmentReferenceNormalizer.php | 201 +- .../ShipmentReferenceNumberNormalizer.php | 182 +- ...entRequestLabelSpecificationNormalizer.php | 238 +- .../Normalizer/ShipmentRequestNormalizer.php | 197 +- ...tRequestReceiptSpecificationNormalizer.php | 144 +- .../ShipmentRequestRequestNormalizer.php | 182 +- .../ShipmentRequestShipmentNormalizer.php | 986 +-- .../Normalizer/ShipmentResponseNormalizer.php | 159 +- .../ShipmentResponseResponseNormalizer.php | 213 +- ...pmentResponseShipmentResultsNormalizer.php | 838 +- ...esultsBillableShipmentWeightNormalizer.php | 159 +- ...ShipmentResultsBillingWeightNormalizer.php | 159 +- ...ShipmentResultsCODTurnInPageNormalizer.php | 144 +- ...mentResultsControlLogReceiptNormalizer.php | 159 +- .../ShipmentResultsDisclaimerNormalizer.php | 163 +- .../ShipmentResultsDocumentsNormalizer.php | 209 +- ...ipmentResultsFRSShipmentDataNormalizer.php | 202 +- .../ShipmentResultsFormImageNormalizer.php | 159 +- .../ShipmentResultsFormNormalizer.php | 216 +- ...entResultsFreightDensityRateNormalizer.php | 167 +- ...ipmentResultsHighValueReportNormalizer.php | 144 +- ...pmentResultsImageImageFormatNormalizer.php | 163 +- ...ResultsNegotiatedRateChargesNormalizer.php | 251 +- ...hipmentResultsPackageResultsNormalizer.php | 456 +- .../ShipmentResultsRateNormalizer.php | 159 +- .../ShipmentResultsServiceNormalizer.php | 163 +- ...ipmentResultsShipmentChargesNormalizer.php | 321 +- ...ShipmentResultsTimeInTransitNormalizer.php | 148 +- ...ntResultsTotalShipmentChargeNormalizer.php | 159 +- .../ShipmentReturnServiceNormalizer.php | 163 +- .../Normalizer/ShipmentServiceNormalizer.php | 163 +- ...ServiceOptionsAccessPointCODNormalizer.php | 159 +- ...ServiceOptionsAdjustedHeightNormalizer.php | 159 +- ...ntServiceOptionsCODCODAmountNormalizer.php | 159 +- .../ShipmentServiceOptionsCODNormalizer.php | 159 +- ...mentServiceOptionsCallTagARSNormalizer.php | 167 +- ...ServiceOptionsDangerousGoodsNormalizer.php | 178 +- ...tServiceOptionsDeclaredValueNormalizer.php | 159 +- ...eOptionsDeliveryConfirmationNormalizer.php | 163 +- ...erviceOptionsDeliveryOptionsNormalizer.php | 167 +- ...rviceOptionsEMailInformationNormalizer.php | 177 +- ...ceOptionsExcessDeclaredValueNormalizer.php | 159 +- ...ServiceOptionsHandlingChargeNormalizer.php | 167 +- ...tServiceOptionsImportControlNormalizer.php | 163 +- ...iceOptionsInternationalFormsNormalizer.php | 985 +-- ...tServiceOptionsLabelDeliveryNormalizer.php | 167 +- ...entServiceOptionsLabelMethodNormalizer.php | 163 +- ...ntServiceOptionsNotificationNormalizer.php | 216 +- ...entServiceOptionsOverSeasLegNormalizer.php | 159 +- ...tServiceOptionsPickupOptionsNormalizer.php | 167 +- ...eOptionsPreAlertNotificationNormalizer.php | 201 +- ...iceOptionsRestrictedArticlesNormalizer.php | 278 +- ...tServiceOptionsReturnServiceNormalizer.php | 163 +- ...OptionsSortingAndSegregatingNormalizer.php | 144 +- .../Normalizer/ShipmentShipFromNormalizer.php | 308 +- .../Normalizer/ShipmentShipToNormalizer.php | 308 +- ...ipmentShipmentIndicationTypeNormalizer.php | 163 +- ...hipmentShipmentRatingOptionsNormalizer.php | 228 +- ...ipmentShipmentServiceOptionsNormalizer.php | 717 +- .../ShipmentShipmentTotalWeightNormalizer.php | 159 +- .../Normalizer/ShipmentShipperNormalizer.php | 302 +- ...TotalWeightUnitOfMeasurementNormalizer.php | 159 +- .../Normalizer/ShipperAccountNormalizer.php | 159 +- .../Normalizer/ShipperAddressNormalizer.php | 228 +- .../ShipperChargeCardNormalizer.php | 221 +- src/Api/Normalizer/ShipperPhoneNormalizer.php | 163 +- ...vailabilityUnavailableReasonNormalizer.php | 159 +- .../ShippingLabelImageFormatNormalizer.php | 163 +- .../ShippingReceiptImageFormatNormalizer.php | 163 +- src/Api/Normalizer/SignatureNormalizer.php | 148 +- .../Normalizer/SoldToAddressNormalizer.php | 249 +- src/Api/Normalizer/SoldToPhoneNormalizer.php | 163 +- .../StandardHoursDayOfWeekNormalizer.php | 326 +- src/Api/Normalizer/StatusNormalizer.php | 254 +- src/Api/Normalizer/SubMilestoneNormalizer.php | 148 +- .../SubscriptionEventsDateRangeNormalizer.php | 163 +- ...iptionEventsSubscriptionFileNormalizer.php | 362 +- ...tionEventsSubscriptionStatusNormalizer.php | 163 +- .../SubscriptionFileDeliveryNormalizer.php | 414 +- .../SubscriptionFileExceptionNormalizer.php | 504 +- .../SubscriptionFileGenericNormalizer.php | 384 +- .../SubscriptionFileManifestNormalizer.php | 1199 +-- .../SubscriptionFileOriginNormalizer.php | 351 +- .../SubscriptionFileStatusTypeNormalizer.php | 159 +- ...criptionRequestDateTimeRangeNormalizer.php | 167 +- .../SummaryResultStatusNormalizer.php | 159 +- .../TimeInTransitRequestNormalizer.php | 653 +- .../TimeInTransitResponseNormalizer.php | 249 +- .../TimeInTransitServiceSummaryNormalizer.php | 287 +- .../Normalizer/TrackApiResponseNormalizer.php | 148 +- .../Normalizer/TrackResponseNormalizer.php | 168 +- ...rackSubsServiceErrorResponseNormalizer.php | 185 +- .../TrackSubsServiceRequestNormalizer.php | 244 +- .../TrackSubsServiceResponseNormalizer.php | 209 +- ...kingCandidatePickupDateRangeNormalizer.php | 159 +- ...rtationChargesDiscountAmountNormalizer.php | 159 +- ...sportationChargesGrossChargeNormalizer.php | 159 +- ...ansportationChargesNetChargeNormalizer.php | 159 +- ...ortationPickUpSchedulePickUpNormalizer.php | 159 +- .../UAPAddressAddressNormalizer.php | 278 +- src/Api/Normalizer/UPSFiledPOANormalizer.php | 163 +- ...SPremierHandlingInstructionsNormalizer.php | 144 +- ...ormLanguageForUPSPremiumCareNormalizer.php | 160 +- .../UltimateConsigneeAddressNormalizer.php | 249 +- ...nsigneeUltimateConsigneeTypeNormalizer.php | 163 +- .../UnitUnitOfMeasurementNormalizer.php | 163 +- ...ssAddressExtendedInformationNormalizer.php | 186 +- .../Normalizer/UploadRequestNormalizer.php | 192 +- .../UploadRequestRequestNormalizer.php | 186 +- ...UploadRequestUserCreatedFormNormalizer.php | 185 +- ...sponseFormsHistoryDocumentIDNormalizer.php | 160 +- .../Normalizer/UploadResponseNormalizer.php | 163 +- .../UploadResponseResponseNormalizer.php | 204 +- .../VOIDSHIPMENTRequestWrapperNormalizer.php | 144 +- .../VOIDSHIPMENTResponseWrapperNormalizer.php | 144 +- .../Normalizer/ValidationListNormalizer.php | 257 +- src/Api/Normalizer/ValueCWTNormalizer.php | 159 +- src/Api/Normalizer/ValueCubeNormalizer.php | 159 +- ...dRequestTransactionReferenceNormalizer.php | 148 +- .../VoidResponseResponseStatusNormalizer.php | 159 +- ...ResponseTransactionReferenceNormalizer.php | 148 +- .../VoidShipmentRequestNormalizer.php | 159 +- .../VoidShipmentRequestRequestNormalizer.php | 167 +- ...dShipmentRequestVoidShipmentNormalizer.php | 202 +- .../VoidShipmentResponseNormalizer.php | 200 +- ...ntResponsePackageLevelResultNormalizer.php | 159 +- ...VoidShipmentResponseResponseNormalizer.php | 182 +- ...hipmentResponseSummaryResultNormalizer.php | 144 +- src/Api/Normalizer/WarningNormalizer.php | 167 +- src/Api/Normalizer/WeightNormalizer.php | 167 +- .../WeightUnitOfMeasurementNormalizer.php | 163 +- .../XAVRequestAddressKeyFormatNormalizer.php | 365 +- src/Api/Normalizer/XAVRequestNormalizer.php | 215 +- .../XAVRequestRequestNormalizer.php | 182 +- .../XAVRequestWrapperNormalizer.php | 144 +- ...esponseAddressClassificationNormalizer.php | 159 +- .../XAVResponseCandidateNormalizer.php | 190 +- src/Api/Normalizer/XAVResponseNormalizer.php | 316 +- .../XAVResponseResponseNormalizer.php | 204 +- .../XAVResponseWrapperNormalizer.php | 144 +- src/Api/Runtime/Client/BaseEndpoint.php | 27 +- src/Api/Runtime/Client/Client.php | 22 +- .../Normalizer/ReferenceNormalizer.php | 49 +- .../Normalizer/ValidationException.php | 5 +- 1260 files changed, 62799 insertions(+), 137808 deletions(-) diff --git a/src/Api/Client.php b/src/Api/Client.php index 5c559e00..4d3ae61e 100644 --- a/src/Api/Client.php +++ b/src/Api/Client.php @@ -6,7 +6,6 @@ class Client extends \ShipStream\Ups\Api\Runtime\Client\Client { /** * The Address Validation Street Level API can be used to check addresses against the United States Postal Service database of valid addresses in the U.S. and Puerto Rico. - * * @param int $requestoption Identifies the optional processing to be performed. If not present or invalid value then an error will be sent back. Valid values: @@ -15,17 +14,16 @@ class Client extends \ShipStream\Ups\Api\Runtime\Client\Client - 3 - Address Validation and Address Classification. For a list of valid values, refer to Address Validation API Supported Countries or Territories in the Appendix. - * @param string $version Identifies the version of the API. Valid values: - v2 - - * @param \ShipStream\Ups\Api\Model\XAVRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\XAVRequestWrapper $requestBody * @param array $queryParameters { * @var string $regionalrequestindicator Valid values: True or False. If True, either the region element or any combination of Political Division 1, Political Division 2, PostcodePrimaryLow and the PostcodeExtendedLow fields will be recognized for validation in addition to the urbanization element. If False or no indicator, street level address validation is provided * @var int $maximumcandidatelistsize Valid values: 0 – 50 The maximum number of Candidates to return for this request. If not provided, the default size of 15 is returned. * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\AddressValidationBadRequestException * @throws \ShipStream\Ups\Api\Exception\AddressValidationUnauthorizedException @@ -33,7 +31,7 @@ class Client extends \ShipStream\Ups\Api\Runtime\Client\Client * @throws \ShipStream\Ups\Api\Exception\AddressValidationTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\XAVResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\XAVResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function addressValidation(int $requestoption, string $version, \ShipStream\Ups\Api\Model\XAVRequestWrapper $requestBody, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -41,7 +39,6 @@ public function addressValidation(int $requestoption, string $version, \ShipStre } /** * The Address Validation Street Level API can be used to check addresses against the United States Postal Service database of valid addresses in the U.S. and Puerto Rico. - * * @param int $requestoption Identifies the optional processing to be performed. If not present or invalid value then an error will be sent back. Valid values: @@ -51,17 +48,16 @@ public function addressValidation(int $requestoption, string $version, \ShipStre - 3 - Address Validation and Address Classification. For a list of valid values, refer to Address Validation API Supported Countries or Territories in the Appendix. - * @param string $deprecatedVersion Identifies the version of the API. Valid values: - v1 - - * @param \ShipStream\Ups\Api\Model\XAVRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\XAVRequestWrapper $requestBody * @param array $queryParameters { * @var string $regionalrequestindicator Valid values: True or False. If True, either the region element or any combination of Political Division 1, Political Division 2, PostcodePrimaryLow and the PostcodeExtendedLow fields will be recognized for validation in addition to the urbanization element. If False or no indicator, street level address validation is provided * @var int $maximumcandidatelistsize Valid values: 0 – 50 The maximum number of Candidates to return for this request. If not provided, the default size of 15 is returned. * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\DeprecatedAddressValidationBadRequestException * @throws \ShipStream\Ups\Api\Exception\DeprecatedAddressValidationUnauthorizedException @@ -69,7 +65,7 @@ public function addressValidation(int $requestoption, string $version, \ShipStre * @throws \ShipStream\Ups\Api\Exception\DeprecatedAddressValidationTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\XAVResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\XAVResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function deprecatedAddressValidation(int $requestoption, string $deprecatedVersion, \ShipStream\Ups\Api\Model\XAVRequestWrapper $requestBody, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -77,15 +73,15 @@ public function deprecatedAddressValidation(int $requestoption, string $deprecat } /** * The Chemical Reference Data endpoint of the Dangerous Goods API allows shippers look up hazardous material reference information by ID number and shipping name of the specified regulated good. - * * @param string $version Version of the API. Valid values: v1 v1801. Length 5 - * @param \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\ChemicalReferenceDataBadRequestException * @throws \ShipStream\Ups\Api\Exception\ChemicalReferenceDataUnauthorizedException @@ -93,7 +89,7 @@ public function deprecatedAddressValidation(int $requestoption, string $deprecat * @throws \ShipStream\Ups\Api\Exception\ChemicalReferenceDataTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function chemicalReferenceData(string $version, \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -101,9 +97,8 @@ public function chemicalReferenceData(string $version, \ShipStream\Ups\Api\Model } /** * Enables shippers perform pre-checks before shipping dangerous goods using the chemical record identifier and the commodity's regulated level code. - * * @param string $version API version - * @param \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -115,7 +110,7 @@ public function chemicalReferenceData(string $version, \ShipStream\Ups\Api\Model * @throws \ShipStream\Ups\Api\Exception\AcceptanceAuditPreCheckTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function acceptanceAuditPreCheck(string $version, \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -123,9 +118,8 @@ public function acceptanceAuditPreCheck(string $version, \ShipStream\Ups\Api\Mod } /** * The Landed Cost Quote API allows you to estimate the all-inclusive cost of international shipments - including applicable duties, VAT, taxes, brokerage fees, and other fees. Required parameters include the currency and shipment details, such as the commodity ID, price, quantity, and country code of origin. - * * @param string $version Version of the API. - * @param \ShipStream\Ups\Api\Model\LandedCostRequest $requestBody + * @param \ShipStream\Ups\Api\Model\LandedCostRequest $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length: 32 * @var string $transactionSrc An identifier of the client/source application that is making the request. Length: 512 @@ -138,7 +132,7 @@ public function acceptanceAuditPreCheck(string $version, \ShipStream\Ups\Api\Mod * @throws \ShipStream\Ups\Api\Exception\LandedCostTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\LandedCostResponse|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\LandedCostResponse : \Psr\Http\Message\ResponseInterface) */ public function landedCost(string $version, \ShipStream\Ups\Api\Model\LandedCostRequest $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -146,12 +140,10 @@ public function landedCost(string $version, \ShipStream\Ups\Api\Model\LandedCost } /** * The Locator API allows you to find UPS locations - such as drop-off points, retail locations, and UPS access points (third-party retail locations that offer UPS package drop-off, or delivery services). The API provides capabilities to search by location, services offered, program types, and related criteria. You can also retrieve hours of operation, location details, and additional UPS services offered at specific locations. - * * @param string $version Version of API Valid values: - v2 - * @param string $reqOption Indicates the type of request. Valid values: 1-Locations (Drop Locations and Will call locations) @@ -162,8 +154,8 @@ public function landedCost(string $version, \ShipStream\Ups\Api\Model\LandedCost 40-All available Retail Locations and Additional Services 48-All available Retail Locations and Program Types 56-All available Retail Locations, Additional Services and Program Types - 64-Search for UPS Access Point Locations. - * @param \ShipStream\Ups\Api\Model\LOCATORRequestWrapper $requestBody + 64-Search for UPS Access Point Locations. + * @param \ShipStream\Ups\Api\Model\LOCATORRequestWrapper $requestBody * @param array $queryParameters { * @var string $Locale Locale of request * } @@ -171,6 +163,7 @@ public function landedCost(string $version, \ShipStream\Ups\Api\Model\LandedCost * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\LocatorBadRequestException * @throws \ShipStream\Ups\Api\Exception\LocatorUnauthorizedException @@ -178,7 +171,7 @@ public function landedCost(string $version, \ShipStream\Ups\Api\Model\LandedCost * @throws \ShipStream\Ups\Api\Exception\LocatorTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\LOCATORResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\LOCATORResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function locator(string $version, string $reqOption, \ShipStream\Ups\Api\Model\LOCATORRequestWrapper $requestBody, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -186,12 +179,10 @@ public function locator(string $version, string $reqOption, \ShipStream\Ups\Api\ } /** * The Locator API allows you to find UPS locations - such as drop-off points, retail locations, and UPS access points (third-party retail locations that offer UPS package drop-off, or delivery services). The API provides capabilities to search by location, services offered, program types, and related criteria. You can also retrieve hours of operation, location details, and additional UPS services offered at specific locations. - * * @param string $deprecatedVersion Version of API Valid values: - v1 - * @param string $reqOption Indicates the type of request. Valid values: 1-Locations (Drop Locations and Will call locations) @@ -202,8 +193,8 @@ public function locator(string $version, string $reqOption, \ShipStream\Ups\Api\ 40-All available Retail Locations and Additional Services 48-All available Retail Locations and Program Types 56-All available Retail Locations, Additional Services and Program Types - 64-Search for UPS Access Point Locations. - * @param \ShipStream\Ups\Api\Model\LOCATORRequestWrapper $requestBody + 64-Search for UPS Access Point Locations. + * @param \ShipStream\Ups\Api\Model\LOCATORRequestWrapper $requestBody * @param array $queryParameters { * @var string $Locale Locale of request * } @@ -211,6 +202,7 @@ public function locator(string $version, string $reqOption, \ShipStream\Ups\Api\ * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\DeprecatedLocatorBadRequestException * @throws \ShipStream\Ups\Api\Exception\DeprecatedLocatorUnauthorizedException @@ -218,7 +210,7 @@ public function locator(string $version, string $reqOption, \ShipStream\Ups\Api\ * @throws \ShipStream\Ups\Api\Exception\DeprecatedLocatorTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\LOCATORResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\LOCATORResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function deprecatedLocator(string $deprecatedVersion, string $reqOption, \ShipStream\Ups\Api\Model\LOCATORRequestWrapper $requestBody, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -226,7 +218,6 @@ public function deprecatedLocator(string $deprecatedVersion, string $reqOption, } /** * The Authorize Client endpoint initiates the OAuth Authorization Code flow by redirecting the user to UPS for logging-in and authorize the client application. To begin the authorization flow, the application constructs a URL using the application's client Id, the redirect URI, the scope of permissions requested, and a random string used for subsequent verification. A successful response redirects back to the client with an authorization code that can be exchanged for an access token. - * * @param array $queryParameters { * @var string $client_id The public identifier for your application, obtained when you, the developer first registered the application. * @var string $redirect_uri URL that tells the authorization server where to send the user back to after they approve the request. @@ -241,7 +232,7 @@ public function deprecatedLocator(string $deprecatedVersion, string $reqOption, * @throws \ShipStream\Ups\Api\Exception\AuthorizeClientTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return null|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? null : \Psr\Http\Message\ResponseInterface) */ public function authorizeClient(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -249,8 +240,7 @@ public function authorizeClient(array $queryParameters = [], string $fetch = sel } /** * The Generate Token endpoint exchanges the authorization code received from the client application for an access token and a refresh token. The client uses the access token to make API requests on behalf of the user by including it in the authorization header. The access token will expire after a certain period and can be refreshed by using the /refresh endpoint. - * - * @param null|\ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody $requestBody + * @param null|\ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody $requestBody * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\GenerateTokenBadRequestException * @throws \ShipStream\Ups\Api\Exception\GenerateTokenUnauthorizedException @@ -258,7 +248,7 @@ public function authorizeClient(array $queryParameters = [], string $fetch = sel * @throws \ShipStream\Ups\Api\Exception\GenerateTokenTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse : \Psr\Http\Message\ResponseInterface) */ public function generateToken(?\ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody $requestBody = null, string $fetch = self::FETCH_OBJECT) { @@ -266,8 +256,7 @@ public function generateToken(?\ShipStream\Ups\Api\Model\SecurityV1OauthTokenPos } /** * The /refresh endpoint is used to refresh an expired access token in order to continue accessing a UPS API on behalf of a user. The endpoint generates a new access/refresh token pair by exchanging a valid refresh token. A successful response returns new access and refresh tokens for ongoing API access without re-prompting the user. - * - * @param null|\ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody $requestBody + * @param null|\ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody $requestBody * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\RefreshTokenBadRequestException * @throws \ShipStream\Ups\Api\Exception\RefreshTokenUnauthorizedException @@ -275,26 +264,25 @@ public function generateToken(?\ShipStream\Ups\Api\Model\SecurityV1OauthTokenPos * @throws \ShipStream\Ups\Api\Exception\RefreshTokenTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse : \Psr\Http\Message\ResponseInterface) */ public function refreshToken(?\ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody $requestBody = null, string $fetch = self::FETCH_OBJECT) { return $this->executeEndpoint(new \ShipStream\Ups\Api\Endpoint\RefreshToken($requestBody), $fetch); } /** - * The Paperless Document API web service allows the users to upload,delete and push to image repository their own customized trade documents for customs clearance to Forms History. - * + * The Paperless Document API web service allows the users to upload,delete and push to image repository their own customized trade documents for customs clearance to Forms History. * @param string $version Version of API Valid values: - v2 - - * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * @var string $ShipperNumber Shipper Number * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\UploadBadRequestException * @throws \ShipStream\Ups\Api\Exception\UploadUnauthorizedException @@ -302,26 +290,25 @@ public function refreshToken(?\ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPo * @throws \ShipStream\Ups\Api\Exception\UploadTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function upload(string $version, \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { return $this->executeEndpoint(new \ShipStream\Ups\Api\Endpoint\Upload($version, $requestBody, $headerParameters), $fetch); } /** - * The Paperless Document API web service allows the users to upload their own customized trade documents for customs clearance to Forms History. - * + * The Paperless Document API web service allows the users to upload their own customized trade documents for customs clearance to Forms History. * @param string $version Version of API Valid values: - v2 - - * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * @var string $ShipperNumber Shipper Number * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\PushToImageRepositoryBadRequestException * @throws \ShipStream\Ups\Api\Exception\PushToImageRepositoryUnauthorizedException @@ -329,7 +316,7 @@ public function upload(string $version, \ShipStream\Ups\Api\Model\PAPERLESSDOCUM * @throws \ShipStream\Ups\Api\Exception\PushToImageRepositoryTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function pushToImageRepository(string $version, \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -337,18 +324,17 @@ public function pushToImageRepository(string $version, \ShipStream\Ups\Api\Model } /** * The Paperless Document API web service allows the users to upload their own customized trade documents for customs clearance to Forms History. - * * @param string $version Version of API Valid values: - v2 - * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * @var string $ShipperNumber Your Shipper Number * @var string $DocumentId DocumentId representing uploaded document to Forms History. Only one DocumentID will be accepted for delete request. * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\DeleteBadRequestException * @throws \ShipStream\Ups\Api\Exception\DeleteUnauthorizedException @@ -356,26 +342,25 @@ public function pushToImageRepository(string $version, \ShipStream\Ups\Api\Model * @throws \ShipStream\Ups\Api\Exception\DeleteTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function delete(string $version, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { return $this->executeEndpoint(new \ShipStream\Ups\Api\Endpoint\Delete($version, $headerParameters), $fetch); } /** - * The Paperless Document API web service allows the users to upload,delete and push to image repository their own customized trade documents for customs clearance to Forms History. - * + * The Paperless Document API web service allows the users to upload,delete and push to image repository their own customized trade documents for customs clearance to Forms History. * @param string $deprecatedVersion Version of API Valid values: - v1 - - * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * @var string $ShipperNumber Shipper Number * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\DeprecatedUploadBadRequestException * @throws \ShipStream\Ups\Api\Exception\DeprecatedUploadUnauthorizedException @@ -383,26 +368,25 @@ public function delete(string $version, array $headerParameters = [], string $fe * @throws \ShipStream\Ups\Api\Exception\DeprecatedUploadTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function deprecatedUpload(string $deprecatedVersion, \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { return $this->executeEndpoint(new \ShipStream\Ups\Api\Endpoint\DeprecatedUpload($deprecatedVersion, $requestBody, $headerParameters), $fetch); } /** - * The Paperless Document API web service allows the users to upload their own customized trade documents for customs clearance to Forms History. - * + * The Paperless Document API web service allows the users to upload their own customized trade documents for customs clearance to Forms History. * @param string $deprecatedVersion Version of API Valid values: - v1 - - * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * @var string $ShipperNumber Shipper Number * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\DeprecatedPushToImageRepositoryBadRequestException * @throws \ShipStream\Ups\Api\Exception\DeprecatedPushToImageRepositoryUnauthorizedException @@ -410,7 +394,7 @@ public function deprecatedUpload(string $deprecatedVersion, \ShipStream\Ups\Api\ * @throws \ShipStream\Ups\Api\Exception\DeprecatedPushToImageRepositoryTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function deprecatedPushToImageRepository(string $deprecatedVersion, \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -418,18 +402,17 @@ public function deprecatedPushToImageRepository(string $deprecatedVersion, \Ship } /** * The Paperless Document API web service allows the users to upload their own customized trade documents for customs clearance to Forms History. - * * @param string $deprecatedVersion Version of API Valid values: - v1 - * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * @var string $ShipperNumber Your Shipper Number * @var string $DocumentId DocumentId representing uploaded document to Forms History. Only one DocumentID will be accepted for delete request. * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\DeprecatedDeleteBadRequestException * @throws \ShipStream\Ups\Api\Exception\DeprecatedDeleteUnauthorizedException @@ -437,7 +420,7 @@ public function deprecatedPushToImageRepository(string $deprecatedVersion, \Ship * @throws \ShipStream\Ups\Api\Exception\DeprecatedDeleteTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function deprecatedDelete(string $deprecatedVersion, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -445,12 +428,10 @@ public function deprecatedDelete(string $deprecatedVersion, array $headerParamet } /** * Using the GET operation of the pickuptype endpoint within the Pickup API, users can retrieve the status of shipments sent via UPS pickup service. The endpoint uses the account number as a required parameter and returns a status of received/dispatched/completed/incomplete/updated ETA, or cancelled. - * * @param string $version Version of API Valid values: - v1 - * @param string $pickuptype Type of pickup. Valid values: oncall smart @@ -458,9 +439,10 @@ public function deprecatedDelete(string $deprecatedVersion, array $headerParamet * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 - * @var string $AccountNumber The specific account number that belongs to the + * @var string $AccountNumber The specific account number that belongs to the shipper.Length 6 or 10 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\PickupPendingStatusBadRequestException * @throws \ShipStream\Ups\Api\Exception\PickupPendingStatusUnauthorizedException @@ -468,7 +450,7 @@ public function deprecatedDelete(string $deprecatedVersion, array $headerParamet * @throws \ShipStream\Ups\Api\Exception\PickupPendingStatusTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function pickupPendingStatus(string $version, string $pickuptype, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -476,21 +458,20 @@ public function pickupPendingStatus(string $version, string $pickuptype, array $ } /** * Using the POST operation of the pickuptype endpoint within the Pickup API, users can request rates for UPS on-demand package pickup. The endpoint allows users to specify pickup details like address, date/time, and other options, and returns pricing information for booking that pickup. - * * @param string $version Version of the API. Valid values: - v1 - * @param string $pickuptype Type of pickup. Valid values: oncall smart both. Length 6 - * @param \ShipStream\Ups\Api\Model\PICKUPRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PICKUPRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\PickupRateBadRequestException * @throws \ShipStream\Ups\Api\Exception\PickupRateUnauthorizedException @@ -498,7 +479,7 @@ public function pickupPendingStatus(string $version, string $pickuptype, array $ * @throws \ShipStream\Ups\Api\Exception\PickupRateTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PICKUPResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PICKUPResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function pickupRate(string $version, string $pickuptype, \ShipStream\Ups\Api\Model\PICKUPRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -506,20 +487,19 @@ public function pickupRate(string $version, string $pickuptype, \ShipStream\Ups\ } /** * Using the CancelBy endpoint of the Pickup API, users can request cancellation of a UPS on-demand package pickup. When the PRN (pickup request number), transaction ID, and the transaction source are supplied as required parameters, the endpoint returns confirmation that the pickup has been cancelled. - * * @param string $cancelBy Valid Values: 01 = AccountNumber, 02 = PRN * @param string $version Version of API. Valid values: - v2403 - * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 - * @var string $Prn The pickup equest number (PRN) generated by + * @var string $Prn The pickup equest number (PRN) generated by UPS pickup system. Required if CancelBy = prn.Length 26 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\PickupCancelBadRequestException * @throws \ShipStream\Ups\Api\Exception\PickupCancelUnauthorizedException @@ -527,7 +507,7 @@ public function pickupRate(string $version, string $pickuptype, \ShipStream\Ups\ * @throws \ShipStream\Ups\Api\Exception\PickupCancelTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function pickupCancel(string $cancelBy, string $version, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -535,17 +515,16 @@ public function pickupCancel(string $cancelBy, string $version, array $headerPar } /** * Using the Pickup API, applications can schedule pickups, manage previously scheduled pickups, or cancel previously scheduled pickups. - * * @param string $version Version of the API. Valid values: - v2403 - - * @param \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\PickupCreationBadRequestException * @throws \ShipStream\Ups\Api\Exception\PickupCreationUnauthorizedException @@ -553,7 +532,7 @@ public function pickupCancel(string $cancelBy, string $version, array $headerPar * @throws \ShipStream\Ups\Api\Exception\PickupCreationTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function pickupCreation(string $version, \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -561,18 +540,17 @@ public function pickupCreation(string $version, \ShipStream\Ups\Api\Model\PICKUP } /** * The countrycode endpoint of the Pickup API helps retrieve a list of political divisions (states) in a specified country or territory. - * * @param string $version Version of API. Valid values: - v1 - * @param string $countrycode Country or terrirtory for which the list will represent.Length 2 * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\PickupGetPoliticalDivision1ListBadRequestException * @throws \ShipStream\Ups\Api\Exception\PickupGetPoliticalDivision1ListUnauthorizedException @@ -580,7 +558,7 @@ public function pickupCreation(string $version, \ShipStream\Ups\Api\Model\PICKUP * @throws \ShipStream\Ups\Api\Exception\PickupGetPoliticalDivision1ListTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function pickupGetPoliticalDivision1List(string $version, string $countrycode, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -588,17 +566,16 @@ public function pickupGetPoliticalDivision1List(string $version, string $country } /** * The servicecenterlocations endpoint of the Pickup API helps retrieve service center information in a specified area - including location address, phone number, SLIC (Standard Location Identification Code), and hours of operation for pick-up and drop-off requests - * * @param string $version Version of API. Valid values: - v1 - - * @param \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\PickupGetServiceCenterFacilitiesBadRequestException * @throws \ShipStream\Ups\Api\Exception\PickupGetServiceCenterFacilitiesUnauthorizedException @@ -606,7 +583,7 @@ public function pickupGetPoliticalDivision1List(string $version, string $country * @throws \ShipStream\Ups\Api\Exception\PickupGetServiceCenterFacilitiesTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function pickupGetServiceCenterFacilities(string $version, \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -614,20 +591,19 @@ public function pickupGetServiceCenterFacilities(string $version, \ShipStream\Up } /** * Using the CancelBy endpoint of the Pickup API, users can request cancellation of a UPS on-demand package pickup. When the PRN (pickup request number), transaction ID, and the transaction source are supplied as required parameters, the endpoint returns confirmation that the pickup has been cancelled. - * * @param string $cancelBy Valid Values: 01 = AccountNumber, 02 = PRN * @param string $deprecatedVersion Version of API. Valid values: - v1 - * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 - * @var string $Prn The pickup equest number (PRN) generated by + * @var string $Prn The pickup equest number (PRN) generated by UPS pickup system. Required if CancelBy = prn.Length 26 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\DeprecatedPickupCancelBadRequestException * @throws \ShipStream\Ups\Api\Exception\DeprecatedPickupCancelUnauthorizedException @@ -635,7 +611,7 @@ public function pickupGetServiceCenterFacilities(string $version, \ShipStream\Up * @throws \ShipStream\Ups\Api\Exception\DeprecatedPickupCancelTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function deprecatedPickupCancel(string $cancelBy, string $deprecatedVersion, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -643,19 +619,18 @@ public function deprecatedPickupCancel(string $cancelBy, string $deprecatedVersi } /** * Using the Pickup API, applications can schedule pickups, manage previously scheduled pickups, or cancel previously scheduled pickups. - * * @param string $deprecatedVersion Version of the API. Valid values: - v1 - v1607 - v1707 - - * @param \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\DeprecatedPickupCreationBadRequestException * @throws \ShipStream\Ups\Api\Exception\DeprecatedPickupCreationUnauthorizedException @@ -663,7 +638,7 @@ public function deprecatedPickupCancel(string $cancelBy, string $deprecatedVersi * @throws \ShipStream\Ups\Api\Exception\DeprecatedPickupCreationTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function deprecatedPickupCreation(string $deprecatedVersion, \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -671,17 +646,16 @@ public function deprecatedPickupCreation(string $deprecatedVersion, \ShipStream\ } /** * The Pre-Notification API allows customer applications to inform UPS operations of Dangerous Goods shipments as they are processed and will enter the UPS transportation network prior to an upload of manifest information at the end of the day. - * * @param string $version Version of API. Valid values: - v2 - - * @param \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\PreNotificationBadRequestException * @throws \ShipStream\Ups\Api\Exception\PreNotificationUnauthorizedException @@ -689,7 +663,7 @@ public function deprecatedPickupCreation(string $deprecatedVersion, \ShipStream\ * @throws \ShipStream\Ups\Api\Exception\PreNotificationTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function preNotification(string $version, \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -697,17 +671,16 @@ public function preNotification(string $version, \ShipStream\Ups\Api\Model\PRENO } /** * The Pre-Notification API allows customer applications to inform UPS operations of Dangerous Goods shipments as they are processed and will enter the UPS transportation network prior to an upload of manifest information at the end of the day. - * * @param string $deprecatedVersion Version of API. Valid values: - v1 - - * @param \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\DeprecatedPreNotificationBadRequestException * @throws \ShipStream\Ups\Api\Exception\DeprecatedPreNotificationUnauthorizedException @@ -715,7 +688,7 @@ public function preNotification(string $version, \ShipStream\Ups\Api\Model\PRENO * @throws \ShipStream\Ups\Api\Exception\DeprecatedPreNotificationTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function deprecatedPreNotification(string $deprecatedVersion, \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -723,13 +696,12 @@ public function deprecatedPreNotification(string $deprecatedVersion, \ShipStream } /** * Get Quantum View Response - * * @param string $version Version of API. Valid values: - v2 + * @param \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper $requestBody - * @param \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper $requestBody * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\QuantumViewBadRequestException * @throws \ShipStream\Ups\Api\Exception\QuantumViewUnauthorizedException @@ -737,7 +709,7 @@ public function deprecatedPreNotification(string $deprecatedVersion, \ShipStream * @throws \ShipStream\Ups\Api\Exception\QuantumViewTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function quantumView(string $version, \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper $requestBody, string $fetch = self::FETCH_OBJECT) { @@ -745,13 +717,12 @@ public function quantumView(string $version, \ShipStream\Ups\Api\Model\QUANTUMVI } /** * Get Quantum View Response - * * @param string $deprecatedVersion Version of API. Valid values: - v1 + * @param \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper $requestBody - * @param \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper $requestBody * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\DeprecatedQuantumViewBadRequestException * @throws \ShipStream\Ups\Api\Exception\DeprecatedQuantumViewUnauthorizedException @@ -759,7 +730,7 @@ public function quantumView(string $version, \ShipStream\Ups\Api\Model\QUANTUMVI * @throws \ShipStream\Ups\Api\Exception\DeprecatedQuantumViewTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function deprecatedQuantumView(string $deprecatedVersion, \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper $requestBody, string $fetch = self::FETCH_OBJECT) { @@ -767,12 +738,10 @@ public function deprecatedQuantumView(string $deprecatedVersion, \ShipStream\Ups } /** * The Rating API is used when rating or shopping a shipment. - * * @param string $version Indicates Rate API to display the new release features in Rate API response based on Rate release. See the New section for the latest Rate release. Valid values: - v2403 - * @param string $requestoption Valid Values: - Rate = The server rates (The default Request option is Rate if a Request Option is not provided). - Shop = The server validates the shipment, and returns rates for all UPS products from the ShipFrom to the ShipTo addresses. @@ -780,8 +749,7 @@ public function deprecatedQuantumView(string $deprecatedVersion, \ShipStream\Ups - Shoptimeintransit = The server validates the shipment, and returns rates and transit times for all UPS products from the ShipFrom to the ShipTo addresses. Rate is the only valid request option for UPS Ground Freight Pricing requests. - - * @param \ShipStream\Ups\Api\Model\RATERequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\RATERequestWrapper $requestBody * @param array $queryParameters { * @var string $additionalinfo Valid Values: timeintransit = The server rates with transit time information combined with requestoption in URL.Rate is the only valid request option for Ground Freight Pricing requests. Length 15 * } @@ -789,6 +757,7 @@ public function deprecatedQuantumView(string $deprecatedVersion, \ShipStream\Ups * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\RateBadRequestException * @throws \ShipStream\Ups\Api\Exception\RateUnauthorizedException @@ -796,7 +765,7 @@ public function deprecatedQuantumView(string $deprecatedVersion, \ShipStream\Ups * @throws \ShipStream\Ups\Api\Exception\RateTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\RATEResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\RATEResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function rate(string $version, string $requestoption, \ShipStream\Ups\Api\Model\RATERequestWrapper $requestBody, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -804,7 +773,6 @@ public function rate(string $version, string $requestoption, \ShipStream\Ups\Api } /** * The Rating API is used when rating or shopping a shipment. - * * @param string $deprecatedVersion Indicates Rate API to display the new release features in Rate API response based on Rate release. See the New section for the latest Rate release. Valid values: @@ -815,7 +783,6 @@ public function rate(string $version, string $requestoption, \ShipStream\Ups\Api - 1707 - v2108 - v2205 - * @param string $requestoption Valid Values: - Rate = The server rates (The default Request option is Rate if a Request Option is not provided). - Shop = The server validates the shipment, and returns rates for all UPS products from the ShipFrom to the ShipTo addresses. @@ -823,8 +790,7 @@ public function rate(string $version, string $requestoption, \ShipStream\Ups\Api - Shoptimeintransit = The server validates the shipment, and returns rates and transit times for all UPS products from the ShipFrom to the ShipTo addresses. Rate is the only valid request option for UPS Ground Freight Pricing requests. - - * @param \ShipStream\Ups\Api\Model\RATERequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\RATERequestWrapper $requestBody * @param array $queryParameters { * @var string $additionalinfo Valid Values: timeintransit = The server rates with transit time information combined with requestoption in URL.Rate is the only valid request option for Ground Freight Pricing requests. Length 15 * } @@ -832,6 +798,7 @@ public function rate(string $version, string $requestoption, \ShipStream\Ups\Api * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\DeprecatedRateBadRequestException * @throws \ShipStream\Ups\Api\Exception\DeprecatedRateUnauthorizedException @@ -839,30 +806,29 @@ public function rate(string $version, string $requestoption, \ShipStream\Ups\Api * @throws \ShipStream\Ups\Api\Exception\DeprecatedRateTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\RATEResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\RATEResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function deprecatedRate(string $deprecatedVersion, string $requestoption, \ShipStream\Ups\Api\Model\RATERequestWrapper $requestBody, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { return $this->executeEndpoint(new \ShipStream\Ups\Api\Endpoint\DeprecatedRate($deprecatedVersion, $requestoption, $requestBody, $queryParameters, $headerParameters), $fetch); } /** - * The Shipping API makes UPS shipping services available to client applications that communicate with UPS - using the Internet - * + * The Shipping API makes UPS shipping services available to client applications that communicate with UPS + * using the Internet * @param string $version Indicates Ship API to display the new release features in Ship API response based on Ship release. Valid values: - v2403 - - * @param \ShipStream\Ups\Api\Model\SHIPRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\SHIPRequestWrapper $requestBody * @param array $queryParameters { - * @var string $additionaladdressvalidation Valid Values: + * @var string $additionaladdressvalidation Valid Values: city = validation will include city.Length 15 * } * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\ShipmentBadRequestException * @throws \ShipStream\Ups\Api\Exception\ShipmentUnauthorizedException @@ -870,7 +836,7 @@ public function deprecatedRate(string $deprecatedVersion, string $requestoption, * @throws \ShipStream\Ups\Api\Exception\ShipmentTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\SHIPResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\SHIPResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function shipment(string $version, \ShipStream\Ups\Api\Model\SHIPRequestWrapper $requestBody, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -878,29 +844,28 @@ public function shipment(string $version, \ShipStream\Ups\Api\Model\SHIPRequestW } /** * The Void Shipping API is used to cancel the previously scheduled shipment - * * @param string $version API Version Valid values: - v2403 - * @param string $shipmentidentificationnumber The shipment's identification number Alpha-numeric. Must pass 1Z rules. Must be upper case. Length 18 * @param array $queryParameters { - * @var string $trackingnumber The package's tracking number. You may have + * @var string $trackingnumber The package's tracking number. You may have up to 20 different tracking numbers listed. - If more than one tracking number, pass this - value as: trackingnumber= + If more than one tracking number, pass this + value as: trackingnumber= ["1ZISUS010330563105","1ZISUS01033056310 8"] with a coma separating each number. - Alpha-numeric. Must pass 1Z rules. Must be + Alpha-numeric. Must pass 1Z rules. Must be upper case. Length 18 * } * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\VoidShipmentBadRequestException * @throws \ShipStream\Ups\Api\Exception\VoidShipmentUnauthorizedException @@ -908,7 +873,7 @@ public function shipment(string $version, \ShipStream\Ups\Api\Model\SHIPRequestW * @throws \ShipStream\Ups\Api\Exception\VoidShipmentTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function voidShipment(string $version, string $shipmentidentificationnumber, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -916,7 +881,6 @@ public function voidShipment(string $version, string $shipmentidentificationnumb } /** * The Label Shipping API allows us to retrieve forward and return labels. - * * @param string $version When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This @@ -929,11 +893,12 @@ public function voidShipment(string $version, string $shipmentidentificationnumb features returned in the response. V1903 Length 5 - * @param \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\LabelRecoveryBadRequestException * @throws \ShipStream\Ups\Api\Exception\LabelRecoveryUnauthorizedException @@ -941,16 +906,15 @@ public function voidShipment(string $version, string $shipmentidentificationnumb * @throws \ShipStream\Ups\Api\Exception\LabelRecoveryTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function labelRecovery(string $version, \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { return $this->executeEndpoint(new \ShipStream\Ups\Api\Endpoint\LabelRecovery($version, $requestBody, $headerParameters), $fetch); } /** - * The Shipping API makes UPS shipping services available to client applications that communicate with UPS - using the Internet - * + * The Shipping API makes UPS shipping services available to client applications that communicate with UPS + * using the Internet * @param string $deprecatedVersion Indicates Ship API to display the new release features in Ship API response based on Ship release. Valid values: @@ -963,16 +927,16 @@ public function labelRecovery(string $version, \ShipStream\Ups\Api\Model\LABELRE - v1807 - v2108 - v2205 - - * @param \ShipStream\Ups\Api\Model\SHIPRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\SHIPRequestWrapper $requestBody * @param array $queryParameters { - * @var string $additionaladdressvalidation Valid Values: + * @var string $additionaladdressvalidation Valid Values: city = validation will include city.Length 15 * } * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\DeprecatedShipmentBadRequestException * @throws \ShipStream\Ups\Api\Exception\DeprecatedShipmentUnauthorizedException @@ -980,7 +944,7 @@ public function labelRecovery(string $version, \ShipStream\Ups\Api\Model\LABELRE * @throws \ShipStream\Ups\Api\Exception\DeprecatedShipmentTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\SHIPResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\SHIPResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function deprecatedShipment(string $deprecatedVersion, \ShipStream\Ups\Api\Model\SHIPRequestWrapper $requestBody, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -988,29 +952,28 @@ public function deprecatedShipment(string $deprecatedVersion, \ShipStream\Ups\Ap } /** * The Void Shipping API is used to cancel the previously scheduled shipment - * * @param string $deprecatedVersion API Version. Valid values: - v1 - * @param string $shipmentidentificationnumber The shipment's identification number Alpha-numeric. Must pass 1Z rules. Must be upper case. Length 18 * @param array $queryParameters { - * @var string $trackingnumber The package's tracking number. You may have + * @var string $trackingnumber The package's tracking number. You may have up to 20 different tracking numbers listed. - If more than one tracking number, pass this - value as: trackingnumber= + If more than one tracking number, pass this + value as: trackingnumber= ["1ZISUS010330563105","1ZISUS01033056310 8"] with a coma separating each number. - Alpha-numeric. Must pass 1Z rules. Must be + Alpha-numeric. Must pass 1Z rules. Must be upper case. Length 18 * } * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\DeprecatedVoidShipmentBadRequestException * @throws \ShipStream\Ups\Api\Exception\DeprecatedVoidShipmentUnauthorizedException @@ -1018,7 +981,7 @@ public function deprecatedShipment(string $deprecatedVersion, \ShipStream\Ups\Ap * @throws \ShipStream\Ups\Api\Exception\DeprecatedVoidShipmentTooManyRequestsException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function deprecatedVoidShipment(string $deprecatedVersion, string $shipmentidentificationnumber, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -1026,7 +989,6 @@ public function deprecatedVoidShipment(string $deprecatedVersion, string $shipme } /** * API can be only used by users that plan to ship packages manifested, tendered, and delivered by TForce Freight - * * @param string $version Version of the API e.g v1 * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 @@ -1037,7 +999,7 @@ public function deprecatedVoidShipment(string $deprecatedVersion, string $shipme * @throws \ShipStream\Ups\Api\Exception\FreightCancelPickupUnauthorizedException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function freightCancelPickup(string $version = 'v1', array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -1045,9 +1007,8 @@ public function freightCancelPickup(string $version = 'v1', array $headerParamet } /** * API can be only used by users that plan to ship packages manifested, tendered, and delivered by TForce Freight - * * @param string $version Version of the API e.g v1 - * @param \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -1056,7 +1017,7 @@ public function freightCancelPickup(string $version = 'v1', array $headerParamet * @throws \ShipStream\Ups\Api\Exception\FreightPickupUnauthorizedException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function freightPickup(string $version, \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { @@ -1064,7 +1025,6 @@ public function freightPickup(string $version, \ShipStream\Ups\Api\Model\FREIGHT } /** * The Rating Ground Freight API may only be used by brokers or resellers of transportation services with a current and active UPGF Master Transportation Agreement. - * * @param string $version When TForce Freight introduces new elements in the response that are not associated with new request elements, Version is used. This ensures @@ -1074,17 +1034,18 @@ public function freightPickup(string $version, \ShipStream\Ups\Api\Model\FREIGHT * @param string $requestoption Valid Values: ground, air. Length 15 - * @param \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } - * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @param array $accept Accept content header application/json|application/xml + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @throws \ShipStream\Ups\Api\Exception\FreightRateUnauthorizedException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function freightRate(string $version, string $requestoption, \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT, array $accept = []) { @@ -1092,7 +1053,6 @@ public function freightRate(string $version, string $requestoption, \ShipStream\ } /** * Only users that plan to ship packages manifested, tendered, and delivered by TForce Freight can use the API. - * * @param string $version When TForce Freight introduces new elements in the response that are not associated with new request elements, version is used. This ensures @@ -1109,50 +1069,48 @@ public function freightRate(string $version, string $requestoption, \ShipStream\ * @param string $reqoption Valid Values: Ground, Air . Length 15 - * @param \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @throws \ShipStream\Ups\Api\Exception\FreightShipUnauthorizedException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper : \Psr\Http\Message\ResponseInterface) */ public function freightShip(string $version, string $reqoption, \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { return $this->executeEndpoint(new \ShipStream\Ups\Api\Endpoint\FreightShip($version, $reqoption, $requestBody, $headerParameters), $fetch); } /** - * The Time In Transit API provides estimated delivery times for various UPS shipping services, between specified locations. - - Key Business Values: - - **Enhanced Customer Experience**: Allows businesses provide accurate delivery estimates to their customers, enhancing customer service. - - **Operational Efficiency**: Helps in logistics planning by providing transit times for different UPS services. - * - * @param string $version API Version - * @param \ShipStream\Ups\Api\Model\TimeInTransitRequest $requestBody - * @param array $headerParameters { - * @var string $transId An identifier unique to the request. Length 32 - * @var string $transactionSrc Identifies the clients/source application that is calling. Length 512 - * } - * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) - * @throws \ShipStream\Ups\Api\Exception\TimeInTransitBadRequestException - * @throws \ShipStream\Ups\Api\Exception\TimeInTransitUnauthorizedException - * @throws \ShipStream\Ups\Api\Exception\TimeInTransitForbiddenException - * @throws \ShipStream\Ups\Api\Exception\TimeInTransitTooManyRequestsException - * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException - * - * @return \ShipStream\Ups\Api\Model\TimeInTransitResponse|\Psr\Http\Message\ResponseInterface - */ + * The Time In Transit API provides estimated delivery times for various UPS shipping services, between specified locations. + * + * Key Business Values: + * - **Enhanced Customer Experience**: Allows businesses provide accurate delivery estimates to their customers, enhancing customer service. + * - **Operational Efficiency**: Helps in logistics planning by providing transit times for different UPS services. + * @param string $version API Version + * @param \ShipStream\Ups\Api\Model\TimeInTransitRequest $requestBody + * @param array $headerParameters { + * @var string $transId An identifier unique to the request. Length 32 + * @var string $transactionSrc Identifies the clients/source application that is calling. Length 512 + * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @throws \ShipStream\Ups\Api\Exception\TimeInTransitBadRequestException + * @throws \ShipStream\Ups\Api\Exception\TimeInTransitUnauthorizedException + * @throws \ShipStream\Ups\Api\Exception\TimeInTransitForbiddenException + * @throws \ShipStream\Ups\Api\Exception\TimeInTransitTooManyRequestsException + * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException + * + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\TimeInTransitResponse : \Psr\Http\Message\ResponseInterface) + */ public function timeInTransit(string $version, \ShipStream\Ups\Api\Model\TimeInTransitRequest $requestBody, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { return $this->executeEndpoint(new \ShipStream\Ups\Api\Endpoint\TimeInTransit($version, $requestBody, $headerParameters), $fetch); } /** - * - * * @param string $inquiryNumber The tracking number for which tracking information is requested. Each inquiry number must be between 7 and 34 characters in length. * @param array $queryParameters { * @var string $locale Language and country code of the user, separated by an underscore. Default value is 'en_US' @@ -1171,40 +1129,38 @@ public function timeInTransit(string $version, \ShipStream\Ups\Api\Model\TimeInT * @throws \ShipStream\Ups\Api\Exception\GetSingleTrackResponseUsingGETServiceUnavailableException * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException * - * @return \ShipStream\Ups\Api\Model\TrackApiResponse|\ShipStream\Ups\Api\Model\ErrorResponse|\Psr\Http\Message\ResponseInterface + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\TrackApiResponse|\ShipStream\Ups\Api\Model\ErrorResponse : \Psr\Http\Message\ResponseInterface) */ public function getSingleTrackResponseUsingGET(string $inquiryNumber, array $queryParameters = [], array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { return $this->executeEndpoint(new \ShipStream\Ups\Api\Endpoint\GetSingleTrackResponseUsingGET($inquiryNumber, $queryParameters, $headerParameters), $fetch); } /** - * This endpoint takes a list of tracking numbers and creates a subscription for each. - Clients must provide the tracking numbers in the correct format. - - Upon success it should return: - - List of valid tracking number for which subscription created. - - List of invalid tracking number for which subscription not created. - - * - * @param string $type - 'Standard' - Represents a standard subscription type that provides near real time updates on tracking status. - - * @param null|\ShipStream\Ups\Api\Model\TrackSubsServiceRequest $requestBody - * @param array $headerParameters { - * @var string $transId An identifier unique to the request. - * @var string $transactionSrc Identifies the client/source application that is calling. - * } - * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) - * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberBadRequestException - * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberUnauthorizedException - * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberNotFoundException - * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberForbiddenException - * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberMethodNotAllowedException - * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberTooManyRequestsException - * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberInternalServerErrorException - * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException - * - * @return \ShipStream\Ups\Api\Model\TrackSubsServiceResponse|\Psr\Http\Message\ResponseInterface - */ + * This endpoint takes a list of tracking numbers and creates a subscription for each. + * Clients must provide the tracking numbers in the correct format. + * + * Upon success it should return: + * - List of valid tracking number for which subscription created. + * - List of invalid tracking number for which subscription not created. + * + * @param string $type - 'Standard' - Represents a standard subscription type that provides near real time updates on tracking status. + * @param null|\ShipStream\Ups\Api\Model\TrackSubsServiceRequest $requestBody + * @param array $headerParameters { + * @var string $transId An identifier unique to the request. + * @var string $transactionSrc Identifies the client/source application that is calling. + * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberBadRequestException + * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberUnauthorizedException + * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberNotFoundException + * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberForbiddenException + * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberMethodNotAllowedException + * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberTooManyRequestsException + * @throws \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberInternalServerErrorException + * @throws \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException + * + * @return ($fetch is 'object' ? \ShipStream\Ups\Api\Model\TrackSubsServiceResponse : \Psr\Http\Message\ResponseInterface) + */ public function processSubscriptionTypeForTrackingNumber(string $type, ?\ShipStream\Ups\Api\Model\TrackSubsServiceRequest $requestBody = null, array $headerParameters = [], string $fetch = self::FETCH_OBJECT) { return $this->executeEndpoint(new \ShipStream\Ups\Api\Endpoint\ProcessSubscriptionTypeForTrackingNumber($type, $requestBody, $headerParameters), $fetch); diff --git a/src/Api/Endpoint/AcceptanceAuditPreCheck.php b/src/Api/Endpoint/AcceptanceAuditPreCheck.php index 6edeeaca..d65f0d6b 100644 --- a/src/Api/Endpoint/AcceptanceAuditPreCheck.php +++ b/src/Api/Endpoint/AcceptanceAuditPreCheck.php @@ -7,9 +7,8 @@ class AcceptanceAuditPreCheck extends \ShipStream\Ups\Api\Runtime\Client\BaseEnd protected $version; /** * Enables shippers perform pre-checks before shipping dangerous goods using the chemical record identifier and the commodity's regulated level code. - * * @param string $version API version - * @param \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -66,19 +65,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\AcceptanceAuditPreCheckBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\AcceptanceAuditPreCheckUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\AcceptanceAuditPreCheckForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\AcceptanceAuditPreCheckTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/AddressValidation.php b/src/Api/Endpoint/AddressValidation.php index 3c4fc08f..70cbe666 100644 --- a/src/Api/Endpoint/AddressValidation.php +++ b/src/Api/Endpoint/AddressValidation.php @@ -8,7 +8,6 @@ class AddressValidation extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint protected $version; /** * The Address Validation Street Level API can be used to check addresses against the United States Postal Service database of valid addresses in the U.S. and Puerto Rico. - * * @param int $requestoption Identifies the optional processing to be performed. If not present or invalid value then an error will be sent back. Valid values: @@ -17,13 +16,11 @@ class AddressValidation extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint - 3 - Address Validation and Address Classification. For a list of valid values, refer to Address Validation API Supported Countries or Territories in the Appendix. - * @param string $version Identifies the version of the API. Valid values: - v2 - - * @param \ShipStream\Ups\Api\Model\XAVRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\XAVRequestWrapper $requestBody * @param array $queryParameters { * @var string $regionalrequestindicator Valid values: True or False. If True, either the region element or any combination of Political Division 1, Political Division 2, PostcodePrimaryLow and the PostcodeExtendedLow fields will be recognized for validation in addition to the urbanization element. If False or no indicator, street level address validation is provided * @var int $maximumcandidatelistsize Valid values: 0 – 50 The maximum number of Candidates to return for this request. If not provided, the default size of 15 is returned. @@ -81,19 +78,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\XAVResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\AddressValidationBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\AddressValidationUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\AddressValidationForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\AddressValidationTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/AuthorizeClient.php b/src/Api/Endpoint/AuthorizeClient.php index f31368c9..90570bf5 100644 --- a/src/Api/Endpoint/AuthorizeClient.php +++ b/src/Api/Endpoint/AuthorizeClient.php @@ -6,7 +6,6 @@ class AuthorizeClient extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint im { /** * The Authorize Client endpoint initiates the OAuth Authorization Code flow by redirecting the user to UPS for logging-in and authorize the client application. To begin the authorization flow, the application constructs a URL using the application's client Id, the redirect URI, the scope of permissions requested, and a random string used for subsequent verification. A successful response redirects back to the client with an authorization code that can be exchanged for an access token. - * * @param array $queryParameters { * @var string $client_id The public identifier for your application, obtained when you, the developer first registered the application. * @var string $redirect_uri URL that tells the authorization server where to send the user back to after they approve the request. @@ -67,16 +66,16 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re if (302 === $status) { return null; } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\AuthorizeClientBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\AuthorizeClientUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\AuthorizeClientForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\AuthorizeClientTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/ChemicalReferenceData.php b/src/Api/Endpoint/ChemicalReferenceData.php index ceb3d8b9..c0cc7c21 100644 --- a/src/Api/Endpoint/ChemicalReferenceData.php +++ b/src/Api/Endpoint/ChemicalReferenceData.php @@ -7,11 +7,10 @@ class ChemicalReferenceData extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpo protected $version; /** * The Chemical Reference Data endpoint of the Dangerous Goods API allows shippers look up hazardous material reference information by ID number and shipping name of the specified regulated good. - * * @param string $version Version of the API. Valid values: v1 v1801. Length 5 - * @param \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -68,19 +67,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ChemicalReferenceDataBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ChemicalReferenceDataUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ChemicalReferenceDataForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ChemicalReferenceDataTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/Delete.php b/src/Api/Endpoint/Delete.php index fc130a9c..37f554dc 100644 --- a/src/Api/Endpoint/Delete.php +++ b/src/Api/Endpoint/Delete.php @@ -7,12 +7,10 @@ class Delete extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint implements protected $version; /** * The Paperless Document API web service allows the users to upload their own customized trade documents for customs clearance to Forms History. - * * @param string $version Version of API Valid values: - v2 - * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -69,19 +67,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeleteBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeleteUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeleteForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeleteTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/DeprecatedAddressValidation.php b/src/Api/Endpoint/DeprecatedAddressValidation.php index 02ade8bd..b2ef642c 100644 --- a/src/Api/Endpoint/DeprecatedAddressValidation.php +++ b/src/Api/Endpoint/DeprecatedAddressValidation.php @@ -8,7 +8,6 @@ class DeprecatedAddressValidation extends \ShipStream\Ups\Api\Runtime\Client\Bas protected $deprecatedVersion; /** * The Address Validation Street Level API can be used to check addresses against the United States Postal Service database of valid addresses in the U.S. and Puerto Rico. - * * @param int $requestoption Identifies the optional processing to be performed. If not present or invalid value then an error will be sent back. Valid values: @@ -18,13 +17,11 @@ class DeprecatedAddressValidation extends \ShipStream\Ups\Api\Runtime\Client\Bas - 3 - Address Validation and Address Classification. For a list of valid values, refer to Address Validation API Supported Countries or Territories in the Appendix. - * @param string $deprecatedVersion Identifies the version of the API. Valid values: - v1 - - * @param \ShipStream\Ups\Api\Model\XAVRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\XAVRequestWrapper $requestBody * @param array $queryParameters { * @var string $regionalrequestindicator Valid values: True or False. If True, either the region element or any combination of Political Division 1, Political Division 2, PostcodePrimaryLow and the PostcodeExtendedLow fields will be recognized for validation in addition to the urbanization element. If False or no indicator, street level address validation is provided * @var int $maximumcandidatelistsize Valid values: 0 – 50 The maximum number of Candidates to return for this request. If not provided, the default size of 15 is returned. @@ -82,19 +79,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\XAVResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedAddressValidationBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedAddressValidationUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedAddressValidationForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedAddressValidationTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/DeprecatedDelete.php b/src/Api/Endpoint/DeprecatedDelete.php index 649a2011..fcb0767f 100644 --- a/src/Api/Endpoint/DeprecatedDelete.php +++ b/src/Api/Endpoint/DeprecatedDelete.php @@ -7,12 +7,10 @@ class DeprecatedDelete extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint i protected $deprecatedVersion; /** * The Paperless Document API web service allows the users to upload their own customized trade documents for customs clearance to Forms History. - * * @param string $deprecatedVersion Version of API Valid values: - v1 - * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -69,19 +67,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedDeleteBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedDeleteUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedDeleteForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedDeleteTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/DeprecatedLocator.php b/src/Api/Endpoint/DeprecatedLocator.php index 26f57de7..a99651c5 100644 --- a/src/Api/Endpoint/DeprecatedLocator.php +++ b/src/Api/Endpoint/DeprecatedLocator.php @@ -8,12 +8,10 @@ class DeprecatedLocator extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint protected $reqOption; /** * The Locator API allows you to find UPS locations - such as drop-off points, retail locations, and UPS access points (third-party retail locations that offer UPS package drop-off, or delivery services). The API provides capabilities to search by location, services offered, program types, and related criteria. You can also retrieve hours of operation, location details, and additional UPS services offered at specific locations. - * * @param string $deprecatedVersion Version of API Valid values: - v1 - * @param string $reqOption Indicates the type of request. Valid values: 1-Locations (Drop Locations and Will call locations) @@ -24,8 +22,8 @@ class DeprecatedLocator extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint 40-All available Retail Locations and Additional Services 48-All available Retail Locations and Program Types 56-All available Retail Locations, Additional Services and Program Types - 64-Search for UPS Access Point Locations. - * @param \ShipStream\Ups\Api\Model\LOCATORRequestWrapper $requestBody + 64-Search for UPS Access Point Locations. + * @param \ShipStream\Ups\Api\Model\LOCATORRequestWrapper $requestBody * @param array $queryParameters { * @var string $Locale Locale of request * } @@ -96,19 +94,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\LOCATORResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedLocatorBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedLocatorUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedLocatorForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedLocatorTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/DeprecatedPickupCancel.php b/src/Api/Endpoint/DeprecatedPickupCancel.php index 96e6054f..63c97898 100644 --- a/src/Api/Endpoint/DeprecatedPickupCancel.php +++ b/src/Api/Endpoint/DeprecatedPickupCancel.php @@ -8,17 +8,15 @@ class DeprecatedPickupCancel extends \ShipStream\Ups\Api\Runtime\Client\BaseEndp protected $deprecatedVersion; /** * Using the CancelBy endpoint of the Pickup API, users can request cancellation of a UPS on-demand package pickup. When the PRN (pickup request number), transaction ID, and the transaction source are supplied as required parameters, the endpoint returns confirmation that the pickup has been cancelled. - * * @param string $cancelBy Valid Values: 01 = AccountNumber, 02 = PRN * @param string $deprecatedVersion Version of API. Valid values: - v1 - * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 - * @var string $Prn The pickup equest number (PRN) generated by + * @var string $Prn The pickup equest number (PRN) generated by UPS pickup system. Required if CancelBy = prn.Length 26 * } @@ -72,19 +70,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPickupCancelBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPickupCancelUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPickupCancelForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPickupCancelTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/DeprecatedPickupCreation.php b/src/Api/Endpoint/DeprecatedPickupCreation.php index 3997e55f..6a487ad3 100644 --- a/src/Api/Endpoint/DeprecatedPickupCreation.php +++ b/src/Api/Endpoint/DeprecatedPickupCreation.php @@ -7,15 +7,13 @@ class DeprecatedPickupCreation extends \ShipStream\Ups\Api\Runtime\Client\BaseEn protected $deprecatedVersion; /** * Using the Pickup API, applications can schedule pickups, manage previously scheduled pickups, or cancel previously scheduled pickups. - * * @param string $deprecatedVersion Version of the API. Valid values: - v1 - v1607 - v1707 - - * @param \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -72,19 +70,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPickupCreationBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPickupCreationUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPickupCreationForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPickupCreationTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/DeprecatedPreNotification.php b/src/Api/Endpoint/DeprecatedPreNotification.php index fbe233bd..f2cdbfaf 100644 --- a/src/Api/Endpoint/DeprecatedPreNotification.php +++ b/src/Api/Endpoint/DeprecatedPreNotification.php @@ -7,13 +7,11 @@ class DeprecatedPreNotification extends \ShipStream\Ups\Api\Runtime\Client\BaseE protected $deprecatedVersion; /** * The Pre-Notification API allows customer applications to inform UPS operations of Dangerous Goods shipments as they are processed and will enter the UPS transportation network prior to an upload of manifest information at the end of the day. - * * @param string $deprecatedVersion Version of API. Valid values: - v1 - - * @param \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -70,19 +68,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPreNotificationBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPreNotificationUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPreNotificationForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPreNotificationTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/DeprecatedPushToImageRepository.php b/src/Api/Endpoint/DeprecatedPushToImageRepository.php index 3eb6fe39..5cfe8e02 100644 --- a/src/Api/Endpoint/DeprecatedPushToImageRepository.php +++ b/src/Api/Endpoint/DeprecatedPushToImageRepository.php @@ -6,14 +6,12 @@ class DeprecatedPushToImageRepository extends \ShipStream\Ups\Api\Runtime\Client { protected $deprecatedVersion; /** - * The Paperless Document API web service allows the users to upload their own customized trade documents for customs clearance to Forms History. - * + * The Paperless Document API web service allows the users to upload their own customized trade documents for customs clearance to Forms History. * @param string $deprecatedVersion Version of API Valid values: - v1 - - * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -72,19 +70,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPushToImageRepositoryBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPushToImageRepositoryUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPushToImageRepositoryForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedPushToImageRepositoryTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/DeprecatedQuantumView.php b/src/Api/Endpoint/DeprecatedQuantumView.php index 504a5047..14ccee64 100644 --- a/src/Api/Endpoint/DeprecatedQuantumView.php +++ b/src/Api/Endpoint/DeprecatedQuantumView.php @@ -7,13 +7,11 @@ class DeprecatedQuantumView extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpo protected $deprecatedVersion; /** * Get Quantum View Response - * * @param string $deprecatedVersion Version of API. Valid values: - v1 - - * @param \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper $requestBody */ public function __construct(string $deprecatedVersion, \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper $requestBody) { @@ -55,19 +53,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedQuantumViewBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedQuantumViewUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedQuantumViewForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedQuantumViewTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/DeprecatedRate.php b/src/Api/Endpoint/DeprecatedRate.php index 0944c257..e8aa05f8 100644 --- a/src/Api/Endpoint/DeprecatedRate.php +++ b/src/Api/Endpoint/DeprecatedRate.php @@ -8,7 +8,6 @@ class DeprecatedRate extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint imp protected $requestoption; /** * The Rating API is used when rating or shopping a shipment. - * * @param string $deprecatedVersion Indicates Rate API to display the new release features in Rate API response based on Rate release. See the New section for the latest Rate release. Valid values: @@ -19,7 +18,6 @@ class DeprecatedRate extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint imp - 1707 - v2108 - v2205 - * @param string $requestoption Valid Values: - Rate = The server rates (The default Request option is Rate if a Request Option is not provided). - Shop = The server validates the shipment, and returns rates for all UPS products from the ShipFrom to the ShipTo addresses. @@ -27,8 +25,7 @@ class DeprecatedRate extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint imp - Shoptimeintransit = The server validates the shipment, and returns rates and transit times for all UPS products from the ShipFrom to the ShipTo addresses. Rate is the only valid request option for UPS Ground Freight Pricing requests. - - * @param \ShipStream\Ups\Api\Model\RATERequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\RATERequestWrapper $requestBody * @param array $queryParameters { * @var string $additionalinfo Valid Values: timeintransit = The server rates with transit time information combined with requestoption in URL.Rate is the only valid request option for Ground Freight Pricing requests. Length 15 * } @@ -99,19 +96,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\RATEResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedRateBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedRateUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedRateForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedRateTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/DeprecatedShipment.php b/src/Api/Endpoint/DeprecatedShipment.php index 16ad77e1..402645a5 100644 --- a/src/Api/Endpoint/DeprecatedShipment.php +++ b/src/Api/Endpoint/DeprecatedShipment.php @@ -6,9 +6,8 @@ class DeprecatedShipment extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint { protected $deprecatedVersion; /** - * The Shipping API makes UPS shipping services available to client applications that communicate with UPS - using the Internet - * + * The Shipping API makes UPS shipping services available to client applications that communicate with UPS + * using the Internet * @param string $deprecatedVersion Indicates Ship API to display the new release features in Ship API response based on Ship release. Valid values: @@ -21,10 +20,9 @@ class DeprecatedShipment extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint - v1807 - v2108 - v2205 - - * @param \ShipStream\Ups\Api\Model\SHIPRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\SHIPRequestWrapper $requestBody * @param array $queryParameters { - * @var string $additionaladdressvalidation Valid Values: + * @var string $additionaladdressvalidation Valid Values: city = validation will include city.Length 15 * } * @param array $headerParameters { @@ -93,19 +91,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\SHIPResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedShipmentBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedShipmentUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedShipmentForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedShipmentTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/DeprecatedUpload.php b/src/Api/Endpoint/DeprecatedUpload.php index be766bbe..ddb14af4 100644 --- a/src/Api/Endpoint/DeprecatedUpload.php +++ b/src/Api/Endpoint/DeprecatedUpload.php @@ -6,14 +6,12 @@ class DeprecatedUpload extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint i { protected $deprecatedVersion; /** - * The Paperless Document API web service allows the users to upload,delete and push to image repository their own customized trade documents for customs clearance to Forms History. - * + * The Paperless Document API web service allows the users to upload,delete and push to image repository their own customized trade documents for customs clearance to Forms History. * @param string $deprecatedVersion Version of API Valid values: - v1 - - * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -72,19 +70,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedUploadBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedUploadUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedUploadForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedUploadTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/DeprecatedVoidShipment.php b/src/Api/Endpoint/DeprecatedVoidShipment.php index 306a4e03..aa811336 100644 --- a/src/Api/Endpoint/DeprecatedVoidShipment.php +++ b/src/Api/Endpoint/DeprecatedVoidShipment.php @@ -8,23 +8,21 @@ class DeprecatedVoidShipment extends \ShipStream\Ups\Api\Runtime\Client\BaseEndp protected $shipmentidentificationnumber; /** * The Void Shipping API is used to cancel the previously scheduled shipment - * * @param string $deprecatedVersion API Version. Valid values: - v1 - * @param string $shipmentidentificationnumber The shipment's identification number Alpha-numeric. Must pass 1Z rules. Must be upper case. Length 18 * @param array $queryParameters { - * @var string $trackingnumber The package's tracking number. You may have + * @var string $trackingnumber The package's tracking number. You may have up to 20 different tracking numbers listed. - If more than one tracking number, pass this - value as: trackingnumber= + If more than one tracking number, pass this + value as: trackingnumber= ["1ZISUS010330563105","1ZISUS01033056310 8"] with a coma separating each number. - Alpha-numeric. Must pass 1Z rules. Must be + Alpha-numeric. Must pass 1Z rules. Must be upper case. Length 18 * } * @param array $headerParameters { @@ -90,19 +88,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedVoidShipmentBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedVoidShipmentUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedVoidShipmentForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\DeprecatedVoidShipmentTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/FreightCancelPickup.php b/src/Api/Endpoint/FreightCancelPickup.php index 071a501a..2199270e 100644 --- a/src/Api/Endpoint/FreightCancelPickup.php +++ b/src/Api/Endpoint/FreightCancelPickup.php @@ -7,7 +7,6 @@ class FreightCancelPickup extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoin protected $version; /** * API can be only used by users that plan to ship packages manifested, tendered, and delivered by TForce Freight - * * @param string $version Version of the API e.g v1 * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 @@ -60,7 +59,7 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper', 'json'); } if (401 === $status) { diff --git a/src/Api/Endpoint/FreightPickup.php b/src/Api/Endpoint/FreightPickup.php index 19986942..e3a09ccc 100644 --- a/src/Api/Endpoint/FreightPickup.php +++ b/src/Api/Endpoint/FreightPickup.php @@ -7,9 +7,8 @@ class FreightPickup extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint impl protected $version; /** * API can be only used by users that plan to ship packages manifested, tendered, and delivered by TForce Freight - * * @param string $version Version of the API e.g v1 - * @param \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -63,7 +62,7 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper', 'json'); } if (401 === $status) { diff --git a/src/Api/Endpoint/FreightRate.php b/src/Api/Endpoint/FreightRate.php index 89f45cea..5606583d 100644 --- a/src/Api/Endpoint/FreightRate.php +++ b/src/Api/Endpoint/FreightRate.php @@ -9,7 +9,6 @@ class FreightRate extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint implem protected $accept; /** * The Rating Ground Freight API may only be used by brokers or resellers of transportation services with a current and active UPGF Master Transportation Agreement. - * * @param string $version When TForce Freight introduces new elements in the response that are not associated with new request elements, Version is used. This ensures @@ -19,7 +18,7 @@ class FreightRate extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint implem * @param string $requestoption Valid Values: ground, air. Length 15 - * @param \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -82,7 +81,7 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper', 'json'); } if (401 === $status) { diff --git a/src/Api/Endpoint/FreightShip.php b/src/Api/Endpoint/FreightShip.php index 4b85644d..2434e8c7 100644 --- a/src/Api/Endpoint/FreightShip.php +++ b/src/Api/Endpoint/FreightShip.php @@ -8,7 +8,6 @@ class FreightShip extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint implem protected $reqoption; /** * Only users that plan to ship packages manifested, tendered, and delivered by TForce Freight can use the API. - * * @param string $version When TForce Freight introduces new elements in the response that are not associated with new request elements, version is used. This ensures @@ -25,7 +24,7 @@ class FreightShip extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint implem * @param string $reqoption Valid Values: Ground, Air . Length 15 - * @param \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -80,7 +79,7 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper', 'json'); } if (401 === $status) { diff --git a/src/Api/Endpoint/GenerateToken.php b/src/Api/Endpoint/GenerateToken.php index 53d053bf..cd34bd65 100644 --- a/src/Api/Endpoint/GenerateToken.php +++ b/src/Api/Endpoint/GenerateToken.php @@ -6,8 +6,7 @@ class GenerateToken extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint impl { /** * The Generate Token endpoint exchanges the authorization code received from the client application for an access token and a refresh token. The client uses the access token to make API requests on behalf of the user by including it in the authorization header. The access token will expire after a certain period and can be refreshed by using the /refresh endpoint. - * - * @param null|\ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody $requestBody + * @param null|\ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody $requestBody */ public function __construct(?\ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody $requestBody = null) { @@ -48,19 +47,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\GenerateTokenBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\GenerateTokenUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\GenerateTokenForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\GenerateTokenTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/GetSingleTrackResponseUsingGET.php b/src/Api/Endpoint/GetSingleTrackResponseUsingGET.php index 333ab40a..eabc97a2 100644 --- a/src/Api/Endpoint/GetSingleTrackResponseUsingGET.php +++ b/src/Api/Endpoint/GetSingleTrackResponseUsingGET.php @@ -6,8 +6,6 @@ class GetSingleTrackResponseUsingGET extends \ShipStream\Ups\Api\Runtime\Client\ { protected $inquiryNumber; /** - * - * * @param string $inquiryNumber The tracking number for which tracking information is requested. Each inquiry number must be between 7 and 34 characters in length. * @param array $queryParameters { * @var string $locale Language and country code of the user, separated by an underscore. Default value is 'en_US' @@ -79,25 +77,25 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\TrackApiResponse', 'json'); } - if (is_null($contentType) === false && (207 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (207 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\GetSingleTrackResponseUsingGETBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\GetSingleTrackResponseUsingGETForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (404 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (404 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\GetSingleTrackResponseUsingGETNotFoundException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (500 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (500 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\GetSingleTrackResponseUsingGETInternalServerErrorException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (503 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (503 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\GetSingleTrackResponseUsingGETServiceUnavailableException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/LabelRecovery.php b/src/Api/Endpoint/LabelRecovery.php index 2c27b7fa..89b2de9f 100644 --- a/src/Api/Endpoint/LabelRecovery.php +++ b/src/Api/Endpoint/LabelRecovery.php @@ -7,7 +7,6 @@ class LabelRecovery extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint impl protected $version; /** * The Label Shipping API allows us to retrieve forward and return labels. - * * @param string $version When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This @@ -20,7 +19,7 @@ class LabelRecovery extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint impl features returned in the response. V1903 Length 5 - * @param \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -77,19 +76,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\LabelRecoveryBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\LabelRecoveryUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\LabelRecoveryForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\LabelRecoveryTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/LandedCost.php b/src/Api/Endpoint/LandedCost.php index 25f60db0..aa10bfaa 100644 --- a/src/Api/Endpoint/LandedCost.php +++ b/src/Api/Endpoint/LandedCost.php @@ -7,9 +7,8 @@ class LandedCost extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint impleme protected $version; /** * The Landed Cost Quote API allows you to estimate the all-inclusive cost of international shipments - including applicable duties, VAT, taxes, brokerage fees, and other fees. Required parameters include the currency and shipment details, such as the commodity ID, price, quantity, and country code of origin. - * * @param string $version Version of the API. - * @param \ShipStream\Ups\Api\Model\LandedCostRequest $requestBody + * @param \ShipStream\Ups\Api\Model\LandedCostRequest $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length: 32 * @var string $transactionSrc An identifier of the client/source application that is making the request. Length: 512 @@ -68,19 +67,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\LandedCostResponse', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\LandedCostBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\LandedCostUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\LandedCostForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\LandedCostTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/Locator.php b/src/Api/Endpoint/Locator.php index ea41ad5c..d309e961 100644 --- a/src/Api/Endpoint/Locator.php +++ b/src/Api/Endpoint/Locator.php @@ -8,12 +8,10 @@ class Locator extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint implements protected $reqOption; /** * The Locator API allows you to find UPS locations - such as drop-off points, retail locations, and UPS access points (third-party retail locations that offer UPS package drop-off, or delivery services). The API provides capabilities to search by location, services offered, program types, and related criteria. You can also retrieve hours of operation, location details, and additional UPS services offered at specific locations. - * * @param string $version Version of API Valid values: - v2 - * @param string $reqOption Indicates the type of request. Valid values: 1-Locations (Drop Locations and Will call locations) @@ -24,8 +22,8 @@ class Locator extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint implements 40-All available Retail Locations and Additional Services 48-All available Retail Locations and Program Types 56-All available Retail Locations, Additional Services and Program Types - 64-Search for UPS Access Point Locations. - * @param \ShipStream\Ups\Api\Model\LOCATORRequestWrapper $requestBody + 64-Search for UPS Access Point Locations. + * @param \ShipStream\Ups\Api\Model\LOCATORRequestWrapper $requestBody * @param array $queryParameters { * @var string $Locale Locale of request * } @@ -96,19 +94,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\LOCATORResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\LocatorBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\LocatorUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\LocatorForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\LocatorTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/PickupCancel.php b/src/Api/Endpoint/PickupCancel.php index 457581a0..2c5802ec 100644 --- a/src/Api/Endpoint/PickupCancel.php +++ b/src/Api/Endpoint/PickupCancel.php @@ -8,17 +8,15 @@ class PickupCancel extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint imple protected $version; /** * Using the CancelBy endpoint of the Pickup API, users can request cancellation of a UPS on-demand package pickup. When the PRN (pickup request number), transaction ID, and the transaction source are supplied as required parameters, the endpoint returns confirmation that the pickup has been cancelled. - * * @param string $cancelBy Valid Values: 01 = AccountNumber, 02 = PRN * @param string $version Version of API. Valid values: - v2403 - * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 - * @var string $Prn The pickup equest number (PRN) generated by + * @var string $Prn The pickup equest number (PRN) generated by UPS pickup system. Required if CancelBy = prn.Length 26 * } @@ -72,19 +70,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupCancelBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupCancelUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupCancelForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupCancelTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/PickupCreation.php b/src/Api/Endpoint/PickupCreation.php index fb36452b..b1af453d 100644 --- a/src/Api/Endpoint/PickupCreation.php +++ b/src/Api/Endpoint/PickupCreation.php @@ -7,13 +7,11 @@ class PickupCreation extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint imp protected $version; /** * Using the Pickup API, applications can schedule pickups, manage previously scheduled pickups, or cancel previously scheduled pickups. - * * @param string $version Version of the API. Valid values: - v2403 - - * @param \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -70,19 +68,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupCreationBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupCreationUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupCreationForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupCreationTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/PickupGetPoliticalDivision1List.php b/src/Api/Endpoint/PickupGetPoliticalDivision1List.php index d2f32fb2..5b5f555f 100644 --- a/src/Api/Endpoint/PickupGetPoliticalDivision1List.php +++ b/src/Api/Endpoint/PickupGetPoliticalDivision1List.php @@ -8,12 +8,10 @@ class PickupGetPoliticalDivision1List extends \ShipStream\Ups\Api\Runtime\Client protected $countrycode; /** * The countrycode endpoint of the Pickup API helps retrieve a list of political divisions (states) in a specified country or territory. - * * @param string $version Version of API. Valid values: - v1 - * @param string $countrycode Country or terrirtory for which the list will represent.Length 2 * @param array $headerParameters { @@ -69,19 +67,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupGetPoliticalDivision1ListBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupGetPoliticalDivision1ListUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupGetPoliticalDivision1ListForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupGetPoliticalDivision1ListTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/PickupGetServiceCenterFacilities.php b/src/Api/Endpoint/PickupGetServiceCenterFacilities.php index 20ef351d..94f9df03 100644 --- a/src/Api/Endpoint/PickupGetServiceCenterFacilities.php +++ b/src/Api/Endpoint/PickupGetServiceCenterFacilities.php @@ -7,13 +7,11 @@ class PickupGetServiceCenterFacilities extends \ShipStream\Ups\Api\Runtime\Clien protected $version; /** * The servicecenterlocations endpoint of the Pickup API helps retrieve service center information in a specified area - including location address, phone number, SLIC (Standard Location Identification Code), and hours of operation for pick-up and drop-off requests - * * @param string $version Version of API. Valid values: - v1 - - * @param \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -70,19 +68,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupGetServiceCenterFacilitiesBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupGetServiceCenterFacilitiesUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupGetServiceCenterFacilitiesForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupGetServiceCenterFacilitiesTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/PickupPendingStatus.php b/src/Api/Endpoint/PickupPendingStatus.php index 2185acb6..3a73216f 100644 --- a/src/Api/Endpoint/PickupPendingStatus.php +++ b/src/Api/Endpoint/PickupPendingStatus.php @@ -8,12 +8,10 @@ class PickupPendingStatus extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoin protected $pickuptype; /** * Using the GET operation of the pickuptype endpoint within the Pickup API, users can retrieve the status of shipments sent via UPS pickup service. The endpoint uses the account number as a required parameter and returns a status of received/dispatched/completed/incomplete/updated ETA, or cancelled. - * * @param string $version Version of API Valid values: - v1 - * @param string $pickuptype Type of pickup. Valid values: oncall smart @@ -21,7 +19,7 @@ class PickupPendingStatus extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoin * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 - * @var string $AccountNumber The specific account number that belongs to the + * @var string $AccountNumber The specific account number that belongs to the shipper.Length 6 or 10 * } */ @@ -74,19 +72,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupPendingStatusBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupPendingStatusUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupPendingStatusForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupPendingStatusTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/PickupRate.php b/src/Api/Endpoint/PickupRate.php index 73e7acfb..eaa52da5 100644 --- a/src/Api/Endpoint/PickupRate.php +++ b/src/Api/Endpoint/PickupRate.php @@ -8,17 +8,15 @@ class PickupRate extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint impleme protected $pickuptype; /** * Using the POST operation of the pickuptype endpoint within the Pickup API, users can request rates for UPS on-demand package pickup. The endpoint allows users to specify pickup details like address, date/time, and other options, and returns pricing information for booking that pickup. - * * @param string $version Version of the API. Valid values: - v1 - * @param string $pickuptype Type of pickup. Valid values: oncall smart both. Length 6 - * @param \ShipStream\Ups\Api\Model\PICKUPRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PICKUPRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -76,19 +74,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PICKUPResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupRateBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupRateUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupRateForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PickupRateTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/PreNotification.php b/src/Api/Endpoint/PreNotification.php index cee7349e..6a88b4fc 100644 --- a/src/Api/Endpoint/PreNotification.php +++ b/src/Api/Endpoint/PreNotification.php @@ -7,13 +7,11 @@ class PreNotification extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint im protected $version; /** * The Pre-Notification API allows customer applications to inform UPS operations of Dangerous Goods shipments as they are processed and will enter the UPS transportation network prior to an upload of manifest information at the end of the day. - * * @param string $version Version of API. Valid values: - v2 - - * @param \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -70,19 +68,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PreNotificationBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PreNotificationUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PreNotificationForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PreNotificationTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/ProcessSubscriptionTypeForTrackingNumber.php b/src/Api/Endpoint/ProcessSubscriptionTypeForTrackingNumber.php index d33a75dd..7a3851b8 100644 --- a/src/Api/Endpoint/ProcessSubscriptionTypeForTrackingNumber.php +++ b/src/Api/Endpoint/ProcessSubscriptionTypeForTrackingNumber.php @@ -6,22 +6,20 @@ class ProcessSubscriptionTypeForTrackingNumber extends \ShipStream\Ups\Api\Runti { protected $type; /** - * This endpoint takes a list of tracking numbers and creates a subscription for each. - Clients must provide the tracking numbers in the correct format. - - Upon success it should return: - - List of valid tracking number for which subscription created. - - List of invalid tracking number for which subscription not created. - - * - * @param string $type - 'Standard' - Represents a standard subscription type that provides near real time updates on tracking status. - - * @param null|\ShipStream\Ups\Api\Model\TrackSubsServiceRequest $requestBody - * @param array $headerParameters { - * @var string $transId An identifier unique to the request. - * @var string $transactionSrc Identifies the client/source application that is calling. - * } - */ + * This endpoint takes a list of tracking numbers and creates a subscription for each. + * Clients must provide the tracking numbers in the correct format. + * + * Upon success it should return: + * - List of valid tracking number for which subscription created. + * - List of invalid tracking number for which subscription not created. + * + * @param string $type - 'Standard' - Represents a standard subscription type that provides near real time updates on tracking status. + * @param null|\ShipStream\Ups\Api\Model\TrackSubsServiceRequest $requestBody + * @param array $headerParameters { + * @var string $transId An identifier unique to the request. + * @var string $transactionSrc Identifies the client/source application that is calling. + * } + */ public function __construct(string $type, ?\ShipStream\Ups\Api\Model\TrackSubsServiceRequest $requestBody = null, array $headerParameters = []) { $this->type = $type; @@ -76,25 +74,25 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\TrackSubsServiceResponse', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (404 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (404 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberNotFoundException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (405 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (405 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberMethodNotAllowedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ProcessSubscriptionTypeForTrackingNumberTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse', 'json'), $response); } if (500 === $status) { diff --git a/src/Api/Endpoint/PushToImageRepository.php b/src/Api/Endpoint/PushToImageRepository.php index ad7adc98..d2b1ee74 100644 --- a/src/Api/Endpoint/PushToImageRepository.php +++ b/src/Api/Endpoint/PushToImageRepository.php @@ -6,14 +6,12 @@ class PushToImageRepository extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpo { protected $version; /** - * The Paperless Document API web service allows the users to upload their own customized trade documents for customs clearance to Forms History. - * + * The Paperless Document API web service allows the users to upload their own customized trade documents for customs clearance to Forms History. * @param string $version Version of API Valid values: - v2 - - * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -72,19 +70,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PushToImageRepositoryBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PushToImageRepositoryUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PushToImageRepositoryForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\PushToImageRepositoryTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/QuantumView.php b/src/Api/Endpoint/QuantumView.php index f8b05ea9..5a3c08ea 100644 --- a/src/Api/Endpoint/QuantumView.php +++ b/src/Api/Endpoint/QuantumView.php @@ -7,13 +7,11 @@ class QuantumView extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint implem protected $version; /** * Get Quantum View Response - * * @param string $version Version of API. Valid values: - v2 - - * @param \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper $requestBody */ public function __construct(string $version, \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper $requestBody) { @@ -55,19 +53,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\QuantumViewBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\QuantumViewUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\QuantumViewForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\QuantumViewTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/Rate.php b/src/Api/Endpoint/Rate.php index 07f4ef24..245f1015 100644 --- a/src/Api/Endpoint/Rate.php +++ b/src/Api/Endpoint/Rate.php @@ -8,12 +8,10 @@ class Rate extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint implements \S protected $requestoption; /** * The Rating API is used when rating or shopping a shipment. - * * @param string $version Indicates Rate API to display the new release features in Rate API response based on Rate release. See the New section for the latest Rate release. Valid values: - v2403 - * @param string $requestoption Valid Values: - Rate = The server rates (The default Request option is Rate if a Request Option is not provided). - Shop = The server validates the shipment, and returns rates for all UPS products from the ShipFrom to the ShipTo addresses. @@ -21,8 +19,7 @@ class Rate extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint implements \S - Shoptimeintransit = The server validates the shipment, and returns rates and transit times for all UPS products from the ShipFrom to the ShipTo addresses. Rate is the only valid request option for UPS Ground Freight Pricing requests. - - * @param \ShipStream\Ups\Api\Model\RATERequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\RATERequestWrapper $requestBody * @param array $queryParameters { * @var string $additionalinfo Valid Values: timeintransit = The server rates with transit time information combined with requestoption in URL.Rate is the only valid request option for Ground Freight Pricing requests. Length 15 * } @@ -93,19 +90,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\RATEResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\RateBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\RateUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\RateForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\RateTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/RefreshToken.php b/src/Api/Endpoint/RefreshToken.php index 3d1af04b..473de19e 100644 --- a/src/Api/Endpoint/RefreshToken.php +++ b/src/Api/Endpoint/RefreshToken.php @@ -6,8 +6,7 @@ class RefreshToken extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint imple { /** * The /refresh endpoint is used to refresh an expired access token in order to continue accessing a UPS API on behalf of a user. The endpoint generates a new access/refresh token pair by exchanging a valid refresh token. A successful response returns new access and refresh tokens for ongoing API access without re-prompting the user. - * - * @param null|\ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody $requestBody + * @param null|\ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody $requestBody */ public function __construct(?\ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody $requestBody = null) { @@ -48,19 +47,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\RefreshTokenBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\RefreshTokenUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\RefreshTokenForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\RefreshTokenTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/Shipment.php b/src/Api/Endpoint/Shipment.php index 5e3941d1..24be2947 100644 --- a/src/Api/Endpoint/Shipment.php +++ b/src/Api/Endpoint/Shipment.php @@ -6,17 +6,15 @@ class Shipment extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint implement { protected $version; /** - * The Shipping API makes UPS shipping services available to client applications that communicate with UPS - using the Internet - * + * The Shipping API makes UPS shipping services available to client applications that communicate with UPS + * using the Internet * @param string $version Indicates Ship API to display the new release features in Ship API response based on Ship release. Valid values: - v2403 - - * @param \ShipStream\Ups\Api\Model\SHIPRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\SHIPRequestWrapper $requestBody * @param array $queryParameters { - * @var string $additionaladdressvalidation Valid Values: + * @var string $additionaladdressvalidation Valid Values: city = validation will include city.Length 15 * } * @param array $headerParameters { @@ -85,19 +83,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\SHIPResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ShipmentBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ShipmentUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ShipmentForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\ShipmentTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/TimeInTransit.php b/src/Api/Endpoint/TimeInTransit.php index e8297f67..35272e0e 100644 --- a/src/Api/Endpoint/TimeInTransit.php +++ b/src/Api/Endpoint/TimeInTransit.php @@ -6,19 +6,18 @@ class TimeInTransit extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint impl { protected $version; /** - * The Time In Transit API provides estimated delivery times for various UPS shipping services, between specified locations. - - Key Business Values: - - **Enhanced Customer Experience**: Allows businesses provide accurate delivery estimates to their customers, enhancing customer service. - - **Operational Efficiency**: Helps in logistics planning by providing transit times for different UPS services. - * - * @param string $version API Version - * @param \ShipStream\Ups\Api\Model\TimeInTransitRequest $requestBody - * @param array $headerParameters { - * @var string $transId An identifier unique to the request. Length 32 - * @var string $transactionSrc Identifies the clients/source application that is calling. Length 512 - * } - */ + * The Time In Transit API provides estimated delivery times for various UPS shipping services, between specified locations. + * + * Key Business Values: + * - **Enhanced Customer Experience**: Allows businesses provide accurate delivery estimates to their customers, enhancing customer service. + * - **Operational Efficiency**: Helps in logistics planning by providing transit times for different UPS services. + * @param string $version API Version + * @param \ShipStream\Ups\Api\Model\TimeInTransitRequest $requestBody + * @param array $headerParameters { + * @var string $transId An identifier unique to the request. Length 32 + * @var string $transactionSrc Identifies the clients/source application that is calling. Length 512 + * } + */ public function __construct(string $version, \ShipStream\Ups\Api\Model\TimeInTransitRequest $requestBody, array $headerParameters = []) { $this->version = $version; @@ -70,19 +69,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\TimeInTransitResponse', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\TimeInTransitBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\TimeInTransitUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\TimeInTransitForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\TimeInTransitTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/Upload.php b/src/Api/Endpoint/Upload.php index 4ae3e369..9f8fb13f 100644 --- a/src/Api/Endpoint/Upload.php +++ b/src/Api/Endpoint/Upload.php @@ -6,14 +6,12 @@ class Upload extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint implements { protected $version; /** - * The Paperless Document API web service allows the users to upload,delete and push to image repository their own customized trade documents for customs clearance to Forms History. - * + * The Paperless Document API web service allows the users to upload,delete and push to image repository their own customized trade documents for customs clearance to Forms History. * @param string $version Version of API Valid values: - v2 - - * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper $requestBody + * @param \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper $requestBody * @param array $headerParameters { * @var string $transId An identifier unique to the request. Length 32 * @var string $transactionSrc An identifier of the client/source application that is making the request.Length 512 @@ -72,19 +70,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\UploadBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\UploadUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\UploadForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\UploadTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Endpoint/VoidShipment.php b/src/Api/Endpoint/VoidShipment.php index 6970b7ac..09e3cab5 100644 --- a/src/Api/Endpoint/VoidShipment.php +++ b/src/Api/Endpoint/VoidShipment.php @@ -8,23 +8,21 @@ class VoidShipment extends \ShipStream\Ups\Api\Runtime\Client\BaseEndpoint imple protected $shipmentidentificationnumber; /** * The Void Shipping API is used to cancel the previously scheduled shipment - * * @param string $version API Version Valid values: - v2403 - * @param string $shipmentidentificationnumber The shipment's identification number Alpha-numeric. Must pass 1Z rules. Must be upper case. Length 18 * @param array $queryParameters { - * @var string $trackingnumber The package's tracking number. You may have + * @var string $trackingnumber The package's tracking number. You may have up to 20 different tracking numbers listed. - If more than one tracking number, pass this - value as: trackingnumber= + If more than one tracking number, pass this + value as: trackingnumber= ["1ZISUS010330563105","1ZISUS01033056310 8"] with a coma separating each number. - Alpha-numeric. Must pass 1Z rules. Must be + Alpha-numeric. Must pass 1Z rules. Must be upper case. Length 18 * } * @param array $headerParameters { @@ -90,19 +88,19 @@ protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $re { $status = $response->getStatusCode(); $body = (string) $response->getBody(); - if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (200 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { return $serializer->deserialize($body, 'ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper', 'json'); } - if (is_null($contentType) === false && (400 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (400 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\VoidShipmentBadRequestException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (401 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (401 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\VoidShipmentUnauthorizedException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (403 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (403 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\VoidShipmentForbiddenException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } - if (is_null($contentType) === false && (429 === $status && mb_strpos($contentType, 'application/json') !== false)) { + if (is_null($contentType) === false && (429 === $status && mb_strpos(strtolower($contentType), 'application/json') !== false)) { throw new \ShipStream\Ups\Api\Exception\VoidShipmentTooManyRequestsException($serializer->deserialize($body, 'ShipStream\Ups\Api\Model\ErrorResponse', 'json'), $response); } throw new \ShipStream\Ups\Api\Exception\UnexpectedStatusCodeException($status, $body); diff --git a/src/Api/Model/AcceptanceAuditPreCheckRequest.php b/src/Api/Model/AcceptanceAuditPreCheckRequest.php index b2542576..1b3cf711 100644 --- a/src/Api/Model/AcceptanceAuditPreCheckRequest.php +++ b/src/Api/Model/AcceptanceAuditPreCheckRequest.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $request; /** - * The time that the request was made from the originating system. UTC time down to milliseconds. - Example: 2016-07-14T12:01:33.999 - * - * @var string - */ + * The time that the request was made from the originating system. UTC time down to milliseconds. + * Example: 2016-07-14T12:01:33.999 + * + * @var string + */ protected $originRecordTransactionTimestamp; /** * Contains shipment information. @@ -54,11 +54,11 @@ public function setRequest(AcceptanceAuditPreCheckRequestRequest $request): self return $this; } /** - * The time that the request was made from the originating system. UTC time down to milliseconds. - Example: 2016-07-14T12:01:33.999 - * - * @return string - */ + * The time that the request was made from the originating system. UTC time down to milliseconds. + * Example: 2016-07-14T12:01:33.999 + * + * @return string + */ public function getOriginRecordTransactionTimestamp(): string { return $this->originRecordTransactionTimestamp; diff --git a/src/Api/Model/AcceptanceAuditPreCheckRequestRequest.php b/src/Api/Model/AcceptanceAuditPreCheckRequestRequest.php index 1d5e3823..00d44a93 100644 --- a/src/Api/Model/AcceptanceAuditPreCheckRequestRequest.php +++ b/src/Api/Model/AcceptanceAuditPreCheckRequestRequest.php @@ -13,12 +13,12 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Enables the user to specify optional processing. - - Currently, there is no optional process in Dangerous Goods Utility WS. - * - * @var string - */ + * Enables the user to specify optional processing. + * + * Currently, there is no optional process in Dangerous Goods Utility WS. + * + * @var string + */ protected $requestOption; /** * Not Used. @@ -33,12 +33,12 @@ public function isInitialized($property): bool */ protected $transactionReference; /** - * Enables the user to specify optional processing. - - Currently, there is no optional process in Dangerous Goods Utility WS. - * - * @return string - */ + * Enables the user to specify optional processing. + * + * Currently, there is no optional process in Dangerous Goods Utility WS. + * + * @return string + */ public function getRequestOption(): string { return $this->requestOption; diff --git a/src/Api/Model/AcceptanceAuditPreCheckRequestShipment.php b/src/Api/Model/AcceptanceAuditPreCheckRequestShipment.php index dde13179..47d92db6 100644 --- a/src/Api/Model/AcceptanceAuditPreCheckRequestShipment.php +++ b/src/Api/Model/AcceptanceAuditPreCheckRequestShipment.php @@ -37,18 +37,16 @@ public function isInitialized($property): bool */ protected $service; /** - * The Regulatory set associated with every regulated shipment. It must be same across the shipment. Not required when the CommodityRegulatedLevelCode is EQ. Valid values: ADR, 49CFR, IATA. - - ADR = Europe to Europe Ground Movement - 49CFR = HazMat regulated by US Dept. of Transportation within the U.S. or ground shipments to Canada - IATA= Worldwide Air movement. - * - * @var string - */ - protected $regulationSet; - /** + * The Regulatory set associated with every regulated shipment. It must be same across the shipment. Not required when the CommodityRegulatedLevelCode is EQ. Valid values: ADR, 49CFR, IATA. * + * ADR = Europe to Europe Ground Movement + * 49CFR = HazMat regulated by US Dept. of Transportation within the U.S. or ground shipments to Canada + * IATA= Worldwide Air movement. * + * @var string + */ + protected $regulationSet; + /** * @var list */ protected $package; @@ -141,14 +139,14 @@ public function setService(ShipmentService $service): self return $this; } /** - * The Regulatory set associated with every regulated shipment. It must be same across the shipment. Not required when the CommodityRegulatedLevelCode is EQ. Valid values: ADR, 49CFR, IATA. - - ADR = Europe to Europe Ground Movement - 49CFR = HazMat regulated by US Dept. of Transportation within the U.S. or ground shipments to Canada - IATA= Worldwide Air movement. - * - * @return string - */ + * The Regulatory set associated with every regulated shipment. It must be same across the shipment. Not required when the CommodityRegulatedLevelCode is EQ. Valid values: ADR, 49CFR, IATA. + * + * ADR = Europe to Europe Ground Movement + * 49CFR = HazMat regulated by US Dept. of Transportation within the U.S. or ground shipments to Canada + * IATA= Worldwide Air movement. + * + * @return string + */ public function getRegulationSet(): string { return $this->regulationSet; @@ -171,8 +169,6 @@ public function setRegulationSet(string $regulationSet): self return $this; } /** - * - * * @return list */ public function getPackage(): array @@ -180,8 +176,6 @@ public function getPackage(): array return $this->package; } /** - * - * * @param list $package * * @return self diff --git a/src/Api/Model/AcceptanceAuditPreCheckResponse.php b/src/Api/Model/AcceptanceAuditPreCheckResponse.php index 4eb6bb28..8814fbcb 100644 --- a/src/Api/Model/AcceptanceAuditPreCheckResponse.php +++ b/src/Api/Model/AcceptanceAuditPreCheckResponse.php @@ -31,18 +31,16 @@ public function isInitialized($property): bool */ protected $service; /** - * The Regulatory set associated with every regulated shipment. This is same Regulation set present in the request that is played back in response. Valid values: - ADR - 49CFR - IATA - TDG - * - * @var string - */ + * The Regulatory set associated with every regulated shipment. This is same Regulation set present in the request that is played back in response. Valid values: + * ADR + * 49CFR + * IATA + * TDG + * + * @var string + */ protected $regulationSet; /** - * - * * @var list */ protected $packageResults; @@ -113,14 +111,14 @@ public function setService(AcceptanceAuditPreCheckResponseService $service): sel return $this; } /** - * The Regulatory set associated with every regulated shipment. This is same Regulation set present in the request that is played back in response. Valid values: - ADR - 49CFR - IATA - TDG - * - * @return string - */ + * The Regulatory set associated with every regulated shipment. This is same Regulation set present in the request that is played back in response. Valid values: + * ADR + * 49CFR + * IATA + * TDG + * + * @return string + */ public function getRegulationSet(): string { return $this->regulationSet; @@ -143,8 +141,6 @@ public function setRegulationSet(string $regulationSet): self return $this; } /** - * - * * @return list */ public function getPackageResults(): array @@ -152,8 +148,6 @@ public function getPackageResults(): array return $this->packageResults; } /** - * - * * @param list $packageResults * * @return self diff --git a/src/Api/Model/AcceptanceAuditPreCheckResponsePackageResults.php b/src/Api/Model/AcceptanceAuditPreCheckResponsePackageResults.php index 52ae6423..75a74706 100644 --- a/src/Api/Model/AcceptanceAuditPreCheckResponsePackageResults.php +++ b/src/Api/Model/AcceptanceAuditPreCheckResponsePackageResults.php @@ -19,23 +19,21 @@ public function isInitialized($property): bool */ protected $packageIdentifier; /** - * Indicates if a package is crew accessible or not. Y = Package is crew accessible. - N = Package is not crew accessible. - * - * @var string - */ + * Indicates if a package is crew accessible or not. Y = Package is crew accessible. + * N = Package is not crew accessible. + * + * @var string + */ protected $accessibleIndicator; /** - * Indicates if origin country or territory is in the Europe Business Unit. - Y = Origin country or territory is in the Europe Business Unit. - N = Origin country or territory is not in the Europe Business Unit. - * - * @var string - */ + * Indicates if origin country or territory is in the Europe Business Unit. + * Y = Origin country or territory is in the Europe Business Unit. + * N = Origin country or territory is not in the Europe Business Unit. + * + * @var string + */ protected $europeBUIndicator; /** - * - * * @var list */ protected $chemicalRecordResults; @@ -62,11 +60,11 @@ public function setPackageIdentifier(string $packageIdentifier): self return $this; } /** - * Indicates if a package is crew accessible or not. Y = Package is crew accessible. - N = Package is not crew accessible. - * - * @return string - */ + * Indicates if a package is crew accessible or not. Y = Package is crew accessible. + * N = Package is not crew accessible. + * + * @return string + */ public function getAccessibleIndicator(): string { return $this->accessibleIndicator; @@ -86,12 +84,12 @@ public function setAccessibleIndicator(string $accessibleIndicator): self return $this; } /** - * Indicates if origin country or territory is in the Europe Business Unit. - Y = Origin country or territory is in the Europe Business Unit. - N = Origin country or territory is not in the Europe Business Unit. - * - * @return string - */ + * Indicates if origin country or territory is in the Europe Business Unit. + * Y = Origin country or territory is in the Europe Business Unit. + * N = Origin country or territory is not in the Europe Business Unit. + * + * @return string + */ public function getEuropeBUIndicator(): string { return $this->europeBUIndicator; @@ -112,8 +110,6 @@ public function setEuropeBUIndicator(string $europeBUIndicator): self return $this; } /** - * - * * @return list */ public function getChemicalRecordResults(): array @@ -121,8 +117,6 @@ public function getChemicalRecordResults(): array return $this->chemicalRecordResults; } /** - * - * * @param list $chemicalRecordResults * * @return self diff --git a/src/Api/Model/AcceptanceAuditPreCheckResponseResponse.php b/src/Api/Model/AcceptanceAuditPreCheckResponseResponse.php index 8d27b2e0..6e488d92 100644 --- a/src/Api/Model/AcceptanceAuditPreCheckResponseResponse.php +++ b/src/Api/Model/AcceptanceAuditPreCheckResponseResponse.php @@ -19,14 +19,10 @@ public function isInitialized($property): bool */ protected $responseStatus; /** - * - * * @var list */ protected $alert; /** - * - * * @var list */ protected $alertDetail; @@ -59,8 +55,6 @@ public function setResponseStatus(ResponseResponseStatus $responseStatus): self return $this; } /** - * - * * @return list */ public function getAlert(): array @@ -68,8 +62,6 @@ public function getAlert(): array return $this->alert; } /** - * - * * @param list $alert * * @return self @@ -81,8 +73,6 @@ public function setAlert(array $alert): self return $this; } /** - * - * * @return list */ public function getAlertDetail(): array @@ -90,8 +80,6 @@ public function getAlertDetail(): array return $this->alertDetail; } /** - * - * * @param list $alertDetail * * @return self diff --git a/src/Api/Model/AcceptanceAuditPreCheckShipmentPackage.php b/src/Api/Model/AcceptanceAuditPreCheckShipmentPackage.php index c4032e16..16aa93b0 100644 --- a/src/Api/Model/AcceptanceAuditPreCheckShipmentPackage.php +++ b/src/Api/Model/AcceptanceAuditPreCheckShipmentPackage.php @@ -37,38 +37,36 @@ public function isInitialized($property): bool */ protected $overPackedIndicator; /** - * The method of transport by which a shipment is approved to move and the regulations associated with that method. - - Only required when the CommodityRegulatedLevelCode is FR or LQ. Valid entries include: GND, CAO, and PAX. - * - * @var string - */ + * The method of transport by which a shipment is approved to move and the regulations associated with that method. + * + * Only required when the CommodityRegulatedLevelCode is FR or LQ. Valid entries include: GND, CAO, and PAX. + * + * @var string + */ protected $transportationMode; /** - * 24 Hour Emergency Phone Number of the shipper. - - Valid values for this field are (0) through (9) with trailing blanks. - - For numbers within the U.S., the layout is 1, area code, 7-digit number. For all other countries or territories the layout is country or territory code, area code, number. The Emergency Phone Number can only include the following allowable characters - “period “.”, dash “-“, plus sign “+” and conventional parentheses “(“ and “)”, “EXT or OPT” - - Required when (TDG regulation set and CommodityRegulatedLevelCode = FR) - - * - * @var string - */ + * 24 Hour Emergency Phone Number of the shipper. + * + * Valid values for this field are (0) through (9) with trailing blanks. + * + * For numbers within the U.S., the layout is 1, area code, 7-digit number. For all other countries or territories the layout is country or territory code, area code, number. The Emergency Phone Number can only include the following allowable characters + * “period “.”, dash “-“, plus sign “+” and conventional parentheses “(“ and “)”, “EXT or OPT” + * + * Required when (TDG regulation set and CommodityRegulatedLevelCode = FR) + * + * + * @var string + */ protected $emergencyPhone; /** - * The emergency information, contact name and/or contract number, required to be communicated when a call is placed to the EmergencyPhone. - - The information is required if there is a value in the EmergencyPhone field above and the shipment is with a US50 or PR origin and/or destination and the RegulationSet is IATA. - * - * @var string - */ - protected $emergencyContact; - /** + * The emergency information, contact name and/or contract number, required to be communicated when a call is placed to the EmergencyPhone. * + * The information is required if there is a value in the EmergencyPhone field above and the shipment is with a US50 or PR origin and/or destination and the RegulationSet is IATA. * + * @var string + */ + protected $emergencyContact; + /** * @var list */ protected $chemicalRecord; @@ -161,12 +159,12 @@ public function setOverPackedIndicator(string $overPackedIndicator): self return $this; } /** - * The method of transport by which a shipment is approved to move and the regulations associated with that method. - - Only required when the CommodityRegulatedLevelCode is FR or LQ. Valid entries include: GND, CAO, and PAX. - * - * @return string - */ + * The method of transport by which a shipment is approved to move and the regulations associated with that method. + * + * Only required when the CommodityRegulatedLevelCode is FR or LQ. Valid entries include: GND, CAO, and PAX. + * + * @return string + */ public function getTransportationMode(): string { return $this->transportationMode; @@ -187,18 +185,18 @@ public function setTransportationMode(string $transportationMode): self return $this; } /** - * 24 Hour Emergency Phone Number of the shipper. - - Valid values for this field are (0) through (9) with trailing blanks. - - For numbers within the U.S., the layout is 1, area code, 7-digit number. For all other countries or territories the layout is country or territory code, area code, number. The Emergency Phone Number can only include the following allowable characters - “period “.”, dash “-“, plus sign “+” and conventional parentheses “(“ and “)”, “EXT or OPT” - - Required when (TDG regulation set and CommodityRegulatedLevelCode = FR) - - * - * @return string - */ + * 24 Hour Emergency Phone Number of the shipper. + * + * Valid values for this field are (0) through (9) with trailing blanks. + * + * For numbers within the U.S., the layout is 1, area code, 7-digit number. For all other countries or territories the layout is country or territory code, area code, number. The Emergency Phone Number can only include the following allowable characters + * “period “.”, dash “-“, plus sign “+” and conventional parentheses “(“ and “)”, “EXT or OPT” + * + * Required when (TDG regulation set and CommodityRegulatedLevelCode = FR) + * + * + * @return string + */ public function getEmergencyPhone(): string { return $this->emergencyPhone; @@ -225,12 +223,12 @@ public function setEmergencyPhone(string $emergencyPhone): self return $this; } /** - * The emergency information, contact name and/or contract number, required to be communicated when a call is placed to the EmergencyPhone. - - The information is required if there is a value in the EmergencyPhone field above and the shipment is with a US50 or PR origin and/or destination and the RegulationSet is IATA. - * - * @return string - */ + * The emergency information, contact name and/or contract number, required to be communicated when a call is placed to the EmergencyPhone. + * + * The information is required if there is a value in the EmergencyPhone field above and the shipment is with a US50 or PR origin and/or destination and the RegulationSet is IATA. + * + * @return string + */ public function getEmergencyContact(): string { return $this->emergencyContact; @@ -251,8 +249,6 @@ public function setEmergencyContact(string $emergencyContact): self return $this; } /** - * - * * @return list */ public function getChemicalRecord(): array @@ -260,8 +256,6 @@ public function getChemicalRecord(): array return $this->chemicalRecord; } /** - * - * * @param list $chemicalRecord * * @return self diff --git a/src/Api/Model/AccessPointInformation.php b/src/Api/Model/AccessPointInformation.php index de2f2ae5..bbabaa7c 100644 --- a/src/Api/Model/AccessPointInformation.php +++ b/src/Api/Model/AccessPointInformation.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var string */ protected $pickupByDate; /** - * - * * @return string */ public function getPickupByDate(): string @@ -28,8 +24,6 @@ public function getPickupByDate(): string return $this->pickupByDate; } /** - * - * * @param string $pickupByDate * * @return self diff --git a/src/Api/Model/AccessPointInformationAccessPointStatus.php b/src/Api/Model/AccessPointInformationAccessPointStatus.php index ac5a7739..56704f42 100644 --- a/src/Api/Model/AccessPointInformationAccessPointStatus.php +++ b/src/Api/Model/AccessPointInformationAccessPointStatus.php @@ -13,14 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Valid status values are: - 01-Active-available - 06-Suspended - 07-Active-unavailable - 08-Terminated - * - * @var string - */ + * Valid status values are: + * 01-Active-available + * 06-Suspended + * 07-Active-unavailable + * 08-Terminated + * + * @var string + */ protected $code; /** * Description of status code. @@ -29,14 +29,14 @@ public function isInitialized($property): bool */ protected $description; /** - * Valid status values are: - 01-Active-available - 06-Suspended - 07-Active-unavailable - 08-Terminated - * - * @return string - */ + * Valid status values are: + * 01-Active-available + * 06-Suspended + * 07-Active-unavailable + * 08-Terminated + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/AccessPointInformationBusinessClassificationList.php b/src/Api/Model/AccessPointInformationBusinessClassificationList.php index 317a8296..2d4fe252 100644 --- a/src/Api/Model/AccessPointInformationBusinessClassificationList.php +++ b/src/Api/Model/AccessPointInformationBusinessClassificationList.php @@ -14,14 +14,18 @@ public function isInitialized($property): bool } /** * Container to hold Business classification of UPS access point. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $businessClassification; /** * Container to hold Business classification of UPS access point. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/AccessPointInformationPrivateNetworkList.php b/src/Api/Model/AccessPointInformationPrivateNetworkList.php index 2ccf8467..35dcf8f5 100644 --- a/src/Api/Model/AccessPointInformationPrivateNetworkList.php +++ b/src/Api/Model/AccessPointInformationPrivateNetworkList.php @@ -14,14 +14,18 @@ public function isInitialized($property): bool } /** * Container to hold the private network details. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $privateNetwork; /** * Container to hold the private network details. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/Activity.php b/src/Api/Model/Activity.php index a2cbdca3..5dbe1ce7 100644 --- a/src/Api/Model/Activity.php +++ b/src/Api/Model/Activity.php @@ -37,8 +37,6 @@ public function isInitialized($property): bool */ protected $gmtTime; /** - * - * * @var Location */ protected $location; @@ -143,8 +141,6 @@ public function setGmtTime(string $gmtTime): self return $this; } /** - * - * * @return Location */ public function getLocation(): Location @@ -152,8 +148,6 @@ public function getLocation(): Location return $this->location; } /** - * - * * @param Location $location * * @return self diff --git a/src/Api/Model/AlertDetailElementLevelInformation.php b/src/Api/Model/AlertDetailElementLevelInformation.php index 801cc455..2227f886 100644 --- a/src/Api/Model/AlertDetailElementLevelInformation.php +++ b/src/Api/Model/AlertDetailElementLevelInformation.php @@ -13,33 +13,35 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Define type of element in request. Possible values are - - - 'H' for the header details level, - - 'S' for the shipment level, - - 'P' for the package level, - - 'C' for the commodity level. - - * - * @var string - */ + * Define type of element in request. Possible values are - + * - 'H' for the header details level, + * - 'S' for the shipment level, + * - 'P' for the package level, + * - 'C' for the commodity level. + * + * + * @var string + */ protected $level; /** * Contains more information about the type of element. Returned if Level is 'P' or 'C'. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $elementIdentifier; /** - * Define type of element in request. Possible values are - - - 'H' for the header details level, - - 'S' for the shipment level, - - 'P' for the package level, - - 'C' for the commodity level. - - * - * @return string - */ + * Define type of element in request. Possible values are - + * - 'H' for the header details level, + * - 'S' for the shipment level, + * - 'P' for the package level, + * - 'C' for the commodity level. + * + * + * @return string + */ public function getLevel(): string { return $this->level; @@ -64,7 +66,9 @@ public function setLevel(string $level): self } /** * Contains more information about the type of element. Returned if Level is 'P' or 'C'. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/AlternateDeliveryAddressAddress.php b/src/Api/Model/AlternateDeliveryAddressAddress.php index 116b5dc2..75ca39b4 100644 --- a/src/Api/Model/AlternateDeliveryAddressAddress.php +++ b/src/Api/Model/AlternateDeliveryAddressAddress.php @@ -25,13 +25,13 @@ public function isInitialized($property): bool */ protected $city; /** - * Retail Location state or province code. Required for US or Canada. If destination is US or CA, then the value must be a valid US State/Canadian Province code. - - If the country or territory is Ireland, the StateProvinceCode will contain the county. - - * - * @var string - */ + * Retail Location state or province code. Required for US or Canada. If destination is US or CA, then the value must be a valid US State/Canadian Province code. + * + * If the country or territory is Ireland, the StateProvinceCode will contain the county. + * + * + * @var string + */ protected $stateProvinceCode; /** * If the Alternate Delivery Address country or territory is US or Puerto Rico, 5 or 9 digits are required. The character - may be used to separate the first five digits and the last four digits. If the Alternate Delivery Address country or territory is CA, then the postal code is required and must be 6 alphanumeric characters whose format is A#A#A# where A is an uppercase letter and # is a digit. Otherwise optional. For all other countries or territories the postal code is optional and must be no more than 9 alphanumeric characters long. @@ -90,13 +90,13 @@ public function setCity(string $city): self return $this; } /** - * Retail Location state or province code. Required for US or Canada. If destination is US or CA, then the value must be a valid US State/Canadian Province code. - - If the country or territory is Ireland, the StateProvinceCode will contain the county. - - * - * @return string - */ + * Retail Location state or province code. Required for US or Canada. If destination is US or CA, then the value must be a valid US State/Canadian Province code. + * + * If the country or territory is Ireland, the StateProvinceCode will contain the county. + * + * + * @return string + */ public function getStateProvinceCode(): string { return $this->stateProvinceCode; diff --git a/src/Api/Model/AlternateRatesResponseAlternateRateType.php b/src/Api/Model/AlternateRatesResponseAlternateRateType.php index 1afd0ca3..95d0f850 100644 --- a/src/Api/Model/AlternateRatesResponseAlternateRateType.php +++ b/src/Api/Model/AlternateRatesResponseAlternateRateType.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code for the Alternate Rate Type. - 1 = LTL only - 2 = GFP only - 3 = GFP and LTL - * - * @var string - */ + * Code for the Alternate Rate Type. + * 1 = LTL only + * 2 = GFP only + * 3 = GFP and LTL + * + * @var string + */ protected $code; /** * Alternate Rate Type description. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $description; /** - * Code for the Alternate Rate Type. - 1 = LTL only - 2 = GFP only - 3 = GFP and LTL - * - * @return string - */ + * Code for the Alternate Rate Type. + * 1 = LTL only + * 2 = GFP only + * 3 = GFP and LTL + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/AvailableLocationAttributesOptionCodeTransportationPickUpSchedule.php b/src/Api/Model/AvailableLocationAttributesOptionCodeTransportationPickUpSchedule.php index 3cfd6d6a..ef3c1833 100644 --- a/src/Api/Model/AvailableLocationAttributesOptionCodeTransportationPickUpSchedule.php +++ b/src/Api/Model/AvailableLocationAttributesOptionCodeTransportationPickUpSchedule.php @@ -14,14 +14,18 @@ public function isInitialized($property): bool } /** * Container to hold information regarding pickup day of the week and details. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $pickUp; /** * Container to hold information regarding pickup day of the week and details. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/AvailableLocationAttributesPickUpPickUpDetails.php b/src/Api/Model/AvailableLocationAttributesPickUpPickUpDetails.php index fbcdeb99..627e6f04 100644 --- a/src/Api/Model/AvailableLocationAttributesPickUpPickUpDetails.php +++ b/src/Api/Model/AvailableLocationAttributesPickUpPickUpDetails.php @@ -19,13 +19,13 @@ public function isInitialized($property): bool */ protected $pickUpTime; /** - * Indicates whether or not there is a pickup time for the specified day of the week. Valid values: - - True-there is a pickup time - - False-there is not a pickup time. - - * - * @var string - */ + * Indicates whether or not there is a pickup time for the specified day of the week. Valid values: + * - True-there is a pickup time + * - False-there is not a pickup time. + * + * + * @var string + */ protected $noPickUpIndicator; /** * Time of pickup in military format (HHMM) e.g. 0930, 1700, 1845 etc. with exception for midnight. For midnight the time will be returned as 0. @@ -50,13 +50,13 @@ public function setPickUpTime(string $pickUpTime): self return $this; } /** - * Indicates whether or not there is a pickup time for the specified day of the week. Valid values: - - True-there is a pickup time - - False-there is not a pickup time. - - * - * @return string - */ + * Indicates whether or not there is a pickup time for the specified day of the week. Valid values: + * - True-there is a pickup time + * - False-there is not a pickup time. + * + * + * @return string + */ public function getNoPickUpIndicator(): string { return $this->noPickUpIndicator; diff --git a/src/Api/Model/AvailableLocationAttributesTransportationPickUpSchedulePickUp.php b/src/Api/Model/AvailableLocationAttributesTransportationPickUpSchedulePickUp.php index 15a43264..70447c84 100644 --- a/src/Api/Model/AvailableLocationAttributesTransportationPickUpSchedulePickUp.php +++ b/src/Api/Model/AvailableLocationAttributesTransportationPickUpSchedulePickUp.php @@ -13,18 +13,18 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Day of the week for scheduled pickup. Valid values are: - - 1 - Sunday - - 2 - Monday - - 3 - Tuesday - - 4 - Wednesday - - 5 - Thursday - - 6 - Friday - - 7 - Saturday. - - * - * @var string - */ + * Day of the week for scheduled pickup. Valid values are: + * - 1 - Sunday + * - 2 - Monday + * - 3 - Tuesday + * - 4 - Wednesday + * - 5 - Thursday + * - 6 - Friday + * - 7 - Saturday. + * + * + * @var string + */ protected $dayOfWeek; /** * Container to hold information regarding pickup time and pickup availability indicator. @@ -33,18 +33,18 @@ public function isInitialized($property): bool */ protected $pickUpDetails; /** - * Day of the week for scheduled pickup. Valid values are: - - 1 - Sunday - - 2 - Monday - - 3 - Tuesday - - 4 - Wednesday - - 5 - Thursday - - 6 - Friday - - 7 - Saturday. - - * - * @return string - */ + * Day of the week for scheduled pickup. Valid values are: + * - 1 - Sunday + * - 2 - Monday + * - 3 - Tuesday + * - 4 - Wednesday + * - 5 - Thursday + * - 6 - Friday + * - 7 - Saturday. + * + * + * @return string + */ public function getDayOfWeek(): string { return $this->dayOfWeek; diff --git a/src/Api/Model/BillReceiverAddress.php b/src/Api/Model/BillReceiverAddress.php index 4ec902ce..4c87e307 100644 --- a/src/Api/Model/BillReceiverAddress.php +++ b/src/Api/Model/BillReceiverAddress.php @@ -13,32 +13,32 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The postal code for the UPS accounts pickup address. The pickup postal code was entered in the UPS system when the account was set-up. The postal code must be the same as the UPS Bill Receiver account number pickup address postal code. - - Required for United States and Canadian UPS accounts and/or if the UPS account pickup address has a postal code. - If the UPS accounts pickup country or territory is US or Puerto Rico, the postal code is 5 or 9 digits. - - The character - may be used to separate the first five digits and the last four digits. - - If the UPS accounts pickup country or territory is CA, the postal code is 6 alphanumeric characters whose format is A#A#A# where A is an uppercase letter and # is a digit - - * - * @var string - */ + * The postal code for the UPS accounts pickup address. The pickup postal code was entered in the UPS system when the account was set-up. The postal code must be the same as the UPS Bill Receiver account number pickup address postal code. + * + * Required for United States and Canadian UPS accounts and/or if the UPS account pickup address has a postal code. + * If the UPS accounts pickup country or territory is US or Puerto Rico, the postal code is 5 or 9 digits. + * + * The character - may be used to separate the first five digits and the last four digits. + * + * If the UPS accounts pickup country or territory is CA, the postal code is 6 alphanumeric characters whose format is A#A#A# where A is an uppercase letter and # is a digit + * + * + * @var string + */ protected $postalCode; /** - * The postal code for the UPS accounts pickup address. The pickup postal code was entered in the UPS system when the account was set-up. The postal code must be the same as the UPS Bill Receiver account number pickup address postal code. - - Required for United States and Canadian UPS accounts and/or if the UPS account pickup address has a postal code. - If the UPS accounts pickup country or territory is US or Puerto Rico, the postal code is 5 or 9 digits. - - The character - may be used to separate the first five digits and the last four digits. - - If the UPS accounts pickup country or territory is CA, the postal code is 6 alphanumeric characters whose format is A#A#A# where A is an uppercase letter and # is a digit - - * - * @return string - */ + * The postal code for the UPS accounts pickup address. The pickup postal code was entered in the UPS system when the account was set-up. The postal code must be the same as the UPS Bill Receiver account number pickup address postal code. + * + * Required for United States and Canadian UPS accounts and/or if the UPS account pickup address has a postal code. + * If the UPS accounts pickup country or territory is US or Puerto Rico, the postal code is 5 or 9 digits. + * + * The character - may be used to separate the first five digits and the last four digits. + * + * If the UPS accounts pickup country or territory is CA, the postal code is 6 alphanumeric characters whose format is A#A#A# where A is an uppercase letter and # is a digit + * + * + * @return string + */ public function getPostalCode(): string { return $this->postalCode; diff --git a/src/Api/Model/BillShipperCreditCard.php b/src/Api/Model/BillShipperCreditCard.php index 72d7559b..faba755b 100644 --- a/src/Api/Model/BillShipperCreditCard.php +++ b/src/Api/Model/BillShipperCreditCard.php @@ -13,25 +13,25 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Valid values: - - 01 = American Express - - 03 = Discover - - 04 = MasterCard - - 05 = Optima - - 06 = VISA - - 07 = Bravo - - 08 = Diners Club - - 13 = Dankort - - 14 = Hipercard - - 15 = JCB - - 17 = Postepay - - 18 = UnionPay/ExpressPay - - 19 = Visa Electron - - 20 = VPAY - - 21 = Carte Bleue - * - * @var string - */ + * Valid values: + * - 01 = American Express + * - 03 = Discover + * - 04 = MasterCard + * - 05 = Optima + * - 06 = VISA + * - 07 = Bravo + * - 08 = Diners Club + * - 13 = Dankort + * - 14 = Hipercard + * - 15 = JCB + * - 17 = Postepay + * - 18 = UnionPay/ExpressPay + * - 19 = Visa Electron + * - 20 = VPAY + * - 21 = Carte Bleue + * + * @var string + */ protected $type; /** * Credit Card number. @@ -58,25 +58,25 @@ public function isInitialized($property): bool */ protected $address; /** - * Valid values: - - 01 = American Express - - 03 = Discover - - 04 = MasterCard - - 05 = Optima - - 06 = VISA - - 07 = Bravo - - 08 = Diners Club - - 13 = Dankort - - 14 = Hipercard - - 15 = JCB - - 17 = Postepay - - 18 = UnionPay/ExpressPay - - 19 = Visa Electron - - 20 = VPAY - - 21 = Carte Bleue - * - * @return string - */ + * Valid values: + * - 01 = American Express + * - 03 = Discover + * - 04 = MasterCard + * - 05 = Optima + * - 06 = VISA + * - 07 = Bravo + * - 08 = Diners Club + * - 13 = Dankort + * - 14 = Hipercard + * - 15 = JCB + * - 17 = Postepay + * - 18 = UnionPay/ExpressPay + * - 19 = Visa Electron + * - 20 = VPAY + * - 21 = Carte Bleue + * + * @return string + */ public function getType(): string { return $this->type; diff --git a/src/Api/Model/BillThirdPartyAddress.php b/src/Api/Model/BillThirdPartyAddress.php index f2875e2a..b72e077b 100644 --- a/src/Api/Model/BillThirdPartyAddress.php +++ b/src/Api/Model/BillThirdPartyAddress.php @@ -13,18 +13,18 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The postal code for the UPS accounts pickup address. The pickup postal code is the one that was entered in the UPS system when the account was set-up. The postal code must be the same as the UPS Bill Third Party account number pickup address postal code. - - Required for United States and Canadian UPS accounts and/or if the UPS account pickup address has a postal code. - If the UPS accounts pickup country or territory is US or Puerto Rico, the postal code is 5 or 9 digits. - - The character - may be used to separate the first five digits and the last four digits. - - If the UPS accounts pickup country or territory is CA, the postal code is 6 alphanumeric characters whose format is A#A#A# where A is an uppercase letter and # is a digit. - - * - * @var string - */ + * The postal code for the UPS accounts pickup address. The pickup postal code is the one that was entered in the UPS system when the account was set-up. The postal code must be the same as the UPS Bill Third Party account number pickup address postal code. + * + * Required for United States and Canadian UPS accounts and/or if the UPS account pickup address has a postal code. + * If the UPS accounts pickup country or territory is US or Puerto Rico, the postal code is 5 or 9 digits. + * + * The character - may be used to separate the first five digits and the last four digits. + * + * If the UPS accounts pickup country or territory is CA, the postal code is 6 alphanumeric characters whose format is A#A#A# where A is an uppercase letter and # is a digit. + * + * + * @var string + */ protected $postalCode; /** * The country or territory code for the UPS accounts pickup address. @@ -33,18 +33,18 @@ public function isInitialized($property): bool */ protected $countryCode; /** - * The postal code for the UPS accounts pickup address. The pickup postal code is the one that was entered in the UPS system when the account was set-up. The postal code must be the same as the UPS Bill Third Party account number pickup address postal code. - - Required for United States and Canadian UPS accounts and/or if the UPS account pickup address has a postal code. - If the UPS accounts pickup country or territory is US or Puerto Rico, the postal code is 5 or 9 digits. - - The character - may be used to separate the first five digits and the last four digits. - - If the UPS accounts pickup country or territory is CA, the postal code is 6 alphanumeric characters whose format is A#A#A# where A is an uppercase letter and # is a digit. - - * - * @return string - */ + * The postal code for the UPS accounts pickup address. The pickup postal code is the one that was entered in the UPS system when the account was set-up. The postal code must be the same as the UPS Bill Third Party account number pickup address postal code. + * + * Required for United States and Canadian UPS accounts and/or if the UPS account pickup address has a postal code. + * If the UPS accounts pickup country or territory is US or Puerto Rico, the postal code is 5 or 9 digits. + * + * The character - may be used to separate the first five digits and the last four digits. + * + * If the UPS accounts pickup country or territory is CA, the postal code is 6 alphanumeric characters whose format is A#A#A# where A is an uppercase letter and # is a digit. + * + * + * @return string + */ public function getPostalCode(): string { return $this->postalCode; diff --git a/src/Api/Model/BrokerageFeeItems.php b/src/Api/Model/BrokerageFeeItems.php index 861983cc..4e524ee0 100644 --- a/src/Api/Model/BrokerageFeeItems.php +++ b/src/Api/Model/BrokerageFeeItems.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Brokerage charge name for this shipment. Possible Values: - 1. Entry Preparation Fee - 2. Disbursement Fee - 3. Additional Line Fee - * - * @var string - */ + * Brokerage charge name for this shipment. Possible Values: + * 1. Entry Preparation Fee + * 2. Disbursement Fee + * 3. Additional Line Fee + * + * @var string + */ protected $chargeName; /** * Fee amount for the brokerage charges. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $chargeAmount; /** - * Brokerage charge name for this shipment. Possible Values: - 1. Entry Preparation Fee - 2. Disbursement Fee - 3. Additional Line Fee - * - * @return string - */ + * Brokerage charge name for this shipment. Possible Values: + * 1. Entry Preparation Fee + * 2. Disbursement Fee + * 3. Additional Line Fee + * + * @return string + */ public function getChargeName(): string { return $this->chargeName; diff --git a/src/Api/Model/CN22FormCN22Content.php b/src/Api/Model/CN22FormCN22Content.php index cbef5005..179b9a3d 100644 --- a/src/Api/Model/CN22FormCN22Content.php +++ b/src/Api/Model/CN22FormCN22Content.php @@ -19,12 +19,12 @@ public function isInitialized($property): bool */ protected $cN22ContentQuantity; /** - * Detailed description of the content. - - If the combined MI package and CN22 label is requested, only the first 30 characters will appear on the combined label. Required if the CN22 form container is present. - * - * @var string - */ + * Detailed description of the content. + * + * If the combined MI package and CN22 label is requested, only the first 30 characters will appear on the combined label. Required if the CN22 form container is present. + * + * @var string + */ protected $cN22ContentDescription; /** * Container for CN22 content weight. @@ -79,12 +79,12 @@ public function setCN22ContentQuantity(string $cN22ContentQuantity): self return $this; } /** - * Detailed description of the content. - - If the combined MI package and CN22 label is requested, only the first 30 characters will appear on the combined label. Required if the CN22 form container is present. - * - * @return string - */ + * Detailed description of the content. + * + * If the combined MI package and CN22 label is requested, only the first 30 characters will appear on the combined label. Required if the CN22 form container is present. + * + * @return string + */ public function getCN22ContentDescription(): string { return $this->cN22ContentDescription; diff --git a/src/Api/Model/CODCODBillingOption.php b/src/Api/Model/CODCODBillingOption.php index 0b815cfa..681d50cc 100644 --- a/src/Api/Model/CODCODBillingOption.php +++ b/src/Api/Model/CODCODBillingOption.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The code associated with the COD billing option for the shipment service options. - Valid values: - 01 - Prepaid - 02 - Freight Collect - * - * @var string - */ + * The code associated with the COD billing option for the shipment service options. + * Valid values: + * 01 - Prepaid + * 02 - Freight Collect + * + * @var string + */ protected $code; /** * A text description of the code for the COD billing option associated with the shipment service options. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $description; /** - * The code associated with the COD billing option for the shipment service options. - Valid values: - 01 - Prepaid - 02 - Freight Collect - * - * @return string - */ + * The code associated with the COD billing option for the shipment service options. + * Valid values: + * 01 - Prepaid + * 02 - Freight Collect + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/CODCODPaymentMethod.php b/src/Api/Model/CODCODPaymentMethod.php index 9c173350..526450d5 100644 --- a/src/Api/Model/CODCODPaymentMethod.php +++ b/src/Api/Model/CODCODPaymentMethod.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The code associated with the COD payment method for the shipment service options. - Valid values: - M - Company Check - R - Certified Check - * - * @var string - */ + * The code associated with the COD payment method for the shipment service options. + * Valid values: + * M - Company Check + * R - Certified Check + * + * @var string + */ protected $code; /** * A text description of the code for the COD payment method associated with the shipment service options. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $description; /** - * The code associated with the COD payment method for the shipment service options. - Valid values: - M - Company Check - R - Certified Check - * - * @return string - */ + * The code associated with the COD payment method for the shipment service options. + * Valid values: + * M - Company Check + * R - Certified Check + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/CODCODValue.php b/src/Api/Model/CODCODValue.php index 8fc43e0b..698d1faa 100644 --- a/src/Api/Model/CODCODValue.php +++ b/src/Api/Model/CODCODValue.php @@ -13,31 +13,31 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * COD amount currency code type. - Valid value: USD � United States Dollar - * - * @var string - */ + * COD amount currency code type. + * Valid value: USD � United States Dollar + * + * @var string + */ protected $currencyCode; /** - * COD Amount. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @var string - */ + * COD Amount. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @var string + */ protected $monetaryValue; /** - * COD amount currency code type. - Valid value: USD � United States Dollar - * - * @return string - */ + * COD amount currency code type. + * Valid value: USD � United States Dollar + * + * @return string + */ public function getCurrencyCode(): string { return $this->currencyCode; @@ -57,17 +57,17 @@ public function setCurrencyCode(string $currencyCode): self return $this; } /** - * COD Amount. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @return string - */ + * COD Amount. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @return string + */ public function getMonetaryValue(): string { return $this->monetaryValue; diff --git a/src/Api/Model/CODTurnInPageImageImageFormat.php b/src/Api/Model/CODTurnInPageImageImageFormat.php index 2b432bbe..822c2014 100644 --- a/src/Api/Model/CODTurnInPageImageImageFormat.php +++ b/src/Api/Model/CODTurnInPageImageImageFormat.php @@ -13,16 +13,16 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Format code of the generated COD Turn In Page. - - Valid values: - - HTML = HTML format. - - Only HTML format is supported for COD Turn In Page. - - * - * @var string - */ + * Format code of the generated COD Turn In Page. + * + * Valid values: + * - HTML = HTML format. + * + * Only HTML format is supported for COD Turn In Page. + * + * + * @var string + */ protected $code; /** * Description of the form image format code. @@ -31,16 +31,16 @@ public function isInitialized($property): bool */ protected $description; /** - * Format code of the generated COD Turn In Page. - - Valid values: - - HTML = HTML format. - - Only HTML format is supported for COD Turn In Page. - - * - * @return string - */ + * Format code of the generated COD Turn In Page. + * + * Valid values: + * - HTML = HTML format. + * + * Only HTML format is supported for COD Turn In Page. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/CandidateAddressClassification.php b/src/Api/Model/CandidateAddressClassification.php index a50ab2ff..8191f01a 100644 --- a/src/Api/Model/CandidateAddressClassification.php +++ b/src/Api/Model/CandidateAddressClassification.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Contains the classification code of the address: - 0 - UnClassified - 1 - Commercial - 2 - Residential - * - * @var string - */ + * Contains the classification code of the address: + * 0 - UnClassified + * 1 - Commercial + * 2 - Residential + * + * @var string + */ protected $code; /** * Contains the text description of the address classification code (see Code above). @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $description; /** - * Contains the classification code of the address: - 0 - UnClassified - 1 - Commercial - 2 - Residential - * - * @return string - */ + * Contains the classification code of the address: + * 0 - UnClassified + * 1 - Commercial + * 2 - Residential + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ChargeCardCardAddress.php b/src/Api/Model/ChargeCardCardAddress.php index 80950940..7471ccb9 100644 --- a/src/Api/Model/ChargeCardCardAddress.php +++ b/src/Api/Model/ChargeCardCardAddress.php @@ -37,12 +37,12 @@ public function isInitialized($property): bool */ protected $postalCode; /** - * Charge card billing address country or territory code defined by ISO-3166. - - Upper-case two letter string. For Discover card it should be US. - * - * @var string - */ + * Charge card billing address country or territory code defined by ISO-3166. + * + * Upper-case two letter string. For Discover card it should be US. + * + * @var string + */ protected $countryCode; /** * Address Lines of the credit card billing address. Max of three address lines can be provided. @@ -133,12 +133,12 @@ public function setPostalCode(string $postalCode): self return $this; } /** - * Charge card billing address country or territory code defined by ISO-3166. - - Upper-case two letter string. For Discover card it should be US. - * - * @return string - */ + * Charge card billing address country or territory code defined by ISO-3166. + * + * Upper-case two letter string. For Discover card it should be US. + * + * @return string + */ public function getCountryCode(): string { return $this->countryCode; diff --git a/src/Api/Model/ChemicalDataChemicalDetail.php b/src/Api/Model/ChemicalDataChemicalDetail.php index fb0e852a..fadea39e 100644 --- a/src/Api/Model/ChemicalDataChemicalDetail.php +++ b/src/Api/Model/ChemicalDataChemicalDetail.php @@ -13,14 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The Regulatory set associated with every regulated shipment. Possible values are ADR, 49CFR, IATA. It will be returned if applies for a given chemical record. - - ADR = Europe to Europe Ground Movement - 49CFR = HazMat regulated by US Dept. of Transportation within the U.S. or ground shipments to Canada, - IATA= Worldwide Air movement. - * - * @var string - */ + * The Regulatory set associated with every regulated shipment. Possible values are ADR, 49CFR, IATA. It will be returned if applies for a given chemical record. + * + * ADR = Europe to Europe Ground Movement + * 49CFR = HazMat regulated by US Dept. of Transportation within the U.S. or ground shipments to Canada, + * IATA= Worldwide Air movement. + * + * @var string + */ protected $regulationSet; /** * This is the ID number (UN/NA/ID) for the specified commodity. UN/NA/ID Identification Number assigned to the specified regulated good. (Include the UN/NA/ID as part of the entry). It will be returned if applies for a given chemical record. @@ -53,100 +53,100 @@ public function isInitialized($property): bool */ protected $packagingGroupType; /** - * Indicates whether or not related entity requires special permit in order to transport the chemical. It will be returned if applies for a given chemical record. - - Valid values: - AIR - GND - BOTH - * - * @var string - */ + * Indicates whether or not related entity requires special permit in order to transport the chemical. It will be returned if applies for a given chemical record. + * + * Valid values: + * AIR + * GND + * BOTH + * + * @var string + */ protected $specialPermit; /** - * Indicates whether TechnicalName is required or not. It will be returned if applies for a given chemical record. - - Y = TechnicalName is required. - N = TechnicalName is not required. - * - * @var string - */ + * Indicates whether TechnicalName is required or not. It will be returned if applies for a given chemical record. + * + * Y = TechnicalName is required. + * N = TechnicalName is not required. + * + * @var string + */ protected $technicalNameRequiredIndicator; /** - * Indicates whether or not additional text is required for the shipping papers for the related entity. It will be returned if applies for a given chemical record. - - Valid values: - N = No, additional information for the shipping papers are not required. - Y = Yes, additional information for the shipping papers are required. - * - * @var string - */ + * Indicates whether or not additional text is required for the shipping papers for the related entity. It will be returned if applies for a given chemical record. + * + * Valid values: + * N = No, additional information for the shipping papers are not required. + * Y = Yes, additional information for the shipping papers are required. + * + * @var string + */ protected $additionalShippingInformationRequiredIndicator; /** - * Defines what is restricted to pass through a tunnel. EXAMPLES OF VALUES: - (B),(D),(E),(B/D),(B/E),(C,D),(C/E),(D/E),Blank - * - * @var string - */ + * Defines what is restricted to pass through a tunnel. EXAMPLES OF VALUES: + * (B),(D),(E),(B/D),(B/E),(C,D),(C/E),(D/E),Blank + * + * @var string + */ protected $tunnelRestrictionCode; /** - * Code representing a category of transportation, assigned by a regulation set for each regulated commodity. Each value of this category is associated with a multiplier that is used to calculate a value.This value is then used to determine the placarding to be place on the vehicle or container that holds the related regulated commodity EXAMPLES OF VALUES: - 0 = No multiplier - must use placarding - 1 = Use a multiplier of 50 - 2 = Use a multiplier of 3 - 3 = Use a multiplier of 1 - 4 = Use a multiplier of 0 - do not apply a placard - * - * @var string - */ + * Code representing a category of transportation, assigned by a regulation set for each regulated commodity. Each value of this category is associated with a multiplier that is used to calculate a value.This value is then used to determine the placarding to be place on the vehicle or container that holds the related regulated commodity EXAMPLES OF VALUES: + * 0 = No multiplier - must use placarding + * 1 = Use a multiplier of 50 + * 2 = Use a multiplier of 3 + * 3 = Use a multiplier of 1 + * 4 = Use a multiplier of 0 - do not apply a placard + * + * @var string + */ protected $transportCategory; /** - * The quantity that represents a multiplication factor used to calculate a value to determine the placarding to be place on the vehicle or container that holds the related regulated commodity. This factor is associated with a code value represented by Regulated Commodity Transport Category Code. EXAMPLES OF VALUES: - 0 = No multiplier - must use placarding - 1 = Use a multiplier of 50 - 2 = Use a multiplier of 3 - 3 = Use a multiplier of 1 - 4 = Use a multiplier of 0 - do not apply a placard - * - * @var string - */ + * The quantity that represents a multiplication factor used to calculate a value to determine the placarding to be place on the vehicle or container that holds the related regulated commodity. This factor is associated with a code value represented by Regulated Commodity Transport Category Code. EXAMPLES OF VALUES: + * 0 = No multiplier - must use placarding + * 1 = Use a multiplier of 50 + * 2 = Use a multiplier of 3 + * 3 = Use a multiplier of 1 + * 4 = Use a multiplier of 0 - do not apply a placard + * + * @var string + */ protected $transportMultiplierQuantity; /** - * ChannelTunnelAcceptedIndicator indicates if the chemical is accepted through channel tunnel or not Y= Accepted through channel tunnel - N=Not accepted through channel tunnel - * - * @var string - */ + * ChannelTunnelAcceptedIndicator indicates if the chemical is accepted through channel tunnel or not Y= Accepted through channel tunnel + * N=Not accepted through channel tunnel + * + * @var string + */ protected $channelTunnelAcceptedIndicator; /** - * A set of chemical records in HMMS that correspond to a sub-set of chemicals for a regulation set, or the entire set of chemicals for a regulation set EXAMPLES OF VALUES: - FREIGHT - TDG - IATA US DOMESTIC AIR - 49CFR - ADR - IATA INTERNATIONAL AIR - * - * @var string - */ + * A set of chemical records in HMMS that correspond to a sub-set of chemicals for a regulation set, or the entire set of chemicals for a regulation set EXAMPLES OF VALUES: + * FREIGHT + * TDG + * IATA US DOMESTIC AIR + * 49CFR + * ADR + * IATA INTERNATIONAL AIR + * + * @var string + */ protected $chemicalType; /** - * CAToUSShipmentAllowedIndicator indicates whether this checmical is allowed from CA to US - Applicable only for TDG shipments Y = Permitted from CA to US - N = Not Permitted from CA to US - * - * @var string - */ + * CAToUSShipmentAllowedIndicator indicates whether this checmical is allowed from CA to US + * Applicable only for TDG shipments Y = Permitted from CA to US + * N = Not Permitted from CA to US + * + * @var string + */ protected $cAToUSShipmentAllowedIndicator; /** - * The Regulatory set associated with every regulated shipment. Possible values are ADR, 49CFR, IATA. It will be returned if applies for a given chemical record. - - ADR = Europe to Europe Ground Movement - 49CFR = HazMat regulated by US Dept. of Transportation within the U.S. or ground shipments to Canada, - IATA= Worldwide Air movement. - * - * @return string - */ + * The Regulatory set associated with every regulated shipment. Possible values are ADR, 49CFR, IATA. It will be returned if applies for a given chemical record. + * + * ADR = Europe to Europe Ground Movement + * 49CFR = HazMat regulated by US Dept. of Transportation within the U.S. or ground shipments to Canada, + * IATA= Worldwide Air movement. + * + * @return string + */ public function getRegulationSet(): string { return $this->regulationSet; @@ -279,15 +279,15 @@ public function setPackagingGroupType(string $packagingGroupType): self return $this; } /** - * Indicates whether or not related entity requires special permit in order to transport the chemical. It will be returned if applies for a given chemical record. - - Valid values: - AIR - GND - BOTH - * - * @return string - */ + * Indicates whether or not related entity requires special permit in order to transport the chemical. It will be returned if applies for a given chemical record. + * + * Valid values: + * AIR + * GND + * BOTH + * + * @return string + */ public function getSpecialPermit(): string { return $this->specialPermit; @@ -311,13 +311,13 @@ public function setSpecialPermit(string $specialPermit): self return $this; } /** - * Indicates whether TechnicalName is required or not. It will be returned if applies for a given chemical record. - - Y = TechnicalName is required. - N = TechnicalName is not required. - * - * @return string - */ + * Indicates whether TechnicalName is required or not. It will be returned if applies for a given chemical record. + * + * Y = TechnicalName is required. + * N = TechnicalName is not required. + * + * @return string + */ public function getTechnicalNameRequiredIndicator(): string { return $this->technicalNameRequiredIndicator; @@ -339,14 +339,14 @@ public function setTechnicalNameRequiredIndicator(string $technicalNameRequiredI return $this; } /** - * Indicates whether or not additional text is required for the shipping papers for the related entity. It will be returned if applies for a given chemical record. - - Valid values: - N = No, additional information for the shipping papers are not required. - Y = Yes, additional information for the shipping papers are required. - * - * @return string - */ + * Indicates whether or not additional text is required for the shipping papers for the related entity. It will be returned if applies for a given chemical record. + * + * Valid values: + * N = No, additional information for the shipping papers are not required. + * Y = Yes, additional information for the shipping papers are required. + * + * @return string + */ public function getAdditionalShippingInformationRequiredIndicator(): string { return $this->additionalShippingInformationRequiredIndicator; @@ -369,11 +369,11 @@ public function setAdditionalShippingInformationRequiredIndicator(string $additi return $this; } /** - * Defines what is restricted to pass through a tunnel. EXAMPLES OF VALUES: - (B),(D),(E),(B/D),(B/E),(C,D),(C/E),(D/E),Blank - * - * @return string - */ + * Defines what is restricted to pass through a tunnel. EXAMPLES OF VALUES: + * (B),(D),(E),(B/D),(B/E),(C,D),(C/E),(D/E),Blank + * + * @return string + */ public function getTunnelRestrictionCode(): string { return $this->tunnelRestrictionCode; @@ -393,15 +393,15 @@ public function setTunnelRestrictionCode(string $tunnelRestrictionCode): self return $this; } /** - * Code representing a category of transportation, assigned by a regulation set for each regulated commodity. Each value of this category is associated with a multiplier that is used to calculate a value.This value is then used to determine the placarding to be place on the vehicle or container that holds the related regulated commodity EXAMPLES OF VALUES: - 0 = No multiplier - must use placarding - 1 = Use a multiplier of 50 - 2 = Use a multiplier of 3 - 3 = Use a multiplier of 1 - 4 = Use a multiplier of 0 - do not apply a placard - * - * @return string - */ + * Code representing a category of transportation, assigned by a regulation set for each regulated commodity. Each value of this category is associated with a multiplier that is used to calculate a value.This value is then used to determine the placarding to be place on the vehicle or container that holds the related regulated commodity EXAMPLES OF VALUES: + * 0 = No multiplier - must use placarding + * 1 = Use a multiplier of 50 + * 2 = Use a multiplier of 3 + * 3 = Use a multiplier of 1 + * 4 = Use a multiplier of 0 - do not apply a placard + * + * @return string + */ public function getTransportCategory(): string { return $this->transportCategory; @@ -425,15 +425,15 @@ public function setTransportCategory(string $transportCategory): self return $this; } /** - * The quantity that represents a multiplication factor used to calculate a value to determine the placarding to be place on the vehicle or container that holds the related regulated commodity. This factor is associated with a code value represented by Regulated Commodity Transport Category Code. EXAMPLES OF VALUES: - 0 = No multiplier - must use placarding - 1 = Use a multiplier of 50 - 2 = Use a multiplier of 3 - 3 = Use a multiplier of 1 - 4 = Use a multiplier of 0 - do not apply a placard - * - * @return string - */ + * The quantity that represents a multiplication factor used to calculate a value to determine the placarding to be place on the vehicle or container that holds the related regulated commodity. This factor is associated with a code value represented by Regulated Commodity Transport Category Code. EXAMPLES OF VALUES: + * 0 = No multiplier - must use placarding + * 1 = Use a multiplier of 50 + * 2 = Use a multiplier of 3 + * 3 = Use a multiplier of 1 + * 4 = Use a multiplier of 0 - do not apply a placard + * + * @return string + */ public function getTransportMultiplierQuantity(): string { return $this->transportMultiplierQuantity; @@ -457,11 +457,11 @@ public function setTransportMultiplierQuantity(string $transportMultiplierQuanti return $this; } /** - * ChannelTunnelAcceptedIndicator indicates if the chemical is accepted through channel tunnel or not Y= Accepted through channel tunnel - N=Not accepted through channel tunnel - * - * @return string - */ + * ChannelTunnelAcceptedIndicator indicates if the chemical is accepted through channel tunnel or not Y= Accepted through channel tunnel + * N=Not accepted through channel tunnel + * + * @return string + */ public function getChannelTunnelAcceptedIndicator(): string { return $this->channelTunnelAcceptedIndicator; @@ -481,16 +481,16 @@ public function setChannelTunnelAcceptedIndicator(string $channelTunnelAcceptedI return $this; } /** - * A set of chemical records in HMMS that correspond to a sub-set of chemicals for a regulation set, or the entire set of chemicals for a regulation set EXAMPLES OF VALUES: - FREIGHT - TDG - IATA US DOMESTIC AIR - 49CFR - ADR - IATA INTERNATIONAL AIR - * - * @return string - */ + * A set of chemical records in HMMS that correspond to a sub-set of chemicals for a regulation set, or the entire set of chemicals for a regulation set EXAMPLES OF VALUES: + * FREIGHT + * TDG + * IATA US DOMESTIC AIR + * 49CFR + * ADR + * IATA INTERNATIONAL AIR + * + * @return string + */ public function getChemicalType(): string { return $this->chemicalType; @@ -515,12 +515,12 @@ public function setChemicalType(string $chemicalType): self return $this; } /** - * CAToUSShipmentAllowedIndicator indicates whether this checmical is allowed from CA to US - Applicable only for TDG shipments Y = Permitted from CA to US - N = Not Permitted from CA to US - * - * @return string - */ + * CAToUSShipmentAllowedIndicator indicates whether this checmical is allowed from CA to US + * Applicable only for TDG shipments Y = Permitted from CA to US + * N = Not Permitted from CA to US + * + * @return string + */ public function getCAToUSShipmentAllowedIndicator(): string { return $this->cAToUSShipmentAllowedIndicator; diff --git a/src/Api/Model/ChemicalDataPackageQuantityLimitDetail.php b/src/Api/Model/ChemicalDataPackageQuantityLimitDetail.php index 2c33ead1..e490485c 100644 --- a/src/Api/Model/ChemicalDataPackageQuantityLimitDetail.php +++ b/src/Api/Model/ChemicalDataPackageQuantityLimitDetail.php @@ -13,19 +13,19 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The type of package quantity limit. It will be returned if applies for a given chemical record. - - Valid values: - CAO - Cargo Aircraft Only - LTD QTY - Limited Quantity - GND - Ground - PAX - Passenger Aircraft - COMAT CAO - Company Material CAO - COMAT LTD - Company Material LTD - COMAT PAX - Company Material PAX - * - * @var string - */ + * The type of package quantity limit. It will be returned if applies for a given chemical record. + * + * Valid values: + * CAO - Cargo Aircraft Only + * LTD QTY - Limited Quantity + * GND - Ground + * PAX - Passenger Aircraft + * COMAT CAO - Company Material CAO + * COMAT LTD - Company Material LTD + * COMAT PAX - Company Material PAX + * + * @var string + */ protected $packageQuantityLimitTypeCode; /** * The numerical value of the mass capacity of the regulated good. It will be returned if applies for a given chemical record. @@ -34,11 +34,11 @@ public function isInitialized($property): bool */ protected $quantity; /** - * The unit of measure used for the mass capacity of the regulated good. - It will be returned if applies for a given chemical record. Example: ml, L, g, mg, kg, cylinder, pound, pint, quart, gallon, ounce etc. - * - * @var string - */ + * The unit of measure used for the mass capacity of the regulated good. + * It will be returned if applies for a given chemical record. Example: ml, L, g, mg, kg, cylinder, pound, pint, quart, gallon, ounce etc. + * + * @var string + */ protected $uOM; /** * The packing instructions related to the chemical record. It will be returned if applies for a given chemical record. @@ -47,19 +47,19 @@ public function isInitialized($property): bool */ protected $packagingInstructionCode; /** - * The type of package quantity limit. It will be returned if applies for a given chemical record. - - Valid values: - CAO - Cargo Aircraft Only - LTD QTY - Limited Quantity - GND - Ground - PAX - Passenger Aircraft - COMAT CAO - Company Material CAO - COMAT LTD - Company Material LTD - COMAT PAX - Company Material PAX - * - * @return string - */ + * The type of package quantity limit. It will be returned if applies for a given chemical record. + * + * Valid values: + * CAO - Cargo Aircraft Only + * LTD QTY - Limited Quantity + * GND - Ground + * PAX - Passenger Aircraft + * COMAT CAO - Company Material CAO + * COMAT LTD - Company Material LTD + * COMAT PAX - Company Material PAX + * + * @return string + */ public function getPackageQuantityLimitTypeCode(): string { return $this->packageQuantityLimitTypeCode; @@ -109,11 +109,11 @@ public function setQuantity(string $quantity): self return $this; } /** - * The unit of measure used for the mass capacity of the regulated good. - It will be returned if applies for a given chemical record. Example: ml, L, g, mg, kg, cylinder, pound, pint, quart, gallon, ounce etc. - * - * @return string - */ + * The unit of measure used for the mass capacity of the regulated good. + * It will be returned if applies for a given chemical record. Example: ml, L, g, mg, kg, cylinder, pound, pint, quart, gallon, ounce etc. + * + * @return string + */ public function getUOM(): string { return $this->uOM; diff --git a/src/Api/Model/ChemicalReferenceDataRequestRequest.php b/src/Api/Model/ChemicalReferenceDataRequestRequest.php index e70cd078..6f8dbb45 100644 --- a/src/Api/Model/ChemicalReferenceDataRequestRequest.php +++ b/src/Api/Model/ChemicalReferenceDataRequestRequest.php @@ -13,22 +13,20 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $requestOption; /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. - - Format: YYMM = Year and month of the release. - - Example: 1801 = 2018 January Supported values: 1801 - * - * @var string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. + * + * Format: YYMM = Year and month of the release. + * + * Example: 1801 = 2018 January Supported values: 1801 + * + * @var string + */ protected $subVersion; /** * TransactionReference identifies transactions between client and server. @@ -37,8 +35,6 @@ public function isInitialized($property): bool */ protected $transactionReference; /** - * - * * @return list */ public function getRequestOption(): array @@ -46,8 +42,6 @@ public function getRequestOption(): array return $this->requestOption; } /** - * - * * @param list $requestOption * * @return self @@ -59,16 +53,16 @@ public function setRequestOption(array $requestOption): self return $this; } /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. - - Format: YYMM = Year and month of the release. - - Example: 1801 = 2018 January Supported values: 1801 - * - * @return string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. + * + * Format: YYMM = Year and month of the release. + * + * Example: 1801 = 2018 January Supported values: 1801 + * + * @return string + */ public function getSubVersion(): string { return $this->subVersion; diff --git a/src/Api/Model/ChemicalReferenceDataResponse.php b/src/Api/Model/ChemicalReferenceDataResponse.php index e8078e40..2403a19f 100644 --- a/src/Api/Model/ChemicalReferenceDataResponse.php +++ b/src/Api/Model/ChemicalReferenceDataResponse.php @@ -19,8 +19,6 @@ public function isInitialized($property): bool */ protected $response; /** - * - * * @var list */ protected $chemicalData; @@ -47,8 +45,6 @@ public function setResponse(ChemicalReferenceDataResponseResponse $response): se return $this; } /** - * - * * @return list */ public function getChemicalData(): array @@ -56,8 +52,6 @@ public function getChemicalData(): array return $this->chemicalData; } /** - * - * * @param list $chemicalData * * @return self diff --git a/src/Api/Model/ChemicalReferenceDataResponseChemicalData.php b/src/Api/Model/ChemicalReferenceDataResponseChemicalData.php index ca9269a9..b3cee9ac 100644 --- a/src/Api/Model/ChemicalReferenceDataResponseChemicalData.php +++ b/src/Api/Model/ChemicalReferenceDataResponseChemicalData.php @@ -25,8 +25,6 @@ public function isInitialized($property): bool */ protected $properShippingNameDetail; /** - * - * * @var list */ protected $packageQuantityLimitDetail; @@ -75,8 +73,6 @@ public function setProperShippingNameDetail(ChemicalDataProperShippingNameDetail return $this; } /** - * - * * @return list */ public function getPackageQuantityLimitDetail(): array @@ -84,8 +80,6 @@ public function getPackageQuantityLimitDetail(): array return $this->packageQuantityLimitDetail; } /** - * - * * @param list $packageQuantityLimitDetail * * @return self diff --git a/src/Api/Model/ChemicalReferenceDataResponseResponse.php b/src/Api/Model/ChemicalReferenceDataResponseResponse.php index 86347887..ebc0e386 100644 --- a/src/Api/Model/ChemicalReferenceDataResponseResponse.php +++ b/src/Api/Model/ChemicalReferenceDataResponseResponse.php @@ -19,8 +19,6 @@ public function isInitialized($property): bool */ protected $responseStatus; /** - * - * * @var list */ protected $alert; @@ -53,8 +51,6 @@ public function setResponseStatus(ResponseResponseStatus $responseStatus): self return $this; } /** - * - * * @return list */ public function getAlert(): array @@ -62,8 +58,6 @@ public function getAlert(): array return $this->alert; } /** - * - * * @param list $alert * * @return self diff --git a/src/Api/Model/CommodityCommodityValue.php b/src/Api/Model/CommodityCommodityValue.php index 8ad27a4e..5edf5c3f 100644 --- a/src/Api/Model/CommodityCommodityValue.php +++ b/src/Api/Model/CommodityCommodityValue.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Commodity value currency code type. - Required when value of commodity is entered. - Valid value: - USD - United States Dollar - * - * @var string - */ + * Commodity value currency code type. + * Required when value of commodity is entered. + * Valid value: + * USD - United States Dollar + * + * @var string + */ protected $currencyCode; /** * Commodity value amount. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $monetaryValue; /** - * Commodity value currency code type. - Required when value of commodity is entered. - Valid value: - USD - United States Dollar - * - * @return string - */ + * Commodity value currency code type. + * Required when value of commodity is entered. + * Valid value: + * USD - United States Dollar + * + * @return string + */ public function getCurrencyCode(): string { return $this->currencyCode; diff --git a/src/Api/Model/CommodityDimensions.php b/src/Api/Model/CommodityDimensions.php index 2aac6109..162a9d38 100644 --- a/src/Api/Model/CommodityDimensions.php +++ b/src/Api/Model/CommodityDimensions.php @@ -19,31 +19,31 @@ public function isInitialized($property): bool */ protected $unitOfMeasurement; /** - * The length of the line item used to determine dimensional weight. - Valid characters: 0-9 and "." (Decimal point). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @var string - */ + * The length of the line item used to determine dimensional weight. + * Valid characters: 0-9 and "." (Decimal point). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @var string + */ protected $length; /** - * The width of the line item used to determine dimensional weight. - Format: See Length Description. - * - * @var string - */ + * The width of the line item used to determine dimensional weight. + * Format: See Length Description. + * + * @var string + */ protected $width; /** - * The height of the line item used to determine dimensional weight. - Format: See Length Description. - * - * @var string - */ + * The height of the line item used to determine dimensional weight. + * Format: See Length Description. + * + * @var string + */ protected $height; /** * UnitOfMeasurement Container. @@ -68,17 +68,17 @@ public function setUnitOfMeasurement(DimensionsUnitOfMeasurement $unitOfMeasurem return $this; } /** - * The length of the line item used to determine dimensional weight. - Valid characters: 0-9 and "." (Decimal point). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @return string - */ + * The length of the line item used to determine dimensional weight. + * Valid characters: 0-9 and "." (Decimal point). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @return string + */ public function getLength(): string { return $this->length; @@ -104,11 +104,11 @@ public function setLength(string $length): self return $this; } /** - * The width of the line item used to determine dimensional weight. - Format: See Length Description. - * - * @return string - */ + * The width of the line item used to determine dimensional weight. + * Format: See Length Description. + * + * @return string + */ public function getWidth(): string { return $this->width; @@ -128,11 +128,11 @@ public function setWidth(string $width): self return $this; } /** - * The height of the line item used to determine dimensional weight. - Format: See Length Description. - * - * @return string - */ + * The height of the line item used to determine dimensional weight. + * Format: See Length Description. + * + * @return string + */ public function getHeight(): string { return $this->height; diff --git a/src/Api/Model/CommodityNMFCCommodity.php b/src/Api/Model/CommodityNMFCCommodity.php index c8bc094f..27f8943a 100644 --- a/src/Api/Model/CommodityNMFCCommodity.php +++ b/src/Api/Model/CommodityNMFCCommodity.php @@ -13,28 +13,28 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * National Motor Freight Classification Commodity prime code. - Must be 6 digits representing the NMFC prime code. - This field is required if NMFCCommodity/SubCode is supplied. - * - * @var string - */ + * National Motor Freight Classification Commodity prime code. + * Must be 6 digits representing the NMFC prime code. + * This field is required if NMFCCommodity/SubCode is supplied. + * + * @var string + */ protected $primeCode; /** - * National Motor Freight Classification Commodity sub code. - Must be 2 digits representing the NMFC sub code. - If this field is supplied, NMFCCommodity/PrimeCode also has to be supplied. - * - * @var string - */ + * National Motor Freight Classification Commodity sub code. + * Must be 2 digits representing the NMFC sub code. + * If this field is supplied, NMFCCommodity/PrimeCode also has to be supplied. + * + * @var string + */ protected $subCode; /** - * National Motor Freight Classification Commodity prime code. - Must be 6 digits representing the NMFC prime code. - This field is required if NMFCCommodity/SubCode is supplied. - * - * @return string - */ + * National Motor Freight Classification Commodity prime code. + * Must be 6 digits representing the NMFC prime code. + * This field is required if NMFCCommodity/SubCode is supplied. + * + * @return string + */ public function getPrimeCode(): string { return $this->primeCode; @@ -55,12 +55,12 @@ public function setPrimeCode(string $primeCode): self return $this; } /** - * National Motor Freight Classification Commodity sub code. - Must be 2 digits representing the NMFC sub code. - If this field is supplied, NMFCCommodity/PrimeCode also has to be supplied. - * - * @return string - */ + * National Motor Freight Classification Commodity sub code. + * Must be 2 digits representing the NMFC sub code. + * If this field is supplied, NMFCCommodity/PrimeCode also has to be supplied. + * + * @return string + */ public function getSubCode(): string { return $this->subCode; diff --git a/src/Api/Model/CommodityPackagingType.php b/src/Api/Model/CommodityPackagingType.php index de6d9c62..01b14319 100644 --- a/src/Api/Model/CommodityPackagingType.php +++ b/src/Api/Model/CommodityPackagingType.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code associated with the Packaging Type. - Refer to Packaging Types in the Appendix for valid values. - * - * @var string - */ + * Code associated with the Packaging Type. + * Refer to Packaging Types in the Appendix for valid values. + * + * @var string + */ protected $code; /** * Description for the code associated with the Packaging Type. @@ -26,11 +26,11 @@ public function isInitialized($property): bool */ protected $description; /** - * Code associated with the Packaging Type. - Refer to Packaging Types in the Appendix for valid values. - * - * @return string - */ + * Code associated with the Packaging Type. + * Refer to Packaging Types in the Appendix for valid values. + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ContactsForwardAgent.php b/src/Api/Model/ContactsForwardAgent.php index 32e3f887..2bd33693 100644 --- a/src/Api/Model/ContactsForwardAgent.php +++ b/src/Api/Model/ContactsForwardAgent.php @@ -19,14 +19,14 @@ public function isInitialized($property): bool */ protected $companyName; /** - * Tax ID of the Forwarding agent. - Valid Values: (Below values are applicable for EEIFilingOption Code =3) - 94-308351500 - 13-168669100 - Applicable for EEI form only. - * - * @var string - */ + * Tax ID of the Forwarding agent. + * Valid Values: (Below values are applicable for EEIFilingOption Code =3) + * 94-308351500 + * 13-168669100 + * Applicable for EEI form only. + * + * @var string + */ protected $taxIdentificationNumber; /** * Address information of the Forwarding agent. Applicable for EEI form only. @@ -57,14 +57,14 @@ public function setCompanyName(string $companyName): self return $this; } /** - * Tax ID of the Forwarding agent. - Valid Values: (Below values are applicable for EEIFilingOption Code =3) - 94-308351500 - 13-168669100 - Applicable for EEI form only. - * - * @return string - */ + * Tax ID of the Forwarding agent. + * Valid Values: (Below values are applicable for EEIFilingOption Code =3) + * 94-308351500 + * 13-168669100 + * Applicable for EEI form only. + * + * @return string + */ public function getTaxIdentificationNumber(): string { return $this->taxIdentificationNumber; diff --git a/src/Api/Model/ContactsProducer.php b/src/Api/Model/ContactsProducer.php index e7e60719..1ba91a36 100644 --- a/src/Api/Model/ContactsProducer.php +++ b/src/Api/Model/ContactsProducer.php @@ -13,16 +13,16 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The text associated with the code will be printed in the producer section instead of producer contact information. - Use attached List if more than one producer's good is included on the Certificate, attach a list of additional producers, including the legal name, address (including country or territory), and legal tax identification number, cross-referenced to the goods described in the Description of Goods field. Applies to NAFTA CO. - Valid values: - 01 - AVAILABLE TO CUSTOMS UPON REQUEST - 02 - SAME AS EXPORTER - 03 - ATTACHED LIST - 04 - UNKNOWN - * - * @var string - */ + * The text associated with the code will be printed in the producer section instead of producer contact information. + * Use attached List if more than one producer's good is included on the Certificate, attach a list of additional producers, including the legal name, address (including country or territory), and legal tax identification number, cross-referenced to the goods described in the Description of Goods field. Applies to NAFTA CO. + * Valid values: + * 01 - AVAILABLE TO CUSTOMS UPON REQUEST + * 02 - SAME AS EXPORTER + * 03 - ATTACHED LIST + * 04 - UNKNOWN + * + * @var string + */ protected $option; /** * Company Name or the Individual name of the Producer. Applies to NAFTA CO. Only applicable when producer option is empty or not present. Conditionally required for: NAFTA CO, when Producer option is not specified. @@ -61,16 +61,16 @@ public function isInitialized($property): bool */ protected $eMailAddress; /** - * The text associated with the code will be printed in the producer section instead of producer contact information. - Use attached List if more than one producer's good is included on the Certificate, attach a list of additional producers, including the legal name, address (including country or territory), and legal tax identification number, cross-referenced to the goods described in the Description of Goods field. Applies to NAFTA CO. - Valid values: - 01 - AVAILABLE TO CUSTOMS UPON REQUEST - 02 - SAME AS EXPORTER - 03 - ATTACHED LIST - 04 - UNKNOWN - * - * @return string - */ + * The text associated with the code will be printed in the producer section instead of producer contact information. + * Use attached List if more than one producer's good is included on the Certificate, attach a list of additional producers, including the legal name, address (including country or territory), and legal tax identification number, cross-referenced to the goods described in the Description of Goods field. Applies to NAFTA CO. + * Valid values: + * 01 - AVAILABLE TO CUSTOMS UPON REQUEST + * 02 - SAME AS EXPORTER + * 03 - ATTACHED LIST + * 04 - UNKNOWN + * + * @return string + */ public function getOption(): string { return $this->option; diff --git a/src/Api/Model/ControlLogReceiptImageFormat.php b/src/Api/Model/ControlLogReceiptImageFormat.php index 87676873..69771462 100644 --- a/src/Api/Model/ControlLogReceiptImageFormat.php +++ b/src/Api/Model/ControlLogReceiptImageFormat.php @@ -13,17 +13,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code for the type of Graphic Image for the High Value Report. - - Valid values: - - EPL = EPL2 (when user requests label in EPL2 format) - - SPL = SPL (when user requests label in SPL format) - - ZPL = ZPL (when user requests label in ZPL format) - - HTML= HTML (when user requests label in HTML format) - - * - * @var string - */ + * Code for the type of Graphic Image for the High Value Report. + * + * Valid values: + * - EPL = EPL2 (when user requests label in EPL2 format) + * - SPL = SPL (when user requests label in SPL format) + * - ZPL = ZPL (when user requests label in ZPL format) + * - HTML= HTML (when user requests label in HTML format) + * + * + * @var string + */ protected $code; /** * Description of the format code. @@ -32,17 +32,17 @@ public function isInitialized($property): bool */ protected $description; /** - * Code for the type of Graphic Image for the High Value Report. - - Valid values: - - EPL = EPL2 (when user requests label in EPL2 format) - - SPL = SPL (when user requests label in SPL format) - - ZPL = ZPL (when user requests label in ZPL format) - - HTML= HTML (when user requests label in HTML format) - - * - * @return string - */ + * Code for the type of Graphic Image for the High Value Report. + * + * Valid values: + * - EPL = EPL2 (when user requests label in EPL2 format) + * - SPL = SPL (when user requests label in SPL format) + * - ZPL = ZPL (when user requests label in ZPL format) + * - HTML= HTML (when user requests label in HTML format) + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/DCRAvailabilityUnavailableReason.php b/src/Api/Model/DCRAvailabilityUnavailableReason.php index 1cf23e7e..874465ea 100644 --- a/src/Api/Model/DCRAvailabilityUnavailableReason.php +++ b/src/Api/Model/DCRAvailabilityUnavailableReason.php @@ -13,14 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code for DCR/DCO unavailability. Valid values: - 01-Temporarily Unavailable - 02-Location Full - 03-Unavailable - 04-Weather - * - * @var string - */ + * Code for DCR/DCO unavailability. Valid values: + * 01-Temporarily Unavailable + * 02-Location Full + * 03-Unavailable + * 04-Weather + * + * @var string + */ protected $code; /** * Description for DCR/ DCO unavailability. @@ -29,14 +29,14 @@ public function isInitialized($property): bool */ protected $description; /** - * Code for DCR/DCO unavailability. Valid values: - 01-Temporarily Unavailable - 02-Location Full - 03-Unavailable - 04-Weather - * - * @return string - */ + * Code for DCR/DCO unavailability. Valid values: + * 01-Temporarily Unavailable + * 02-Location Full + * 03-Unavailable + * 04-Weather + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/DeclaredValueType.php b/src/Api/Model/DeclaredValueType.php index 76fffdc8..e0dcb5a2 100644 --- a/src/Api/Model/DeclaredValueType.php +++ b/src/Api/Model/DeclaredValueType.php @@ -13,17 +13,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Declared value type. Valid values: - - 01=EVS - - 02=DVS - - Defaults to 01 i.e. EVS if declared value type is not provided. The user cannot specify different type of declared value for the shipment. User can either have shipper declared value (DVS) or declared value (EVS) but not both at package level. - - Note: The Shipper Declared Value is applicable for forward shipments when the billing option is freight collect or third party. - - * - * @var string - */ + * Declared value type. Valid values: + * - 01=EVS + * - 02=DVS + * + * Defaults to 01 i.e. EVS if declared value type is not provided. The user cannot specify different type of declared value for the shipment. User can either have shipper declared value (DVS) or declared value (EVS) but not both at package level. + * + * Note: The Shipper Declared Value is applicable for forward shipments when the billing option is freight collect or third party. + * + * + * @var string + */ protected $code; /** * Declared value Description. @@ -32,17 +32,17 @@ public function isInitialized($property): bool */ protected $description; /** - * Declared value type. Valid values: - - 01=EVS - - 02=DVS - - Defaults to 01 i.e. EVS if declared value type is not provided. The user cannot specify different type of declared value for the shipment. User can either have shipper declared value (DVS) or declared value (EVS) but not both at package level. - - Note: The Shipper Declared Value is applicable for forward shipments when the billing option is freight collect or third party. - - * - * @return string - */ + * Declared value type. Valid values: + * - 01=EVS + * - 02=DVS + * + * Defaults to 01 i.e. EVS if declared value type is not provided. The user cannot specify different type of declared value for the shipment. User can either have shipper declared value (DVS) or declared value (EVS) but not both at package level. + * + * Note: The Shipper Declared Value is applicable for forward shipments when the billing option is freight collect or third party. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/DeleteResponseResponse.php b/src/Api/Model/DeleteResponseResponse.php index d571276d..d50337bf 100644 --- a/src/Api/Model/DeleteResponseResponse.php +++ b/src/Api/Model/DeleteResponseResponse.php @@ -20,7 +20,9 @@ public function isInitialized($property): bool protected $responseStatus; /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -55,7 +57,9 @@ public function setResponseStatus(ResponseResponseStatus $responseStatus): self } /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/DeliveryBillToAccount.php b/src/Api/Model/DeliveryBillToAccount.php index c36145d1..05bb0555 100644 --- a/src/Api/Model/DeliveryBillToAccount.php +++ b/src/Api/Model/DeliveryBillToAccount.php @@ -13,15 +13,15 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Indicates how shipping charges for the package were billed. Valid Values: - - 01 - Shipper - - 02 - Consignee Billing - - 03 - Third Party - - 04 - Freight Collect - - * - * @var string - */ + * Indicates how shipping charges for the package were billed. Valid Values: + * - 01 - Shipper + * - 02 - Consignee Billing + * - 03 - Third Party + * - 04 - Freight Collect + * + * + * @var string + */ protected $option; /** * The UPS Account number to which the shipping charges were billed. @@ -30,15 +30,15 @@ public function isInitialized($property): bool */ protected $number; /** - * Indicates how shipping charges for the package were billed. Valid Values: - - 01 - Shipper - - 02 - Consignee Billing - - 03 - Third Party - - 04 - Freight Collect - - * - * @return string - */ + * Indicates how shipping charges for the package were billed. Valid Values: + * - 01 - Shipper + * - 02 - Consignee Billing + * - 03 - Third Party + * - 04 - Freight Collect + * + * + * @return string + */ public function getOption(): string { return $this->option; diff --git a/src/Api/Model/DeliveryDate.php b/src/Api/Model/DeliveryDate.php index 74fb6324..0409b4b7 100644 --- a/src/Api/Model/DeliveryDate.php +++ b/src/Api/Model/DeliveryDate.php @@ -13,20 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var string */ protected $date; /** - * - * * @var string */ protected $type; /** - * - * * @return string */ public function getDate(): string @@ -34,8 +28,6 @@ public function getDate(): string return $this->date; } /** - * - * * @param string $date * * @return self @@ -47,8 +39,6 @@ public function setDate(string $date): self return $this; } /** - * - * * @return string */ public function getType(): string @@ -56,8 +46,6 @@ public function getType(): string return $this->type; } /** - * - * * @param string $type * * @return self diff --git a/src/Api/Model/DeliveryLocationAddressArtifactFormat.php b/src/Api/Model/DeliveryLocationAddressArtifactFormat.php index f798c0f8..7220165e 100644 --- a/src/Api/Model/DeliveryLocationAddressArtifactFormat.php +++ b/src/Api/Model/DeliveryLocationAddressArtifactFormat.php @@ -56,7 +56,9 @@ public function isInitialized($property): bool protected $buildingName; /** * Container tag for additional address information where package is delivered. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -259,7 +261,9 @@ public function setBuildingName(string $buildingName): self } /** * Container tag for additional address information where package is delivered. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/DeliveryPackageReferenceNumber.php b/src/Api/Model/DeliveryPackageReferenceNumber.php index 46b582cc..fa6a6191 100644 --- a/src/Api/Model/DeliveryPackageReferenceNumber.php +++ b/src/Api/Model/DeliveryPackageReferenceNumber.php @@ -25,13 +25,13 @@ public function isInitialized($property): bool */ protected $number; /** - * Reflects what will go on the label as the name of the reference. - - For additional information, refer to the Reference Codes table in the Appendix. - - * - * @var string - */ + * Reflects what will go on the label as the name of the reference. + * + * For additional information, refer to the Reference Codes table in the Appendix. + * + * + * @var string + */ protected $code; /** * Customer supplied reference number. Reference numbers are defined by the shipper and can contain any character string. @@ -84,13 +84,13 @@ public function setNumber(string $number): self return $this; } /** - * Reflects what will go on the label as the name of the reference. - - For additional information, refer to the Reference Codes table in the Appendix. - - * - * @return string - */ + * Reflects what will go on the label as the name of the reference. + * + * For additional information, refer to the Reference Codes table in the Appendix. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/DeliveryShipmentReferenceNumber.php b/src/Api/Model/DeliveryShipmentReferenceNumber.php index 53c57fda..47a73760 100644 --- a/src/Api/Model/DeliveryShipmentReferenceNumber.php +++ b/src/Api/Model/DeliveryShipmentReferenceNumber.php @@ -25,13 +25,13 @@ public function isInitialized($property): bool */ protected $number; /** - * Reflects what will go on the label as the name of the reference. - - For additional information, refer to the Reference Codes table in the Appendix. - - * - * @var string - */ + * Reflects what will go on the label as the name of the reference. + * + * For additional information, refer to the Reference Codes table in the Appendix. + * + * + * @var string + */ protected $code; /** * Customer supplied reference number. Reference numbers are defined by the shipper and can contain any character string. @@ -84,13 +84,13 @@ public function setNumber(string $number): self return $this; } /** - * Reflects what will go on the label as the name of the reference. - - For additional information, refer to the Reference Codes table in the Appendix. - - * - * @return string - */ + * Reflects what will go on the label as the name of the reference. + * + * For additional information, refer to the Reference Codes table in the Appendix. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/DeliveryTime.php b/src/Api/Model/DeliveryTime.php index afee1065..f5e3de79 100644 --- a/src/Api/Model/DeliveryTime.php +++ b/src/Api/Model/DeliveryTime.php @@ -25,18 +25,18 @@ public function isInitialized($property): bool */ protected $startTime; /** - * The date of this delivery detail. - Valid values: - - EOD - End of Day - CMT - Commit Time - EDW - Estimated Delivery Window ** - CDW - Confirmed Delivery Window ** - IDW - Imminent Delivery Window ** - DEL - Delivered Time - * - * @var string - */ + * The date of this delivery detail. + * Valid values: + * + * EOD - End of Day + * CMT - Commit Time + * EDW - Estimated Delivery Window ** + * CDW - Confirmed Delivery Window ** + * IDW - Imminent Delivery Window ** + * DEL - Delivered Time + * + * @var string + */ protected $type; /** * The end time of a window or the committed time or the delivered time. Only returned when the type is “EDW” or “CDW” or “IDW” or “CMT” or “DEL”. Format: HHMMSS (24 hr) @@ -83,18 +83,18 @@ public function setStartTime(string $startTime): self return $this; } /** - * The date of this delivery detail. - Valid values: - - EOD - End of Day - CMT - Commit Time - EDW - Estimated Delivery Window ** - CDW - Confirmed Delivery Window ** - IDW - Imminent Delivery Window ** - DEL - Delivered Time - * - * @return string - */ + * The date of this delivery detail. + * Valid values: + * + * EOD - End of Day + * CMT - Commit Time + * EDW - Estimated Delivery Window ** + * CDW - Confirmed Delivery Window ** + * IDW - Imminent Delivery Window ** + * DEL - Delivered Time + * + * @return string + */ public function getType(): string { return $this->type; diff --git a/src/Api/Model/Destination.php b/src/Api/Model/Destination.php index d43a6021..c4e13f30 100644 --- a/src/Api/Model/Destination.php +++ b/src/Api/Model/Destination.php @@ -13,12 +13,12 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * It is an HTTP-based callback end point that is exposed by the client to receive event notification. This endpoint must be operational arround the clock to ensure no event notifications are missed. - If this endpoint is not continuously available, incoming events will be lost. - - * - * @var string - */ + * It is an HTTP-based callback end point that is exposed by the client to receive event notification. This endpoint must be operational arround the clock to ensure no event notifications are missed. + * If this endpoint is not continuously available, incoming events will be lost. + * + * + * @var string + */ protected $url; /** * It is an open-entry field that indicates type of credentials supported by the client. @@ -33,12 +33,12 @@ public function isInitialized($property): bool */ protected $credential; /** - * It is an HTTP-based callback end point that is exposed by the client to receive event notification. This endpoint must be operational arround the clock to ensure no event notifications are missed. - If this endpoint is not continuously available, incoming events will be lost. - - * - * @return string - */ + * It is an HTTP-based callback end point that is exposed by the client to receive event notification. This endpoint must be operational arround the clock to ensure no event notifications are missed. + * If this endpoint is not continuously available, incoming events will be lost. + * + * + * @return string + */ public function getUrl(): string { return $this->url; diff --git a/src/Api/Model/DimWeightUnitOfMeasurement.php b/src/Api/Model/DimWeightUnitOfMeasurement.php index d32be5c9..c53faf2a 100644 --- a/src/Api/Model/DimWeightUnitOfMeasurement.php +++ b/src/Api/Model/DimWeightUnitOfMeasurement.php @@ -13,15 +13,15 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code representing the unit of measure associated with the package weight. - - Valid values: - - LBS = Pounds (default) - - KGS = Kilograms - - * - * @var string - */ + * Code representing the unit of measure associated with the package weight. + * + * Valid values: + * - LBS = Pounds (default) + * - KGS = Kilograms + * + * + * @var string + */ protected $code; /** * Text description of the code representing the unit of measure associated with the package weight. Length and value are not validated. @@ -30,15 +30,15 @@ public function isInitialized($property): bool */ protected $description; /** - * Code representing the unit of measure associated with the package weight. - - Valid values: - - LBS = Pounds (default) - - KGS = Kilograms - - * - * @return string - */ + * Code representing the unit of measure associated with the package weight. + * + * Valid values: + * - LBS = Pounds (default) + * - KGS = Kilograms + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/DistanceUnitOfMeasurement.php b/src/Api/Model/DistanceUnitOfMeasurement.php index 889ffe05..7f776ed8 100644 --- a/src/Api/Model/DistanceUnitOfMeasurement.php +++ b/src/Api/Model/DistanceUnitOfMeasurement.php @@ -13,12 +13,12 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The distance unit of measurement code. The unit of measurement used in the search request is returned. - - Valid values: MI-Miles or KM-Kilometers - * - * @var string - */ + * The distance unit of measurement code. The unit of measurement used in the search request is returned. + * + * Valid values: MI-Miles or KM-Kilometers + * + * @var string + */ protected $code; /** * May return the description of the unit of measure specified in the request. @@ -27,12 +27,12 @@ public function isInitialized($property): bool */ protected $description; /** - * The distance unit of measurement code. The unit of measurement used in the search request is returned. - - Valid values: MI-Miles or KM-Kilometers - * - * @return string - */ + * The distance unit of measurement code. The unit of measurement used in the search request is returned. + * + * Valid values: MI-Miles or KM-Kilometers + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/DocumentsPackingList.php b/src/Api/Model/DocumentsPackingList.php index 2f6aeed5..3153767f 100644 --- a/src/Api/Model/DocumentsPackingList.php +++ b/src/Api/Model/DocumentsPackingList.php @@ -25,8 +25,6 @@ public function isInitialized($property): bool */ protected $shipTo; /** - * - * * @var list */ protected $reference; @@ -81,8 +79,6 @@ public function setShipTo(PackingListShipTo $shipTo): self return $this; } /** - * - * * @return list */ public function getReference(): array @@ -90,8 +86,6 @@ public function getReference(): array return $this->reference; } /** - * - * * @param list $reference * * @return self diff --git a/src/Api/Model/DropLocationAdditionalComments.php b/src/Api/Model/DropLocationAdditionalComments.php index 829d8769..81b3f860 100644 --- a/src/Api/Model/DropLocationAdditionalComments.php +++ b/src/Api/Model/DropLocationAdditionalComments.php @@ -14,14 +14,18 @@ public function isInitialized($property): bool } /** * Container for CommentType Code and Text. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $commentType; /** * Container for CommentType Code and Text. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/DropLocationIVR.php b/src/Api/Model/DropLocationIVR.php index 5c5571d0..2757fb27 100644 --- a/src/Api/Model/DropLocationIVR.php +++ b/src/Api/Model/DropLocationIVR.php @@ -13,25 +13,25 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Contains the name of the IVR file that relates to this drop location. The file is an audio recording of information related to the location. - ONLY FOR IVR. - * - * @var string - */ + * Contains the name of the IVR file that relates to this drop location. The file is an audio recording of information related to the location. + * ONLY FOR IVR. + * + * @var string + */ protected $phraseID; /** - * Indicates to the response recipient that the information has changed, and a new audio file should be produced. - ONLY FOR IVR. - * - * @var string - */ + * Indicates to the response recipient that the information has changed, and a new audio file should be produced. + * ONLY FOR IVR. + * + * @var string + */ protected $textToSpeechIndicator; /** - * Contains the name of the IVR file that relates to this drop location. The file is an audio recording of information related to the location. - ONLY FOR IVR. - * - * @return string - */ + * Contains the name of the IVR file that relates to this drop location. The file is an audio recording of information related to the location. + * ONLY FOR IVR. + * + * @return string + */ public function getPhraseID(): string { return $this->phraseID; @@ -51,11 +51,11 @@ public function setPhraseID(string $phraseID): self return $this; } /** - * Indicates to the response recipient that the information has changed, and a new audio file should be produced. - ONLY FOR IVR. - * - * @return string - */ + * Indicates to the response recipient that the information has changed, and a new audio file should be produced. + * ONLY FOR IVR. + * + * @return string + */ public function getTextToSpeechIndicator(): string { return $this->textToSpeechIndicator; diff --git a/src/Api/Model/DropLocationLocationAttribute.php b/src/Api/Model/DropLocationLocationAttribute.php index 3d0f3f68..e8359b71 100644 --- a/src/Api/Model/DropLocationLocationAttribute.php +++ b/src/Api/Model/DropLocationLocationAttribute.php @@ -13,27 +13,23 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var LocationAttributeOptionType */ protected $optionType; /** - * Option code is a container that contains the information of a particular type of Location or retail location or additional service or program type that the drop location contains. - - If the OptionType is Location or Retail Location Type there will be one code since each location has only one location type or retail location type. - - If the Option type is additional services or program types there can be one or more option codes. - - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @var list - */ - protected $optionCode; - /** + * Option code is a container that contains the information of a particular type of Location or retail location or additional service or program type that the drop location contains. + * + * If the OptionType is Location or Retail Location Type there will be one code since each location has only one location type or retail location type. + * + * If the Option type is additional services or program types there can be one or more option codes. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. * * + * @var list + */ + protected $optionCode; + /** * @return LocationAttributeOptionType */ public function getOptionType(): LocationAttributeOptionType @@ -41,8 +37,6 @@ public function getOptionType(): LocationAttributeOptionType return $this->optionType; } /** - * - * * @param LocationAttributeOptionType $optionType * * @return self @@ -54,17 +48,17 @@ public function setOptionType(LocationAttributeOptionType $optionType): self return $this; } /** - * Option code is a container that contains the information of a particular type of Location or retail location or additional service or program type that the drop location contains. - - If the OptionType is Location or Retail Location Type there will be one code since each location has only one location type or retail location type. - - If the Option type is additional services or program types there can be one or more option codes. - - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @return list - */ + * Option code is a container that contains the information of a particular type of Location or retail location or additional service or program type that the drop location contains. + * + * If the OptionType is Location or Retail Location Type there will be one code since each location has only one location type or retail location type. + * + * If the Option type is additional services or program types there can be one or more option codes. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * + * @return list + */ public function getOptionCode(): array { return $this->optionCode; diff --git a/src/Api/Model/DropLocationOperatingHours.php b/src/Api/Model/DropLocationOperatingHours.php index 9d406777..d40df474 100644 --- a/src/Api/Model/DropLocationOperatingHours.php +++ b/src/Api/Model/DropLocationOperatingHours.php @@ -14,14 +14,18 @@ public function isInitialized($property): bool } /** * StandardHours Container. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $standardHours; /** * StandardHours Container. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/DropLocationServiceOfferingList.php b/src/Api/Model/DropLocationServiceOfferingList.php index 3950fb02..4f3ac8c6 100644 --- a/src/Api/Model/DropLocationServiceOfferingList.php +++ b/src/Api/Model/DropLocationServiceOfferingList.php @@ -14,14 +14,18 @@ public function isInitialized($property): bool } /** * Container for Service offering code. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $serviceOffering; /** * Container for Service offering code. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/DropOffFacilitiesAddress.php b/src/Api/Model/DropOffFacilitiesAddress.php index fad67736..649a7dd4 100644 --- a/src/Api/Model/DropOffFacilitiesAddress.php +++ b/src/Api/Model/DropOffFacilitiesAddress.php @@ -43,13 +43,13 @@ public function isInitialized($property): bool */ protected $countryCode; /** - * Indicates if the pickup address is a residential place or not. - Valid Values: - Y = Residential address - N = Non-residential (Commercial) address (default) - * - * @var string - */ + * Indicates if the pickup address is a residential place or not. + * Valid Values: + * Y = Residential address + * N = Non-residential (Commercial) address (default) + * + * @var string + */ protected $residentialIndicator; /** * Address Line of the Facility. @@ -162,13 +162,13 @@ public function setCountryCode(string $countryCode): self return $this; } /** - * Indicates if the pickup address is a residential place or not. - Valid Values: - Y = Residential address - N = Non-residential (Commercial) address (default) - * - * @return string - */ + * Indicates if the pickup address is a residential place or not. + * Valid Values: + * Y = Residential address + * N = Non-residential (Commercial) address (default) + * + * @return string + */ public function getResidentialIndicator(): string { return $this->residentialIndicator; diff --git a/src/Api/Model/DropOffFacilitiesDistance.php b/src/Api/Model/DropOffFacilitiesDistance.php index 5923a3ea..dde7368b 100644 --- a/src/Api/Model/DropOffFacilitiesDistance.php +++ b/src/Api/Model/DropOffFacilitiesDistance.php @@ -13,27 +13,27 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Distance from origin address. Distance based on distance UOM in request. - - Numeric value up to 200 and .2 decimal positions. Distance will be retuned for drop off location search by proximity order. - * - * @var string - */ + * Distance from origin address. Distance based on distance UOM in request. + * + * Numeric value up to 200 and .2 decimal positions. Distance will be retuned for drop off location search by proximity order. + * + * @var string + */ protected $value; /** - * Unit Of Measure. - Example: MI or KM - * - * @var string - */ + * Unit Of Measure. + * Example: MI or KM + * + * @var string + */ protected $unitOfMeasurement; /** - * Distance from origin address. Distance based on distance UOM in request. - - Numeric value up to 200 and .2 decimal positions. Distance will be retuned for drop off location search by proximity order. - * - * @return string - */ + * Distance from origin address. Distance based on distance UOM in request. + * + * Numeric value up to 200 and .2 decimal positions. Distance will be retuned for drop off location search by proximity order. + * + * @return string + */ public function getValue(): string { return $this->value; @@ -54,11 +54,11 @@ public function setValue(string $value): self return $this; } /** - * Unit Of Measure. - Example: MI or KM - * - * @return string - */ + * Unit Of Measure. + * Example: MI or KM + * + * @return string + */ public function getUnitOfMeasurement(): string { return $this->unitOfMeasurement; diff --git a/src/Api/Model/DropOffFacilitiesFacilityTime.php b/src/Api/Model/DropOffFacilitiesFacilityTime.php index 1e76a325..a675e8db 100644 --- a/src/Api/Model/DropOffFacilitiesFacilityTime.php +++ b/src/Api/Model/DropOffFacilitiesFacilityTime.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $dayOfWeek; /** - * - * * @return list */ public function getDayOfWeek(): array @@ -28,8 +24,6 @@ public function getDayOfWeek(): array return $this->dayOfWeek; } /** - * - * * @param list $dayOfWeek * * @return self diff --git a/src/Api/Model/DropOffFacilitiesLocalizedInstruction.php b/src/Api/Model/DropOffFacilitiesLocalizedInstruction.php index 0d78cbb3..c02dfd25 100644 --- a/src/Api/Model/DropOffFacilitiesLocalizedInstruction.php +++ b/src/Api/Model/DropOffFacilitiesLocalizedInstruction.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $locale; /** - * Last 50ft instructions that relates to an available facility and depend on the locale passing in request. - Last 50 feet instruction in the language asked in request or the English for that country. - * - * @var string - */ + * Last 50ft instructions that relates to an available facility and depend on the locale passing in request. + * Last 50 feet instruction in the language asked in request or the English for that country. + * + * @var string + */ protected $last50ftInstruction; /** * Locale. Example: en_US @@ -48,11 +48,11 @@ public function setLocale(string $locale): self return $this; } /** - * Last 50ft instructions that relates to an available facility and depend on the locale passing in request. - Last 50 feet instruction in the language asked in request or the English for that country. - * - * @return string - */ + * Last 50ft instructions that relates to an available facility and depend on the locale passing in request. + * Last 50 feet instruction in the language asked in request or the English for that country. + * + * @return string + */ public function getLast50ftInstruction(): string { return $this->last50ftInstruction; diff --git a/src/Api/Model/DryIceWeightUnitOfMeasurement.php b/src/Api/Model/DryIceWeightUnitOfMeasurement.php index cf68c70e..e4ac8d6b 100644 --- a/src/Api/Model/DryIceWeightUnitOfMeasurement.php +++ b/src/Api/Model/DryIceWeightUnitOfMeasurement.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * DryIce weight unit of measurement code. Valid values: - - 00 = KG (Metric Unit of Measurements) or KGS - - 01 = LB (English Unit of Measurements) or LBS The following values are valid : 00, 01, KG, KGS, LBS. - - * - * @var string - */ + * DryIce weight unit of measurement code. Valid values: + * - 00 = KG (Metric Unit of Measurements) or KGS + * - 01 = LB (English Unit of Measurements) or LBS The following values are valid : 00, 01, KG, KGS, LBS. + * + * + * @var string + */ protected $code; /** * Description for unit of measurement for Dry Ice Weight. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $description; /** - * DryIce weight unit of measurement code. Valid values: - - 00 = KG (Metric Unit of Measurements) or KGS - - 01 = LB (English Unit of Measurements) or LBS The following values are valid : 00, 01, KG, KGS, LBS. - - * - * @return string - */ + * DryIce weight unit of measurement code. Valid values: + * - 00 = KG (Metric Unit of Measurements) or KGS + * - 01 = LB (English Unit of Measurements) or LBS The following values are valid : 00, 01, KG, KGS, LBS. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/EEIInformationDDTCInformation.php b/src/Api/Model/EEIInformationDDTCInformation.php index 70c4635c..dac4b25f 100644 --- a/src/Api/Model/EEIInformationDDTCInformation.php +++ b/src/Api/Model/EEIInformationDDTCInformation.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The specific citation (exemption number) under the International Traffic in Arms Regulations (ITAR) from the Code of Federal Register (see 22 CFR 120-130) that exempts the shipment from the requirements for a license or other written authorization from the Directorate of Trade Controls (DDTC). - Refer to EEI License Codes in the Appendix for valid values. Applies to EEI Form only. This field is applicable for EEIFiling option 1A and 3. - * - * @var string - */ + * The specific citation (exemption number) under the International Traffic in Arms Regulations (ITAR) from the Code of Federal Register (see 22 CFR 120-130) that exempts the shipment from the requirements for a license or other written authorization from the Directorate of Trade Controls (DDTC). + * Refer to EEI License Codes in the Appendix for valid values. Applies to EEI Form only. This field is applicable for EEIFiling option 1A and 3. + * + * @var string + */ protected $iTARExemptionNumber; /** * Digit numeric code (e.g. 01-18, 20 or 21). Indicates the U.S. Munitions List (USML) category article, service or related technical data as it applies to the article reported. Applies to EEI form only. It is required for EEIFilingOption code 3. @@ -62,11 +62,11 @@ public function isInitialized($property): bool */ protected $aCMNumber; /** - * The specific citation (exemption number) under the International Traffic in Arms Regulations (ITAR) from the Code of Federal Register (see 22 CFR 120-130) that exempts the shipment from the requirements for a license or other written authorization from the Directorate of Trade Controls (DDTC). - Refer to EEI License Codes in the Appendix for valid values. Applies to EEI Form only. This field is applicable for EEIFiling option 1A and 3. - * - * @return string - */ + * The specific citation (exemption number) under the International Traffic in Arms Regulations (ITAR) from the Code of Federal Register (see 22 CFR 120-130) that exempts the shipment from the requirements for a license or other written authorization from the Directorate of Trade Controls (DDTC). + * Refer to EEI License Codes in the Appendix for valid values. Applies to EEI Form only. This field is applicable for EEIFiling option 1A and 3. + * + * @return string + */ public function getITARExemptionNumber(): string { return $this->iTARExemptionNumber; diff --git a/src/Api/Model/EEIInformationLicense.php b/src/Api/Model/EEIInformationLicense.php index cdfa3825..c70312e1 100644 --- a/src/Api/Model/EEIInformationLicense.php +++ b/src/Api/Model/EEIInformationLicense.php @@ -13,26 +13,26 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Represents any one of the following values: export license number, exception code, CFR citation, KPC Number, ACM Number. Applies to EEI form only. - - Refer to EEI License Types and Exemptions in the Appendix for valid values and formats. - * - * @var string - */ + * Represents any one of the following values: export license number, exception code, CFR citation, KPC Number, ACM Number. Applies to EEI form only. + * + * Refer to EEI License Types and Exemptions in the Appendix for valid values and formats. + * + * @var string + */ protected $number; /** - * The standard license code published by US government. - Refer to EEI License Codes in the Appendix for valid values. Applies to EEI form only. It is required for EEIFilingOption code 3. It is optionally required for all other filing types; however, it is used to categorize each product as SDL or non-SDL. It is also used to identify which piece of information is applicable. - * - * @var string - */ + * The standard license code published by US government. + * Refer to EEI License Codes in the Appendix for valid values. Applies to EEI form only. It is required for EEIFilingOption code 3. It is optionally required for all other filing types; however, it is used to categorize each product as SDL or non-SDL. It is also used to identify which piece of information is applicable. + * + * @var string + */ protected $code; /** - * The export monetary amount allowed per license. Required for a licensable product when the EEI form is selected. - Format: Whole numbers only. Applies to EEI form only. Required if EEIFilingOption code 1A (only for SDL shipments) or 3. - * - * @var string - */ + * The export monetary amount allowed per license. Required for a licensable product when the EEI form is selected. + * Format: Whole numbers only. Applies to EEI form only. Required if EEIFilingOption code 1A (only for SDL shipments) or 3. + * + * @var string + */ protected $licenseLineValue; /** * Product ECCN Number issued by BIS (Bureau of Industry and Security). If the license number is a commerce license, ECCN must be provided. The format is #A### or EAR99 Applies to EEI forms only. It is required for EEIFilingOption code 3. ECCN is required one of the following License Exception Codes is entered: CIV, CTP, ENC, GBS, KMI, LVS, TSR @@ -41,12 +41,12 @@ public function isInitialized($property): bool */ protected $eCCNNumber; /** - * Represents any one of the following values: export license number, exception code, CFR citation, KPC Number, ACM Number. Applies to EEI form only. - - Refer to EEI License Types and Exemptions in the Appendix for valid values and formats. - * - * @return string - */ + * Represents any one of the following values: export license number, exception code, CFR citation, KPC Number, ACM Number. Applies to EEI form only. + * + * Refer to EEI License Types and Exemptions in the Appendix for valid values and formats. + * + * @return string + */ public function getNumber(): string { return $this->number; @@ -67,11 +67,11 @@ public function setNumber(string $number): self return $this; } /** - * The standard license code published by US government. - Refer to EEI License Codes in the Appendix for valid values. Applies to EEI form only. It is required for EEIFilingOption code 3. It is optionally required for all other filing types; however, it is used to categorize each product as SDL or non-SDL. It is also used to identify which piece of information is applicable. - * - * @return string - */ + * The standard license code published by US government. + * Refer to EEI License Codes in the Appendix for valid values. Applies to EEI form only. It is required for EEIFilingOption code 3. It is optionally required for all other filing types; however, it is used to categorize each product as SDL or non-SDL. It is also used to identify which piece of information is applicable. + * + * @return string + */ public function getCode(): string { return $this->code; @@ -91,11 +91,11 @@ public function setCode(string $code): self return $this; } /** - * The export monetary amount allowed per license. Required for a licensable product when the EEI form is selected. - Format: Whole numbers only. Applies to EEI form only. Required if EEIFilingOption code 1A (only for SDL shipments) or 3. - * - * @return string - */ + * The export monetary amount allowed per license. Required for a licensable product when the EEI form is selected. + * Format: Whole numbers only. Applies to EEI form only. Required if EEIFilingOption code 1A (only for SDL shipments) or 3. + * + * @return string + */ public function getLicenseLineValue(): string { return $this->licenseLineValue; diff --git a/src/Api/Model/EMailInformationEMail.php b/src/Api/Model/EMailInformationEMail.php index 1ab1b321..ab703566 100644 --- a/src/Api/Model/EMailInformationEMail.php +++ b/src/Api/Model/EMailInformationEMail.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $eMailAddress; /** - * Contents of the email to be sent. - Only used for BOL Email Types. Otherwise ignored. - * - * @var string - */ + * Contents of the email to be sent. + * Only used for BOL Email Types. Otherwise ignored. + * + * @var string + */ protected $eMailText; /** * The address where an undeliverable email message is sent if the email with the notification is undeliverable. @@ -32,11 +32,11 @@ public function isInitialized($property): bool */ protected $undeliverableEMailAddress; /** - * Email subject line. - Only used for BOL Email Types. Otherwise ignored. - * - * @var string - */ + * Email subject line. + * Only used for BOL Email Types. Otherwise ignored. + * + * @var string + */ protected $subject; /** * Email address where the notification is sent. @@ -61,11 +61,11 @@ public function setEMailAddress(string $eMailAddress): self return $this; } /** - * Contents of the email to be sent. - Only used for BOL Email Types. Otherwise ignored. - * - * @return string - */ + * Contents of the email to be sent. + * Only used for BOL Email Types. Otherwise ignored. + * + * @return string + */ public function getEMailText(): string { return $this->eMailText; @@ -107,11 +107,11 @@ public function setUndeliverableEMailAddress(string $undeliverableEMailAddress): return $this; } /** - * Email subject line. - Only used for BOL Email Types. Otherwise ignored. - * - * @return string - */ + * Email subject line. + * Only used for BOL Email Types. Otherwise ignored. + * + * @return string + */ public function getSubject(): string { return $this->subject; diff --git a/src/Api/Model/EMailInformationEMailType.php b/src/Api/Model/EMailInformationEMailType.php index a0b4e024..1fd40e4d 100644 --- a/src/Api/Model/EMailInformationEMailType.php +++ b/src/Api/Model/EMailInformationEMailType.php @@ -13,15 +13,15 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The code associated with the email type for the shipment service options. - Valid values: - 001- Ship Notification - 002- Delivery Notification - 003 � Exception Notification - 004 � BOL/Labels(Ground Only) - * - * @var string - */ + * The code associated with the email type for the shipment service options. + * Valid values: + * 001- Ship Notification + * 002- Delivery Notification + * 003 � Exception Notification + * 004 � BOL/Labels(Ground Only) + * + * @var string + */ protected $code; /** * A text description of the code for the email type associated with the shipment service options. @@ -30,15 +30,15 @@ public function isInitialized($property): bool */ protected $description; /** - * The code associated with the email type for the shipment service options. - Valid values: - 001- Ship Notification - 002- Delivery Notification - 003 � Exception Notification - 004 � BOL/Labels(Ground Only) - * - * @return string - */ + * The code associated with the email type for the shipment service options. + * Valid values: + * 001- Ship Notification + * 002- Delivery Notification + * 003 � Exception Notification + * 004 � BOL/Labels(Ground Only) + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/EmsResponse.php b/src/Api/Model/EmsResponse.php index 65dff4d0..d92af424 100644 --- a/src/Api/Model/EmsResponse.php +++ b/src/Api/Model/EmsResponse.php @@ -13,70 +13,70 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). This date may or may not be the UPS business date. - - Valid Format: YYYY-MM-DD - * - * @var string - */ + * The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). This date may or may not be the UPS business date. + * + * Valid Format: YYYY-MM-DD + * + * @var string + */ protected $shipDate; /** - * The time the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). - - Valid Format: HH:MM:SS - * - * @var string - */ + * The time the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). + * + * Valid Format: HH:MM:SS + * + * @var string + */ protected $shipTime; /** - * Service Levels being returned. - - A = all service levels. - - Blank is the default for all Service Level values. - * - * @var string - */ + * Service Levels being returned. + * + * A = all service levels. + * + * Blank is the default for all Service Level values. + * + * @var string + */ protected $serviceLevel; /** - * Represents the shipment type. - - Valid values: "02","03","04","07" - 02 - Document - 03 - Non-Document - 04 - WWEF - 07 - Pallet - * - * @var string - */ + * Represents the shipment type. + * + * Valid values: "02","03","04","07" + * 02 - Document + * 03 - Non-Document + * 04 - WWEF + * 07 - Pallet + * + * @var string + */ protected $billType; /** - * Populated with valid duty types for international transactions only. - - Valid Duty Types: "01","02","03","04","05","06","07","08","09" - 01 - Dutiable - 02 - Non Dutiable - 03 - Low Value - 04 - Courier Remission - 05 - Gift - 06 - Military - 07 - Exception - 08 - Line Release - 09 - Low Value - * - * @var string - */ + * Populated with valid duty types for international transactions only. + * + * Valid Duty Types: "01","02","03","04","05","06","07","08","09" + * 01 - Dutiable + * 02 - Non Dutiable + * 03 - Low Value + * 04 - Courier Remission + * 05 - Gift + * 06 - Military + * 07 - Exception + * 08 - Line Release + * 09 - Low Value + * + * @var string + */ protected $dutyType; /** - * residential Indicator that was sent in on the request. - - Valid values: "01","02" - - 01 - Residential - 02 - Commercial - * - * @var string - */ + * residential Indicator that was sent in on the request. + * + * Valid values: "01","02" + * + * 01 - Residential + * 02 - Commercial + * + * @var string + */ protected $residentialIndicator; /** * Destination country name value @@ -91,46 +91,46 @@ public function isInitialized($property): bool */ protected $destinationCountryCode; /** - * The shipment destination postal code. Required for US domestic requests. - - Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. - * - * @var string - */ + * The shipment destination postal code. Required for US domestic requests. + * + * Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. + * + * @var string + */ protected $destinationPostalCode; /** - * The shipment destination postal code low range. Value may or may not differ from destinationPostalCode. - - Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. - * - * @var string - */ + * The shipment destination postal code low range. Value may or may not differ from destinationPostalCode. + * + * Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. + * + * @var string + */ protected $destinationPostalCodeLow; /** - * The shipment destination postal code high range. Value may or may not differ from destinationPostalCode. - - Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. - * - * @var string - */ + * The shipment destination postal code high range. Value may or may not differ from destinationPostalCode. + * + * Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. + * + * @var string + */ protected $destinationPostalCodeHigh; /** - * The shipment destination state or province. - - For U.S. addresses, the value will be a valid 2-Character value (per U.S. Mail Standards). - - For non-U.S. addresses the full State or Province name will be returned. - * - * @var string - */ + * The shipment destination state or province. + * + * For U.S. addresses, the value will be a valid 2-Character value (per U.S. Mail Standards). + * + * For non-U.S. addresses the full State or Province name will be returned. + * + * @var string + */ protected $destinationStateProvince; /** - * The shipment destination city. - - Required for International requests for those countries that do not utilize postal codes. - * - * @var string - */ + * The shipment destination city. + * + * Required for International requests for those countries that do not utilize postal codes. + * + * @var string + */ protected $destinationCityName; /** * Origin country name value @@ -145,54 +145,54 @@ public function isInitialized($property): bool */ protected $originCountryCode; /** - * The shipment origin postal code. Required for US domestic requests. - - Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. - * - * @var string - */ + * The shipment origin postal code. Required for US domestic requests. + * + * Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. + * + * @var string + */ protected $originPostalCode; /** - * The shipment origin postal code low range. Value may or may not differ from destinationPostalCode. - - Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. - * - * @var string - */ + * The shipment origin postal code low range. Value may or may not differ from destinationPostalCode. + * + * Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. + * + * @var string + */ protected $originPostalCodeLow; /** - * The shipment origin postal code high range. Value may or may not differ from destinationPostalCode. - - Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. - * - * @var string - */ + * The shipment origin postal code high range. Value may or may not differ from destinationPostalCode. + * + * Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. + * + * @var string + */ protected $originPostalCodeHigh; /** - * The shipment origin state or province. - - For U.S. addresses, the value will be a valid 2-Character value (per U.S. Mail Standards). - - For non-U.S. addresses the full State or Province name will be returned. - * - * @var string - */ + * The shipment origin state or province. + * + * For U.S. addresses, the value will be a valid 2-Character value (per U.S. Mail Standards). + * + * For non-U.S. addresses the full State or Province name will be returned. + * + * @var string + */ protected $originStateProvince; /** - * The shipment origin city. - - Required for International requests for those countries that do not utilize postal codes. - * - * @var string - */ + * The shipment origin city. + * + * Required for International requests for those countries that do not utilize postal codes. + * + * @var string + */ protected $originCityName; /** - * Shipment weight. Value is only required for international shipment. - - Defaults to 0.0 - * - * @var string - */ + * Shipment weight. Value is only required for international shipment. + * + * Defaults to 0.0 + * + * @var string + */ protected $weight; /** * Returned on response when weight was present on the request. @@ -201,12 +201,12 @@ public function isInitialized($property): bool */ protected $weightUnitOfMeasure; /** - * Shipment contents value. Value is only required for international shipment. - - Defaults to 0.0 - * - * @var string - */ + * Shipment contents value. Value is only required for international shipment. + * + * Defaults to 0.0 + * + * @var string + */ protected $shipmentContentsValue; /** * Returned on response when shipmentContentsValue was present on the request. @@ -215,16 +215,16 @@ public function isInitialized($property): bool */ protected $shipmentContentsCurrencyCode; /** - * Returns TRUE if the shipment dates fall within a defined peak date range. When the guarantee is suspended, it is suspended for all services in the response. - - The logic for determining if guarantees are suspended applies per origin country. - - The following will be used to determine if a shipment falls within a defined peak date range: shipDate (from the response), deliveryDate (from the response), server Date. - - Defined peak date range (range for when guarantees are suspended) is inclusive of start and end dates. - * - * @var bool - */ + * Returns TRUE if the shipment dates fall within a defined peak date range. When the guarantee is suspended, it is suspended for all services in the response. + * + * The logic for determining if guarantees are suspended applies per origin country. + * + * The following will be used to determine if a shipment falls within a defined peak date range: shipDate (from the response), deliveryDate (from the response), server Date. + * + * Defined peak date range (range for when guarantees are suspended) is inclusive of start and end dates. + * + * @var bool + */ protected $guaranteeSuspended; /** * Number of services being returned in the services array. @@ -233,18 +233,16 @@ public function isInitialized($property): bool */ protected $numberOfServices; /** - * - * * @var list */ protected $services; /** - * The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). This date may or may not be the UPS business date. - - Valid Format: YYYY-MM-DD - * - * @return string - */ + * The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). This date may or may not be the UPS business date. + * + * Valid Format: YYYY-MM-DD + * + * @return string + */ public function getShipDate(): string { return $this->shipDate; @@ -265,12 +263,12 @@ public function setShipDate(string $shipDate): self return $this; } /** - * The time the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). - - Valid Format: HH:MM:SS - * - * @return string - */ + * The time the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). + * + * Valid Format: HH:MM:SS + * + * @return string + */ public function getShipTime(): string { return $this->shipTime; @@ -291,14 +289,14 @@ public function setShipTime(string $shipTime): self return $this; } /** - * Service Levels being returned. - - A = all service levels. - - Blank is the default for all Service Level values. - * - * @return string - */ + * Service Levels being returned. + * + * A = all service levels. + * + * Blank is the default for all Service Level values. + * + * @return string + */ public function getServiceLevel(): string { return $this->serviceLevel; @@ -321,16 +319,16 @@ public function setServiceLevel(string $serviceLevel): self return $this; } /** - * Represents the shipment type. - - Valid values: "02","03","04","07" - 02 - Document - 03 - Non-Document - 04 - WWEF - 07 - Pallet - * - * @return string - */ + * Represents the shipment type. + * + * Valid values: "02","03","04","07" + * 02 - Document + * 03 - Non-Document + * 04 - WWEF + * 07 - Pallet + * + * @return string + */ public function getBillType(): string { return $this->billType; @@ -355,21 +353,21 @@ public function setBillType(string $billType): self return $this; } /** - * Populated with valid duty types for international transactions only. - - Valid Duty Types: "01","02","03","04","05","06","07","08","09" - 01 - Dutiable - 02 - Non Dutiable - 03 - Low Value - 04 - Courier Remission - 05 - Gift - 06 - Military - 07 - Exception - 08 - Line Release - 09 - Low Value - * - * @return string - */ + * Populated with valid duty types for international transactions only. + * + * Valid Duty Types: "01","02","03","04","05","06","07","08","09" + * 01 - Dutiable + * 02 - Non Dutiable + * 03 - Low Value + * 04 - Courier Remission + * 05 - Gift + * 06 - Military + * 07 - Exception + * 08 - Line Release + * 09 - Low Value + * + * @return string + */ public function getDutyType(): string { return $this->dutyType; @@ -399,15 +397,15 @@ public function setDutyType(string $dutyType): self return $this; } /** - * residential Indicator that was sent in on the request. - - Valid values: "01","02" - - 01 - Residential - 02 - Commercial - * - * @return string - */ + * residential Indicator that was sent in on the request. + * + * Valid values: "01","02" + * + * 01 - Residential + * 02 - Commercial + * + * @return string + */ public function getResidentialIndicator(): string { return $this->residentialIndicator; @@ -475,12 +473,12 @@ public function setDestinationCountryCode(string $destinationCountryCode): self return $this; } /** - * The shipment destination postal code. Required for US domestic requests. - - Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. - * - * @return string - */ + * The shipment destination postal code. Required for US domestic requests. + * + * Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. + * + * @return string + */ public function getDestinationPostalCode(): string { return $this->destinationPostalCode; @@ -501,12 +499,12 @@ public function setDestinationPostalCode(string $destinationPostalCode): self return $this; } /** - * The shipment destination postal code low range. Value may or may not differ from destinationPostalCode. - - Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. - * - * @return string - */ + * The shipment destination postal code low range. Value may or may not differ from destinationPostalCode. + * + * Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. + * + * @return string + */ public function getDestinationPostalCodeLow(): string { return $this->destinationPostalCodeLow; @@ -527,12 +525,12 @@ public function setDestinationPostalCodeLow(string $destinationPostalCodeLow): s return $this; } /** - * The shipment destination postal code high range. Value may or may not differ from destinationPostalCode. - - Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. - * - * @return string - */ + * The shipment destination postal code high range. Value may or may not differ from destinationPostalCode. + * + * Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. + * + * @return string + */ public function getDestinationPostalCodeHigh(): string { return $this->destinationPostalCodeHigh; @@ -553,14 +551,14 @@ public function setDestinationPostalCodeHigh(string $destinationPostalCodeHigh): return $this; } /** - * The shipment destination state or province. - - For U.S. addresses, the value will be a valid 2-Character value (per U.S. Mail Standards). - - For non-U.S. addresses the full State or Province name will be returned. - * - * @return string - */ + * The shipment destination state or province. + * + * For U.S. addresses, the value will be a valid 2-Character value (per U.S. Mail Standards). + * + * For non-U.S. addresses the full State or Province name will be returned. + * + * @return string + */ public function getDestinationStateProvince(): string { return $this->destinationStateProvince; @@ -583,12 +581,12 @@ public function setDestinationStateProvince(string $destinationStateProvince): s return $this; } /** - * The shipment destination city. - - Required for International requests for those countries that do not utilize postal codes. - * - * @return string - */ + * The shipment destination city. + * + * Required for International requests for those countries that do not utilize postal codes. + * + * @return string + */ public function getDestinationCityName(): string { return $this->destinationCityName; @@ -653,12 +651,12 @@ public function setOriginCountryCode(string $originCountryCode): self return $this; } /** - * The shipment origin postal code. Required for US domestic requests. - - Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. - * - * @return string - */ + * The shipment origin postal code. Required for US domestic requests. + * + * Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. + * + * @return string + */ public function getOriginPostalCode(): string { return $this->originPostalCode; @@ -679,12 +677,12 @@ public function setOriginPostalCode(string $originPostalCode): self return $this; } /** - * The shipment origin postal code low range. Value may or may not differ from destinationPostalCode. - - Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. - * - * @return string - */ + * The shipment origin postal code low range. Value may or may not differ from destinationPostalCode. + * + * Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. + * + * @return string + */ public function getOriginPostalCodeLow(): string { return $this->originPostalCodeLow; @@ -705,12 +703,12 @@ public function setOriginPostalCodeLow(string $originPostalCodeLow): self return $this; } /** - * The shipment origin postal code high range. Value may or may not differ from destinationPostalCode. - - Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. - * - * @return string - */ + * The shipment origin postal code high range. Value may or may not differ from destinationPostalCode. + * + * Either 5, or 9-digit US zip codes must be used for U.S. addresses. For non-US addresses, this is recommended for all countries that utilize postal codes. + * + * @return string + */ public function getOriginPostalCodeHigh(): string { return $this->originPostalCodeHigh; @@ -731,14 +729,14 @@ public function setOriginPostalCodeHigh(string $originPostalCodeHigh): self return $this; } /** - * The shipment origin state or province. - - For U.S. addresses, the value will be a valid 2-Character value (per U.S. Mail Standards). - - For non-U.S. addresses the full State or Province name will be returned. - * - * @return string - */ + * The shipment origin state or province. + * + * For U.S. addresses, the value will be a valid 2-Character value (per U.S. Mail Standards). + * + * For non-U.S. addresses the full State or Province name will be returned. + * + * @return string + */ public function getOriginStateProvince(): string { return $this->originStateProvince; @@ -761,12 +759,12 @@ public function setOriginStateProvince(string $originStateProvince): self return $this; } /** - * The shipment origin city. - - Required for International requests for those countries that do not utilize postal codes. - * - * @return string - */ + * The shipment origin city. + * + * Required for International requests for those countries that do not utilize postal codes. + * + * @return string + */ public function getOriginCityName(): string { return $this->originCityName; @@ -787,12 +785,12 @@ public function setOriginCityName(string $originCityName): self return $this; } /** - * Shipment weight. Value is only required for international shipment. - - Defaults to 0.0 - * - * @return string - */ + * Shipment weight. Value is only required for international shipment. + * + * Defaults to 0.0 + * + * @return string + */ public function getWeight(): string { return $this->weight; @@ -835,12 +833,12 @@ public function setWeightUnitOfMeasure(string $weightUnitOfMeasure): self return $this; } /** - * Shipment contents value. Value is only required for international shipment. - - Defaults to 0.0 - * - * @return string - */ + * Shipment contents value. Value is only required for international shipment. + * + * Defaults to 0.0 + * + * @return string + */ public function getShipmentContentsValue(): string { return $this->shipmentContentsValue; @@ -883,16 +881,16 @@ public function setShipmentContentsCurrencyCode(string $shipmentContentsCurrency return $this; } /** - * Returns TRUE if the shipment dates fall within a defined peak date range. When the guarantee is suspended, it is suspended for all services in the response. - - The logic for determining if guarantees are suspended applies per origin country. - - The following will be used to determine if a shipment falls within a defined peak date range: shipDate (from the response), deliveryDate (from the response), server Date. - - Defined peak date range (range for when guarantees are suspended) is inclusive of start and end dates. - * - * @return bool - */ + * Returns TRUE if the shipment dates fall within a defined peak date range. When the guarantee is suspended, it is suspended for all services in the response. + * + * The logic for determining if guarantees are suspended applies per origin country. + * + * The following will be used to determine if a shipment falls within a defined peak date range: shipDate (from the response), deliveryDate (from the response), server Date. + * + * Defined peak date range (range for when guarantees are suspended) is inclusive of start and end dates. + * + * @return bool + */ public function getGuaranteeSuspended(): bool { return $this->guaranteeSuspended; @@ -939,8 +937,6 @@ public function setNumberOfServices(int $numberOfServices): self return $this; } /** - * - * * @return list */ public function getServices(): array @@ -948,8 +944,6 @@ public function getServices(): array return $this->services; } /** - * - * * @param list $services * * @return self diff --git a/src/Api/Model/ErrorResponse.php b/src/Api/Model/ErrorResponse.php index edaf3cf4..bd765e45 100644 --- a/src/Api/Model/ErrorResponse.php +++ b/src/Api/Model/ErrorResponse.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var ErrorResponseWrapper */ protected $response; /** - * - * * @return ErrorResponseWrapper */ public function getResponse(): ErrorResponseWrapper @@ -28,8 +24,6 @@ public function getResponse(): ErrorResponseWrapper return $this->response; } /** - * - * * @param ErrorResponseWrapper $response * * @return self diff --git a/src/Api/Model/ErrorResponseWrapper.php b/src/Api/Model/ErrorResponseWrapper.php index 79a957c5..823ba664 100644 --- a/src/Api/Model/ErrorResponseWrapper.php +++ b/src/Api/Model/ErrorResponseWrapper.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $errors; /** - * - * * @return list */ public function getErrors(): array @@ -28,8 +24,6 @@ public function getErrors(): array return $this->errors; } /** - * - * * @param list $errors * * @return self diff --git a/src/Api/Model/ExceptionBillToAccount.php b/src/Api/Model/ExceptionBillToAccount.php index f9976bde..55ac491a 100644 --- a/src/Api/Model/ExceptionBillToAccount.php +++ b/src/Api/Model/ExceptionBillToAccount.php @@ -13,16 +13,16 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Indicates how shipping charges for the package were billed. Valid Values: - - 01 - Shipper - - 02 - Consignee Billing - - 03 - Third Party - - 04 - Freight Collect - Indicates how shipping charges for the package were billed. Valid Values: 01 Shipper, 02 Consignee Billing ,03 Third Party, 04 Freight Collect - - * - * @var string - */ + * Indicates how shipping charges for the package were billed. Valid Values: + * - 01 - Shipper + * - 02 - Consignee Billing + * - 03 - Third Party + * - 04 - Freight Collect + * Indicates how shipping charges for the package were billed. Valid Values: 01 Shipper, 02 Consignee Billing ,03 Third Party, 04 Freight Collect + * + * + * @var string + */ protected $option; /** * The UPS Account number to which the shipping charges were billed. @@ -31,16 +31,16 @@ public function isInitialized($property): bool */ protected $number; /** - * Indicates how shipping charges for the package were billed. Valid Values: - - 01 - Shipper - - 02 - Consignee Billing - - 03 - Third Party - - 04 - Freight Collect - Indicates how shipping charges for the package were billed. Valid Values: 01 Shipper, 02 Consignee Billing ,03 Third Party, 04 Freight Collect - - * - * @return string - */ + * Indicates how shipping charges for the package were billed. Valid Values: + * - 01 - Shipper + * - 02 - Consignee Billing + * - 03 - Third Party + * - 04 - Freight Collect + * Indicates how shipping charges for the package were billed. Valid Values: 01 Shipper, 02 Consignee Billing ,03 Third Party, 04 Freight Collect + * + * + * @return string + */ public function getOption(): string { return $this->option; diff --git a/src/Api/Model/ExceptionPackageReferenceNumber.php b/src/Api/Model/ExceptionPackageReferenceNumber.php index 4bb13c66..28787584 100644 --- a/src/Api/Model/ExceptionPackageReferenceNumber.php +++ b/src/Api/Model/ExceptionPackageReferenceNumber.php @@ -25,13 +25,13 @@ public function isInitialized($property): bool */ protected $number; /** - * Reflects what will go on the label as the name of the reference. - - For additional information, refer to the Reference Codes table in the Appendix. - - * - * @var string - */ + * Reflects what will go on the label as the name of the reference. + * + * For additional information, refer to the Reference Codes table in the Appendix. + * + * + * @var string + */ protected $code; /** * Customer supplied reference number. Reference numbers are defined by the shipper and can contain any character string. @@ -84,13 +84,13 @@ public function setNumber(string $number): self return $this; } /** - * Reflects what will go on the label as the name of the reference. - - For additional information, refer to the Reference Codes table in the Appendix. - - * - * @return string - */ + * Reflects what will go on the label as the name of the reference. + * + * For additional information, refer to the Reference Codes table in the Appendix. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ExceptionShipmentReferenceNumber.php b/src/Api/Model/ExceptionShipmentReferenceNumber.php index 89a0d4c6..ac267194 100644 --- a/src/Api/Model/ExceptionShipmentReferenceNumber.php +++ b/src/Api/Model/ExceptionShipmentReferenceNumber.php @@ -25,13 +25,13 @@ public function isInitialized($property): bool */ protected $number; /** - * Reflects what will go on the label as the name of the reference. - - For additional information, refer to the Reference Codes table in the Appendix. - - * - * @var string - */ + * Reflects what will go on the label as the name of the reference. + * + * For additional information, refer to the Reference Codes table in the Appendix. + * + * + * @var string + */ protected $code; /** * Customer supplied reference number. Reference numbers are defined by the shipper and can contain any character string. @@ -84,13 +84,13 @@ public function setNumber(string $number): self return $this; } /** - * Reflects what will go on the label as the name of the reference. - - For additional information, refer to the Reference Codes table in the Appendix. - - * - * @return string - */ + * Reflects what will go on the label as the name of the reference. + * + * For additional information, refer to the Reference Codes table in the Appendix. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ExceptionUpdatedAddress.php b/src/Api/Model/ExceptionUpdatedAddress.php index d9af02b6..ad3536bc 100644 --- a/src/Api/Model/ExceptionUpdatedAddress.php +++ b/src/Api/Model/ExceptionUpdatedAddress.php @@ -50,7 +50,9 @@ public function isInitialized($property): bool protected $streetSuffix; /** * Container for information about updated shipping address. It will be returned if there is any update due to exception. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -219,7 +221,9 @@ public function setStreetSuffix(string $streetSuffix): self } /** * Container for information about updated shipping address. It will be returned if there is any update due to exception. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/ExcludeFromResultPostalCodeList.php b/src/Api/Model/ExcludeFromResultPostalCodeList.php index b140e450..13fac1d8 100644 --- a/src/Api/Model/ExcludeFromResultPostalCodeList.php +++ b/src/Api/Model/ExcludeFromResultPostalCodeList.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $postalCode; /** - * - * * @return list */ public function getPostalCode(): array @@ -28,8 +24,6 @@ public function getPostalCode(): array return $this->postalCode; } /** - * - * * @param list $postalCode * * @return self diff --git a/src/Api/Model/ExistingShipmentIDConfirmationNumber.php b/src/Api/Model/ExistingShipmentIDConfirmationNumber.php index 30ce0be4..a21d3128 100644 --- a/src/Api/Model/ExistingShipmentIDConfirmationNumber.php +++ b/src/Api/Model/ExistingShipmentIDConfirmationNumber.php @@ -13,25 +13,25 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Container for the type of unique pickup confirmation number. - Required only for Shipment Updates. - * - * @var ConfirmationNumberType - */ + * Container for the type of unique pickup confirmation number. + * Required only for Shipment Updates. + * + * @var ConfirmationNumberType + */ protected $type; /** - * The unique pickup confirmation number or BOLID value. - Required only for Shipment Updates. - * - * @var string - */ + * The unique pickup confirmation number or BOLID value. + * Required only for Shipment Updates. + * + * @var string + */ protected $value; /** - * Container for the type of unique pickup confirmation number. - Required only for Shipment Updates. - * - * @return ConfirmationNumberType - */ + * Container for the type of unique pickup confirmation number. + * Required only for Shipment Updates. + * + * @return ConfirmationNumberType + */ public function getType(): ConfirmationNumberType { return $this->type; @@ -51,11 +51,11 @@ public function setType(ConfirmationNumberType $type): self return $this; } /** - * The unique pickup confirmation number or BOLID value. - Required only for Shipment Updates. - * - * @return string - */ + * The unique pickup confirmation number or BOLID value. + * Required only for Shipment Updates. + * + * @return string + */ public function getValue(): string { return $this->value; diff --git a/src/Api/Model/FREIGHTPICKUPRequestWrapper.php b/src/Api/Model/FREIGHTPICKUPRequestWrapper.php index 390e9508..7b9f7c02 100644 --- a/src/Api/Model/FREIGHTPICKUPRequestWrapper.php +++ b/src/Api/Model/FREIGHTPICKUPRequestWrapper.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var FreightPickupRequest */ protected $freightPickupRequest; /** - * - * * @return FreightPickupRequest */ public function getFreightPickupRequest(): FreightPickupRequest @@ -28,8 +24,6 @@ public function getFreightPickupRequest(): FreightPickupRequest return $this->freightPickupRequest; } /** - * - * * @param FreightPickupRequest $freightPickupRequest * * @return self diff --git a/src/Api/Model/FREIGHTSHIPRequestWrapper.php b/src/Api/Model/FREIGHTSHIPRequestWrapper.php index fed1adee..f2ddd381 100644 --- a/src/Api/Model/FREIGHTSHIPRequestWrapper.php +++ b/src/Api/Model/FREIGHTSHIPRequestWrapper.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var FreightShipRequest */ protected $freightShipRequest; /** - * - * * @return FreightShipRequest */ public function getFreightShipRequest(): FreightShipRequest @@ -28,8 +24,6 @@ public function getFreightShipRequest(): FreightShipRequest return $this->freightShipRequest; } /** - * - * * @param FreightShipRequest $freightShipRequest * * @return self diff --git a/src/Api/Model/FRSPaymentInformationType.php b/src/Api/Model/FRSPaymentInformationType.php index fc8348ee..7ec7d4c1 100644 --- a/src/Api/Model/FRSPaymentInformationType.php +++ b/src/Api/Model/FRSPaymentInformationType.php @@ -13,14 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Valid codes: - - 01 = Prepaid - - 02 = FreightCollect - - 03 = ThirdParty - - * - * @var string - */ + * Valid codes: + * - 01 = Prepaid + * - 02 = FreightCollect + * - 03 = ThirdParty + * + * + * @var string + */ protected $code; /** * Specifies the description for Ground Freight Pricing payment type. @@ -29,14 +29,14 @@ public function isInitialized($property): bool */ protected $description; /** - * Valid codes: - - 01 = Prepaid - - 02 = FreightCollect - - 03 = ThirdParty - - * - * @return string - */ + * Valid codes: + * - 01 = Prepaid + * - 02 = FreightCollect + * - 03 = ThirdParty + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/FacilityTimeDayOfWeek.php b/src/Api/Model/FacilityTimeDayOfWeek.php index 40c9698a..6498d8b2 100644 --- a/src/Api/Model/FacilityTimeDayOfWeek.php +++ b/src/Api/Model/FacilityTimeDayOfWeek.php @@ -31,20 +31,20 @@ public function isInitialized($property): bool */ protected $latestDropOfforPickup; /** - * Facility Open Hours. The latest local open time. Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - * - * @var string - */ + * Facility Open Hours. The latest local open time. Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * @var string + */ protected $openHours; /** - * Facility Close Hours. The latest local close time. Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - * - * @var string - */ + * Facility Close Hours. The latest local close time. Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * @var string + */ protected $closeHours; /** * Time required by the facility to prepare your shipment for movement @@ -125,12 +125,12 @@ public function setLatestDropOfforPickup(string $latestDropOfforPickup): self return $this; } /** - * Facility Open Hours. The latest local open time. Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - * - * @return string - */ + * Facility Open Hours. The latest local open time. Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * @return string + */ public function getOpenHours(): string { return $this->openHours; @@ -151,12 +151,12 @@ public function setOpenHours(string $openHours): self return $this; } /** - * Facility Close Hours. The latest local close time. Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - * - * @return string - */ + * Facility Close Hours. The latest local close time. Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * @return string + */ public function getCloseHours(): string { return $this->closeHours; diff --git a/src/Api/Model/FailureNotificationFailureNotificationCode.php b/src/Api/Model/FailureNotificationFailureNotificationCode.php index 8f4180d6..24d12e05 100644 --- a/src/Api/Model/FailureNotificationFailureNotificationCode.php +++ b/src/Api/Model/FailureNotificationFailureNotificationCode.php @@ -13,14 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code representing type of failure email notification. Valid values: - - 01 – Package is ready to pickup at UPS Access Point - Original - - 02 – Package is ready to pickup at UPS Access Point - Reminder - - 03 – Package is delivery to alternate delivery location - - 04 – Package is returned to Sender from UPS Access Point Location - * - * @var string - */ + * Code representing type of failure email notification. Valid values: + * - 01 – Package is ready to pickup at UPS Access Point - Original + * - 02 – Package is ready to pickup at UPS Access Point - Reminder + * - 03 – Package is delivery to alternate delivery location + * - 04 – Package is returned to Sender from UPS Access Point Location + * + * @var string + */ protected $code; /** * Not used. @@ -29,14 +29,14 @@ public function isInitialized($property): bool */ protected $description; /** - * Code representing type of failure email notification. Valid values: - - 01 – Package is ready to pickup at UPS Access Point - Original - - 02 – Package is ready to pickup at UPS Access Point - Reminder - - 03 – Package is delivery to alternate delivery location - - 04 – Package is returned to Sender from UPS Access Point Location - * - * @return string - */ + * Code representing type of failure email notification. Valid values: + * - 01 – Package is ready to pickup at UPS Access Point - Original + * - 02 – Package is ready to pickup at UPS Access Point - Reminder + * - 03 – Package is delivery to alternate delivery location + * - 04 – Package is returned to Sender from UPS Access Point Location + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/FreightOptionsDestinationAddress.php b/src/Api/Model/FreightOptionsDestinationAddress.php index 3a92e77b..b4266757 100644 --- a/src/Api/Model/FreightOptionsDestinationAddress.php +++ b/src/Api/Model/FreightOptionsDestinationAddress.php @@ -19,12 +19,12 @@ public function isInitialized($property): bool */ protected $city; /** - * 1. It means district code for Hong Kong (HK) - 2. It means county for Ireland (IE) - 3. It means state or province for all the postal countries It is required for non-postal countries including HK and IE. - * - * @var string - */ + * 1. It means district code for Hong Kong (HK) + * 2. It means county for Ireland (IE) + * 3. It means state or province for all the postal countries It is required for non-postal countries including HK and IE. + * + * @var string + */ protected $stateProvince; /** * Postal Code for postal countries. It does not apply to non-postal countries such as IE and HK @@ -33,11 +33,11 @@ public function isInitialized($property): bool */ protected $postalCode; /** - * The pickup country or territory code as defined by ISO-3166. - Refer to Country or Territory Codes in the Appendix for valid values. Upper-case two-letter string. - * - * @var string - */ + * The pickup country or territory code as defined by ISO-3166. + * Refer to Country or Territory Codes in the Appendix for valid values. Upper-case two-letter string. + * + * @var string + */ protected $countryCode; /** * The city of pickup address if available. It is required for non-postal country Ireland (IE). @@ -62,12 +62,12 @@ public function setCity(string $city): self return $this; } /** - * 1. It means district code for Hong Kong (HK) - 2. It means county for Ireland (IE) - 3. It means state or province for all the postal countries It is required for non-postal countries including HK and IE. - * - * @return string - */ + * 1. It means district code for Hong Kong (HK) + * 2. It means county for Ireland (IE) + * 3. It means state or province for all the postal countries It is required for non-postal countries including HK and IE. + * + * @return string + */ public function getStateProvince(): string { return $this->stateProvince; @@ -110,11 +110,11 @@ public function setPostalCode(string $postalCode): self return $this; } /** - * The pickup country or territory code as defined by ISO-3166. - Refer to Country or Territory Codes in the Appendix for valid values. Upper-case two-letter string. - * - * @return string - */ + * The pickup country or territory code as defined by ISO-3166. + * Refer to Country or Territory Codes in the Appendix for valid values. Upper-case two-letter string. + * + * @return string + */ public function getCountryCode(): string { return $this->countryCode; diff --git a/src/Api/Model/FreightPickupRequest.php b/src/Api/Model/FreightPickupRequest.php index fbdcb76c..3b865224 100644 --- a/src/Api/Model/FreightPickupRequest.php +++ b/src/Api/Model/FreightPickupRequest.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $request; /** - * Confirmation number of pickup ground freight shipment to modify.� Only use if requesting a pickup modification. - If this element is populated, it must contain a valid confirmation number and all previously supplied populated elements in the original request must be present. - * - * @var string - */ + * Confirmation number of pickup ground freight shipment to modify.� Only use if requesting a pickup modification. + * If this element is populated, it must contain a valid confirmation number and all previously supplied populated elements in the original request must be present. + * + * @var string + */ protected $pickupRequestConfirmationNumber; /** * Destinations postal code. @@ -56,31 +56,31 @@ public function isInitialized($property): bool */ protected $shipTo; /** - * Date of the Pickup. - Format:YYYYMMDD - * - * @var string - */ + * Date of the Pickup. + * Format:YYYYMMDD + * + * @var string + */ protected $pickupDate; /** - * The earliest time a shipment is ready to be picked up. - The time is on a 24 hour clock. - Format: HHMM - HH = Hour values 00 to 23 - MM = Minute values 00 to 59 - * - * @var string - */ + * The earliest time a shipment is ready to be picked up. + * The time is on a 24 hour clock. + * Format: HHMM + * HH = Hour values 00 to 23 + * MM = Minute values 00 to 59 + * + * @var string + */ protected $earliestTimeReady; /** - * The latest time a shipment can be picked up. Can be also referred as the Closing Time for a pickup time window. - The time is on a 24 hour clock. - Format: HHMM - HH = Hour values 00 to 23 - MM = Minute values 00 to 59 - * - * @var string - */ + * The latest time a shipment can be picked up. Can be also referred as the Closing Time for a pickup time window. + * The time is on a 24 hour clock. + * Format: HHMM + * HH = Hour values 00 to 23 + * MM = Minute values 00 to 59 + * + * @var string + */ protected $latestTimeReady; /** * ShipmentServiceOptions container. @@ -89,17 +89,15 @@ public function isInitialized($property): bool */ protected $shipmentServiceOptions; /** - * - * * @var list */ protected $shipmentDetail; /** - * ExistingShipmentID Container. - Request will contain either ShipmentDetail or ExistingShipmentID container. Not both. - * - * @var FreightPickupRequestExistingShipmentID - */ + * ExistingShipmentID Container. + * Request will contain either ShipmentDetail or ExistingShipmentID container. Not both. + * + * @var FreightPickupRequestExistingShipmentID + */ protected $existingShipmentID; /** * An identifier associated to the pickup request when the user elects to include Pickup Notifications for LTL. @@ -114,11 +112,11 @@ public function isInitialized($property): bool */ protected $pickupInstructions; /** - * The location of the freight. - Example: Loading Dock A - * - * @var string - */ + * The location of the freight. + * Example: Loading Dock A + * + * @var string + */ protected $additionalComments; /** * Handling Instructions text @@ -161,11 +159,11 @@ public function setRequest(FreightPickupRequestRequest $request): self return $this; } /** - * Confirmation number of pickup ground freight shipment to modify.� Only use if requesting a pickup modification. - If this element is populated, it must contain a valid confirmation number and all previously supplied populated elements in the original request must be present. - * - * @return string - */ + * Confirmation number of pickup ground freight shipment to modify.� Only use if requesting a pickup modification. + * If this element is populated, it must contain a valid confirmation number and all previously supplied populated elements in the original request must be present. + * + * @return string + */ public function getPickupRequestConfirmationNumber(): string { return $this->pickupRequestConfirmationNumber; @@ -295,11 +293,11 @@ public function setShipTo(FreightPickupRequestShipTo $shipTo): self return $this; } /** - * Date of the Pickup. - Format:YYYYMMDD - * - * @return string - */ + * Date of the Pickup. + * Format:YYYYMMDD + * + * @return string + */ public function getPickupDate(): string { return $this->pickupDate; @@ -319,14 +317,14 @@ public function setPickupDate(string $pickupDate): self return $this; } /** - * The earliest time a shipment is ready to be picked up. - The time is on a 24 hour clock. - Format: HHMM - HH = Hour values 00 to 23 - MM = Minute values 00 to 59 - * - * @return string - */ + * The earliest time a shipment is ready to be picked up. + * The time is on a 24 hour clock. + * Format: HHMM + * HH = Hour values 00 to 23 + * MM = Minute values 00 to 59 + * + * @return string + */ public function getEarliestTimeReady(): string { return $this->earliestTimeReady; @@ -349,14 +347,14 @@ public function setEarliestTimeReady(string $earliestTimeReady): self return $this; } /** - * The latest time a shipment can be picked up. Can be also referred as the Closing Time for a pickup time window. - The time is on a 24 hour clock. - Format: HHMM - HH = Hour values 00 to 23 - MM = Minute values 00 to 59 - * - * @return string - */ + * The latest time a shipment can be picked up. Can be also referred as the Closing Time for a pickup time window. + * The time is on a 24 hour clock. + * Format: HHMM + * HH = Hour values 00 to 23 + * MM = Minute values 00 to 59 + * + * @return string + */ public function getLatestTimeReady(): string { return $this->latestTimeReady; @@ -401,8 +399,6 @@ public function setShipmentServiceOptions(FreightPickupRequestShipmentServiceOpt return $this; } /** - * - * * @return list */ public function getShipmentDetail(): array @@ -410,8 +406,6 @@ public function getShipmentDetail(): array return $this->shipmentDetail; } /** - * - * * @param list $shipmentDetail * * @return self @@ -423,11 +417,11 @@ public function setShipmentDetail(array $shipmentDetail): self return $this; } /** - * ExistingShipmentID Container. - Request will contain either ShipmentDetail or ExistingShipmentID container. Not both. - * - * @return FreightPickupRequestExistingShipmentID - */ + * ExistingShipmentID Container. + * Request will contain either ShipmentDetail or ExistingShipmentID container. Not both. + * + * @return FreightPickupRequestExistingShipmentID + */ public function getExistingShipmentID(): FreightPickupRequestExistingShipmentID { return $this->existingShipmentID; @@ -491,11 +485,11 @@ public function setPickupInstructions(string $pickupInstructions): self return $this; } /** - * The location of the freight. - Example: Loading Dock A - * - * @return string - */ + * The location of the freight. + * Example: Loading Dock A + * + * @return string + */ public function getAdditionalComments(): string { return $this->additionalComments; diff --git a/src/Api/Model/FreightPickupRequestPOM.php b/src/Api/Model/FreightPickupRequestPOM.php index 7dbcaa6e..c71b6d6a 100644 --- a/src/Api/Model/FreightPickupRequestPOM.php +++ b/src/Api/Model/FreightPickupRequestPOM.php @@ -13,18 +13,18 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Identifies the kind of number used to identify the Pickup Notifications for LTL shipment. - Must provide a POMNumber if the POMNumberType field is populated. - * - * @var string - */ + * Identifies the kind of number used to identify the Pickup Notifications for LTL shipment. + * Must provide a POMNumber if the POMNumberType field is populated. + * + * @var string + */ protected $pOMNumber; /** - * Identifies the type used to identify the Pickup Notifications for LTL shipments. Must provide if POMNumber is populated. - For valid values, see POMNumberType Values in the Appendix. The values must match a type defined, case sensitive. - * - * @var string - */ + * Identifies the type used to identify the Pickup Notifications for LTL shipments. Must provide if POMNumber is populated. + * For valid values, see POMNumberType Values in the Appendix. The values must match a type defined, case sensitive. + * + * @var string + */ protected $pOMNumberType; /** * Container for pre-pickup notifications events @@ -33,11 +33,11 @@ public function isInitialized($property): bool */ protected $pickupNotifications; /** - * Identifies the kind of number used to identify the Pickup Notifications for LTL shipment. - Must provide a POMNumber if the POMNumberType field is populated. - * - * @return string - */ + * Identifies the kind of number used to identify the Pickup Notifications for LTL shipment. + * Must provide a POMNumber if the POMNumberType field is populated. + * + * @return string + */ public function getPOMNumber(): string { return $this->pOMNumber; @@ -57,11 +57,11 @@ public function setPOMNumber(string $pOMNumber): self return $this; } /** - * Identifies the type used to identify the Pickup Notifications for LTL shipments. Must provide if POMNumber is populated. - For valid values, see POMNumberType Values in the Appendix. The values must match a type defined, case sensitive. - * - * @return string - */ + * Identifies the type used to identify the Pickup Notifications for LTL shipments. Must provide if POMNumber is populated. + * For valid values, see POMNumberType Values in the Appendix. The values must match a type defined, case sensitive. + * + * @return string + */ public function getPOMNumberType(): string { return $this->pOMNumberType; diff --git a/src/Api/Model/FreightPickupRequestRequest.php b/src/Api/Model/FreightPickupRequestRequest.php index fee92c5f..24cc82ce 100644 --- a/src/Api/Model/FreightPickupRequestRequest.php +++ b/src/Api/Model/FreightPickupRequestRequest.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Type of shipping. - Valid value: 1 - Ground - * - * @var string - */ + * Type of shipping. + * Valid value: 1 - Ground + * + * @var string + */ protected $requestOption; /** * TransactionReference identifies transactions between client and server. @@ -26,11 +26,11 @@ public function isInitialized($property): bool */ protected $transactionReference; /** - * Type of shipping. - Valid value: 1 - Ground - * - * @return string - */ + * Type of shipping. + * Valid value: 1 - Ground + * + * @return string + */ public function getRequestOption(): string { return $this->requestOption; diff --git a/src/Api/Model/FreightPickupRequestShipmentDetail.php b/src/Api/Model/FreightPickupRequestShipmentDetail.php index 09f50635..cae42bd1 100644 --- a/src/Api/Model/FreightPickupRequestShipmentDetail.php +++ b/src/Api/Model/FreightPickupRequestShipmentDetail.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The presence of the tag HazmatIndicator indicates that the commodity is of type dangerous goods. - Required if one or more commodities within the shipment is hazardous. - * - * @var string - */ + * The presence of the tag HazmatIndicator indicates that the commodity is of type dangerous goods. + * Required if one or more commodities within the shipment is hazardous. + * + * @var string + */ protected $hazmatIndicator; /** * PackagingType Container. @@ -44,11 +44,11 @@ public function isInitialized($property): bool */ protected $weight; /** - * The presence of the tag HazmatIndicator indicates that the commodity is of type dangerous goods. - Required if one or more commodities within the shipment is hazardous. - * - * @return string - */ + * The presence of the tag HazmatIndicator indicates that the commodity is of type dangerous goods. + * Required if one or more commodities within the shipment is hazardous. + * + * @return string + */ public function getHazmatIndicator(): string { return $this->hazmatIndicator; diff --git a/src/Api/Model/FreightRateRequest.php b/src/Api/Model/FreightRateRequest.php index 7468da2b..243c16c2 100644 --- a/src/Api/Model/FreightRateRequest.php +++ b/src/Api/Model/FreightRateRequest.php @@ -43,11 +43,11 @@ public function isInitialized($property): bool */ protected $service; /** - * HandlingUnitOne Container. - Required, unless HandlingUnitTwo is present with a value of LOO -LOOSE. - * - * @var FreightRateRequestHandlingUnitOne - */ + * HandlingUnitOne Container. + * Required, unless HandlingUnitTwo is present with a value of LOO -LOOSE. + * + * @var FreightRateRequestHandlingUnitOne + */ protected $handlingUnitOne; /** * HandlingUnit Container. @@ -56,8 +56,6 @@ public function isInitialized($property): bool */ protected $handlingUnitTwo; /** - * - * * @var list */ protected $commodity; @@ -92,19 +90,19 @@ public function isInitialized($property): bool */ protected $handlingUnitWeight; /** - * Indicator used to specify if the user wants to subtract the handling unit weight. - Defaults to false. - - When AdjustedWeightIndicator is set to "true": - - If HandlingUnitWeight is present, the HandlingUnitWeight Value will be subtracted and prorated from the FreightLineItem Weight Value. The subtracted/prorated FreightLineItem Weight will be used for GFP rating. - - If HandlingUnitWeight is not present and the AdjustedWeightValue is present, the adjusted weight value from the FreightLineItem object will be used to do a GFP rating request to UPGF. - - If HandlingUnitWeight is not present and the AdjustedWeightValue is not present, the original weight from the FreightLineItem object will be used to do a GFP rating request to UPGF.In this case, the HandlingUnitWeight value is assume to be zero. - - AdjustedWeightIndicator set to "false": - - The FreightLineItem.Weight will be used for both LTL and GFP rating requests (current functionality). The HandlingUnitWeight or the FreightLineItem.AdjustedWeight will not be used. - * - * @var string - */ + * Indicator used to specify if the user wants to subtract the handling unit weight. + * Defaults to false. + * + * When AdjustedWeightIndicator is set to "true": + * - If HandlingUnitWeight is present, the HandlingUnitWeight Value will be subtracted and prorated from the FreightLineItem Weight Value. The subtracted/prorated FreightLineItem Weight will be used for GFP rating. + * - If HandlingUnitWeight is not present and the AdjustedWeightValue is present, the adjusted weight value from the FreightLineItem object will be used to do a GFP rating request to UPGF. + * - If HandlingUnitWeight is not present and the AdjustedWeightValue is not present, the original weight from the FreightLineItem object will be used to do a GFP rating request to UPGF.In this case, the HandlingUnitWeight value is assume to be zero. + * + * AdjustedWeightIndicator set to "false": + * - The FreightLineItem.Weight will be used for both LTL and GFP rating requests (current functionality). The HandlingUnitWeight or the FreightLineItem.AdjustedWeight will not be used. + * + * @var string + */ protected $adjustedWeightIndicator; /** * Presence of the tag indicates Time in Transit information is requested and will be returned. @@ -113,8 +111,6 @@ public function isInitialized($property): bool */ protected $timeInTransitIndicator; /** - * - * * @var list */ protected $handlingUnits; @@ -125,11 +121,11 @@ public function isInitialized($property): bool */ protected $adjustedHeightIndicator; /** - * The presence of the tag indicates that the rate request is density based. - For Density Based Rating (DBR), the customer must have DBR Contract Service. - * - * @var string - */ + * The presence of the tag indicates that the rate request is density based. + * For Density Based Rating (DBR), the customer must have DBR Contract Service. + * + * @var string + */ protected $densityEligibleIndicator; /** * The presence of this indicator means a Quote Number will be returned for this LTL Freight Rate quote request. @@ -248,11 +244,11 @@ public function setService(FreightRateRequestService $service): self return $this; } /** - * HandlingUnitOne Container. - Required, unless HandlingUnitTwo is present with a value of LOO -LOOSE. - * - * @return FreightRateRequestHandlingUnitOne - */ + * HandlingUnitOne Container. + * Required, unless HandlingUnitTwo is present with a value of LOO -LOOSE. + * + * @return FreightRateRequestHandlingUnitOne + */ public function getHandlingUnitOne(): FreightRateRequestHandlingUnitOne { return $this->handlingUnitOne; @@ -294,8 +290,6 @@ public function setHandlingUnitTwo(FreightRateRequestHandlingUnitTwo $handlingUn return $this; } /** - * - * * @return list */ public function getCommodity(): array @@ -303,8 +297,6 @@ public function getCommodity(): array return $this->commodity; } /** - * - * * @param list $commodity * * @return self @@ -426,19 +418,19 @@ public function setHandlingUnitWeight(FreightRateRequestHandlingUnitWeight $hand return $this; } /** - * Indicator used to specify if the user wants to subtract the handling unit weight. - Defaults to false. - - When AdjustedWeightIndicator is set to "true": - - If HandlingUnitWeight is present, the HandlingUnitWeight Value will be subtracted and prorated from the FreightLineItem Weight Value. The subtracted/prorated FreightLineItem Weight will be used for GFP rating. - - If HandlingUnitWeight is not present and the AdjustedWeightValue is present, the adjusted weight value from the FreightLineItem object will be used to do a GFP rating request to UPGF. - - If HandlingUnitWeight is not present and the AdjustedWeightValue is not present, the original weight from the FreightLineItem object will be used to do a GFP rating request to UPGF.In this case, the HandlingUnitWeight value is assume to be zero. - - AdjustedWeightIndicator set to "false": - - The FreightLineItem.Weight will be used for both LTL and GFP rating requests (current functionality). The HandlingUnitWeight or the FreightLineItem.AdjustedWeight will not be used. - * - * @return string - */ + * Indicator used to specify if the user wants to subtract the handling unit weight. + * Defaults to false. + * + * When AdjustedWeightIndicator is set to "true": + * - If HandlingUnitWeight is present, the HandlingUnitWeight Value will be subtracted and prorated from the FreightLineItem Weight Value. The subtracted/prorated FreightLineItem Weight will be used for GFP rating. + * - If HandlingUnitWeight is not present and the AdjustedWeightValue is present, the adjusted weight value from the FreightLineItem object will be used to do a GFP rating request to UPGF. + * - If HandlingUnitWeight is not present and the AdjustedWeightValue is not present, the original weight from the FreightLineItem object will be used to do a GFP rating request to UPGF.In this case, the HandlingUnitWeight value is assume to be zero. + * + * AdjustedWeightIndicator set to "false": + * - The FreightLineItem.Weight will be used for both LTL and GFP rating requests (current functionality). The HandlingUnitWeight or the FreightLineItem.AdjustedWeight will not be used. + * + * @return string + */ public function getAdjustedWeightIndicator(): string { return $this->adjustedWeightIndicator; @@ -488,8 +480,6 @@ public function setTimeInTransitIndicator(string $timeInTransitIndicator): self return $this; } /** - * - * * @return list */ public function getHandlingUnits(): array @@ -497,8 +487,6 @@ public function getHandlingUnits(): array return $this->handlingUnits; } /** - * - * * @param list $handlingUnits * * @return self @@ -532,11 +520,11 @@ public function setAdjustedHeightIndicator(string $adjustedHeightIndicator): sel return $this; } /** - * The presence of the tag indicates that the rate request is density based. - For Density Based Rating (DBR), the customer must have DBR Contract Service. - * - * @return string - */ + * The presence of the tag indicates that the rate request is density based. + * For Density Based Rating (DBR), the customer must have DBR Contract Service. + * + * @return string + */ public function getDensityEligibleIndicator(): string { return $this->densityEligibleIndicator; diff --git a/src/Api/Model/FreightRateRequestAlternateRateOptions.php b/src/Api/Model/FreightRateRequestAlternateRateOptions.php index 078a3e1e..2389eba9 100644 --- a/src/Api/Model/FreightRateRequestAlternateRateOptions.php +++ b/src/Api/Model/FreightRateRequestAlternateRateOptions.php @@ -13,14 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code for the alternate rate type requested. - Valid values: - 1 = LTL only - 2 = GFP only - 3 = GFP and LTL - * - * @var string - */ + * Code for the alternate rate type requested. + * Valid values: + * 1 = LTL only + * 2 = GFP only + * 3 = GFP and LTL + * + * @var string + */ protected $code; /** * Description of the alternate rate type requested above. @@ -29,14 +29,14 @@ public function isInitialized($property): bool */ protected $description; /** - * Code for the alternate rate type requested. - Valid values: - 1 = LTL only - 2 = GFP only - 3 = GFP and LTL - * - * @return string - */ + * Code for the alternate rate type requested. + * Valid values: + * 1 = LTL only + * 2 = GFP only + * 3 = GFP and LTL + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/FreightRateRequestCommodity.php b/src/Api/Model/FreightRateRequestCommodity.php index c4d8ae1c..d22d6278 100644 --- a/src/Api/Model/FreightRateRequestCommodity.php +++ b/src/Api/Model/FreightRateRequestCommodity.php @@ -55,11 +55,11 @@ public function isInitialized($property): bool */ protected $packagingType; /** - * The presence of the tag DangerousGoodsIndicator indicates that the commodity is of type dangerous goods. - Required for at least one commodity when the dangerous goods accessorial is passed. - * - * @var string - */ + * The presence of the tag DangerousGoodsIndicator indicates that the commodity is of type dangerous goods. + * Required for at least one commodity when the dangerous goods accessorial is passed. + * + * @var string + */ protected $dangerousGoodsIndicator; /** * CommodityValue Container. @@ -68,11 +68,11 @@ public function isInitialized($property): bool */ protected $commodityValue; /** - * Freight Classification. - Refer to Ground Freight Classes in the Appendix for valid values. - * - * @var string - */ + * Freight Classification. + * Refer to Ground Freight Classes in the Appendix for valid values. + * + * @var string + */ protected $freightClass; /** * National Motor Freight Classification Commodity code. @@ -81,11 +81,11 @@ public function isInitialized($property): bool */ protected $nMFCCommodityCode; /** - * Container for National Motor Freight Classification Commodity. This Container is for customers who choose to send the NMFC Prime and sub code as two different fields. - This container is mutually exclusive with NMFCCommodityCode element above. - * - * @var CommodityNMFCCommodity - */ + * Container for National Motor Freight Classification Commodity. This Container is for customers who choose to send the NMFC Prime and sub code as two different fields. + * This container is mutually exclusive with NMFCCommodityCode element above. + * + * @var CommodityNMFCCommodity + */ protected $nMFCCommodity; /** * Unique identifier for the commodity. @@ -242,11 +242,11 @@ public function setPackagingType(CommodityPackagingType $packagingType): self return $this; } /** - * The presence of the tag DangerousGoodsIndicator indicates that the commodity is of type dangerous goods. - Required for at least one commodity when the dangerous goods accessorial is passed. - * - * @return string - */ + * The presence of the tag DangerousGoodsIndicator indicates that the commodity is of type dangerous goods. + * Required for at least one commodity when the dangerous goods accessorial is passed. + * + * @return string + */ public function getDangerousGoodsIndicator(): string { return $this->dangerousGoodsIndicator; @@ -288,11 +288,11 @@ public function setCommodityValue(CommodityCommodityValue $commodityValue): self return $this; } /** - * Freight Classification. - Refer to Ground Freight Classes in the Appendix for valid values. - * - * @return string - */ + * Freight Classification. + * Refer to Ground Freight Classes in the Appendix for valid values. + * + * @return string + */ public function getFreightClass(): string { return $this->freightClass; @@ -334,11 +334,11 @@ public function setNMFCCommodityCode(string $nMFCCommodityCode): self return $this; } /** - * Container for National Motor Freight Classification Commodity. This Container is for customers who choose to send the NMFC Prime and sub code as two different fields. - This container is mutually exclusive with NMFCCommodityCode element above. - * - * @return CommodityNMFCCommodity - */ + * Container for National Motor Freight Classification Commodity. This Container is for customers who choose to send the NMFC Prime and sub code as two different fields. + * This container is mutually exclusive with NMFCCommodityCode element above. + * + * @return CommodityNMFCCommodity + */ public function getNMFCCommodity(): CommodityNMFCCommodity { return $this->nMFCCommodity; diff --git a/src/Api/Model/FreightRateRequestPickupRequest.php b/src/Api/Model/FreightRateRequestPickupRequest.php index 6c839732..d57844a1 100644 --- a/src/Api/Model/FreightRateRequestPickupRequest.php +++ b/src/Api/Model/FreightRateRequestPickupRequest.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Date of the Pickup. - Format: YYYYMMDD - * - * @var string - */ + * Date of the Pickup. + * Format: YYYYMMDD + * + * @var string + */ protected $pickupDate; /** * Additional Pickup comments or instructions. @@ -26,11 +26,11 @@ public function isInitialized($property): bool */ protected $additionalComments; /** - * Date of the Pickup. - Format: YYYYMMDD - * - * @return string - */ + * Date of the Pickup. + * Format: YYYYMMDD + * + * @return string + */ public function getPickupDate(): string { return $this->pickupDate; diff --git a/src/Api/Model/FreightRateRequestRequest.php b/src/Api/Model/FreightRateRequestRequest.php index 3e17980e..85f15d2b 100644 --- a/src/Api/Model/FreightRateRequestRequest.php +++ b/src/Api/Model/FreightRateRequestRequest.php @@ -19,18 +19,18 @@ public function isInitialized($property): bool */ protected $requestOption; /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. - - Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. - - Format: YYMM = Year and month of the release. - Example: 1601 = 2016 January - Supported values: 1601, 1607, 1701, 1707 - * - * @var string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. + * + * Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. + * + * Format: YYMM = Year and month of the release. + * Example: 1601 = 2016 January + * Supported values: 1601, 1607, 1701, 1707 + * + * @var string + */ protected $subVersion; /** * TransactionReference identifies transactions between client and server. @@ -61,18 +61,18 @@ public function setRequestOption(string $requestOption): self return $this; } /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. - - Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. - - Format: YYMM = Year and month of the release. - Example: 1601 = 2016 January - Supported values: 1601, 1607, 1701, 1707 - * - * @return string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. + * + * Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. + * + * Format: YYMM = Year and month of the release. + * Example: 1601 = 2016 January + * Supported values: 1601, 1607, 1701, 1707 + * + * @return string + */ public function getSubVersion(): string { return $this->subVersion; diff --git a/src/Api/Model/FreightRateRequestShipmentServiceOptions.php b/src/Api/Model/FreightRateRequestShipmentServiceOptions.php index 2a1862b6..7931a1c6 100644 --- a/src/Api/Model/FreightRateRequestShipmentServiceOptions.php +++ b/src/Api/Model/FreightRateRequestShipmentServiceOptions.php @@ -25,11 +25,11 @@ public function isInitialized($property): bool */ protected $deliveryOptions; /** - * OverSeasLeg Container. - Accessorial required when origin or destination is Hawaii, Alaska, and Puerto Rico. - * - * @var ShipmentServiceOptionsOverSeasLeg - */ + * OverSeasLeg Container. + * Accessorial required when origin or destination is Hawaii, Alaska, and Puerto Rico. + * + * @var ShipmentServiceOptionsOverSeasLeg + */ protected $overSeasLeg; /** * COD Container. @@ -68,21 +68,21 @@ public function isInitialized($property): bool */ protected $freezableProtectionIndicator; /** - * The presence of the tag ExtremeLengthIndicator indicates that the customs clearance is required. - It is recommended to provide 'LinearFeet' if this indicator is sent. - * - * @var string - */ + * The presence of the tag ExtremeLengthIndicator indicates that the customs clearance is required. + * It is recommended to provide 'LinearFeet' if this indicator is sent. + * + * @var string + */ protected $extremeLengthIndicator; /** - * Dimensional length of the article(s), in 'feet'. - Numeric value greater than '0' (Zero) should be given in LinearFeet. - If Proper LinearFeet is not provided, accurate charge for extreme length articles might not be returned. - If linear feet '0' (Zero) or any non-numeric/invalid character is sent, accurate charge for extreme length articles might not be returned. - Ignored if ExtremeLengthIndicator is not present. - * - * @var string - */ + * Dimensional length of the article(s), in 'feet'. + * Numeric value greater than '0' (Zero) should be given in LinearFeet. + * If Proper LinearFeet is not provided, accurate charge for extreme length articles might not be returned. + * If linear feet '0' (Zero) or any non-numeric/invalid character is sent, accurate charge for extreme length articles might not be returned. + * Ignored if ExtremeLengthIndicator is not present. + * + * @var string + */ protected $linearFeet; /** * Adjusted Height container. @@ -135,11 +135,11 @@ public function setDeliveryOptions(FreightShipmentServiceOptionsDeliveryOptions return $this; } /** - * OverSeasLeg Container. - Accessorial required when origin or destination is Hawaii, Alaska, and Puerto Rico. - * - * @return ShipmentServiceOptionsOverSeasLeg - */ + * OverSeasLeg Container. + * Accessorial required when origin or destination is Hawaii, Alaska, and Puerto Rico. + * + * @return ShipmentServiceOptionsOverSeasLeg + */ public function getOverSeasLeg(): ShipmentServiceOptionsOverSeasLeg { return $this->overSeasLeg; @@ -291,11 +291,11 @@ public function setFreezableProtectionIndicator(string $freezableProtectionIndic return $this; } /** - * The presence of the tag ExtremeLengthIndicator indicates that the customs clearance is required. - It is recommended to provide 'LinearFeet' if this indicator is sent. - * - * @return string - */ + * The presence of the tag ExtremeLengthIndicator indicates that the customs clearance is required. + * It is recommended to provide 'LinearFeet' if this indicator is sent. + * + * @return string + */ public function getExtremeLengthIndicator(): string { return $this->extremeLengthIndicator; @@ -315,14 +315,14 @@ public function setExtremeLengthIndicator(string $extremeLengthIndicator): self return $this; } /** - * Dimensional length of the article(s), in 'feet'. - Numeric value greater than '0' (Zero) should be given in LinearFeet. - If Proper LinearFeet is not provided, accurate charge for extreme length articles might not be returned. - If linear feet '0' (Zero) or any non-numeric/invalid character is sent, accurate charge for extreme length articles might not be returned. - Ignored if ExtremeLengthIndicator is not present. - * - * @return string - */ + * Dimensional length of the article(s), in 'feet'. + * Numeric value greater than '0' (Zero) should be given in LinearFeet. + * If Proper LinearFeet is not provided, accurate charge for extreme length articles might not be returned. + * If linear feet '0' (Zero) or any non-numeric/invalid character is sent, accurate charge for extreme length articles might not be returned. + * Ignored if ExtremeLengthIndicator is not present. + * + * @return string + */ public function getLinearFeet(): string { return $this->linearFeet; diff --git a/src/Api/Model/FreightRateResponse.php b/src/Api/Model/FreightRateResponse.php index 90a2c5b8..8f63c546 100644 --- a/src/Api/Model/FreightRateResponse.php +++ b/src/Api/Model/FreightRateResponse.php @@ -19,8 +19,6 @@ public function isInitialized($property): bool */ protected $response; /** - * - * * @var list */ protected $rate; @@ -31,8 +29,6 @@ public function isInitialized($property): bool */ protected $freightDensityRate; /** - * - * * @var list */ protected $commodity; @@ -73,8 +69,6 @@ public function isInitialized($property): bool */ protected $minimumChargeAppliedIndicator; /** - * - * * @var list */ protected $alternateRatesResponse; @@ -85,11 +79,11 @@ public function isInitialized($property): bool */ protected $timeInTransit; /** - * Handling Unit Container for Density based rating. - Returned if Shipper is eligible for density based pricing. - * - * @var FreightRateResponseHandlingUnits - */ + * Handling Unit Container for Density based rating. + * Returned if Shipper is eligible for density based pricing. + * + * @var FreightRateResponseHandlingUnits + */ protected $handlingUnits; /** * The Quote Number returned in the response associated to the specific LTL Freight Rate returned in the response. @@ -120,8 +114,6 @@ public function setResponse(FreightRateResponseResponse $response): self return $this; } /** - * - * * @return list */ public function getRate(): array @@ -129,8 +121,6 @@ public function getRate(): array return $this->rate; } /** - * - * * @param list $rate * * @return self @@ -164,8 +154,6 @@ public function setFreightDensityRate(FreightRateResponseFreightDensityRate $fre return $this; } /** - * - * * @return list */ public function getCommodity(): array @@ -173,8 +161,6 @@ public function getCommodity(): array return $this->commodity; } /** - * - * * @param list $commodity * * @return self @@ -318,8 +304,6 @@ public function setMinimumChargeAppliedIndicator(string $minimumChargeAppliedInd return $this; } /** - * - * * @return list */ public function getAlternateRatesResponse(): array @@ -327,8 +311,6 @@ public function getAlternateRatesResponse(): array return $this->alternateRatesResponse; } /** - * - * * @param list $alternateRatesResponse * * @return self @@ -362,11 +344,11 @@ public function setTimeInTransit(FreightRateResponseTimeInTransit $timeInTransit return $this; } /** - * Handling Unit Container for Density based rating. - Returned if Shipper is eligible for density based pricing. - * - * @return FreightRateResponseHandlingUnits - */ + * Handling Unit Container for Density based rating. + * Returned if Shipper is eligible for density based pricing. + * + * @return FreightRateResponseHandlingUnits + */ public function getHandlingUnits(): FreightRateResponseHandlingUnits { return $this->handlingUnits; diff --git a/src/Api/Model/FreightRateResponseAlternateRatesResponse.php b/src/Api/Model/FreightRateResponseAlternateRatesResponse.php index ab135ee4..3e489b3e 100644 --- a/src/Api/Model/FreightRateResponseAlternateRatesResponse.php +++ b/src/Api/Model/FreightRateResponseAlternateRatesResponse.php @@ -19,8 +19,6 @@ public function isInitialized($property): bool */ protected $alternateRateType; /** - * - * * @var list */ protected $rate; @@ -65,8 +63,6 @@ public function setAlternateRateType(AlternateRatesResponseAlternateRateType $al return $this; } /** - * - * * @return list */ public function getRate(): array @@ -74,8 +70,6 @@ public function getRate(): array return $this->rate; } /** - * - * * @param list $rate * * @return self diff --git a/src/Api/Model/FreightRateResponseResponse.php b/src/Api/Model/FreightRateResponseResponse.php index 3ee26bce..a493629b 100644 --- a/src/Api/Model/FreightRateResponseResponse.php +++ b/src/Api/Model/FreightRateResponseResponse.php @@ -19,8 +19,6 @@ public function isInitialized($property): bool */ protected $responseStatus; /** - * - * * @var list */ protected $alert; @@ -53,8 +51,6 @@ public function setResponseStatus(ResponseResponseStatus $responseStatus): self return $this; } /** - * - * * @return list */ public function getAlert(): array @@ -62,8 +58,6 @@ public function getAlert(): array return $this->alert; } /** - * - * * @param list $alert * * @return self diff --git a/src/Api/Model/FreightShipPickupNotificationsEMailNotification.php b/src/Api/Model/FreightShipPickupNotificationsEMailNotification.php index 832be63f..5ba4f306 100644 --- a/src/Api/Model/FreightShipPickupNotificationsEMailNotification.php +++ b/src/Api/Model/FreightShipPickupNotificationsEMailNotification.php @@ -19,14 +19,14 @@ public function isInitialized($property): bool */ protected $eMailAddress; /** - * Type of event for POM Notification. Add up to four events. - 01 = PICKUP_REQUEST_CONFIRM - 02 = DRIVER_EN_ROUTE - 03 = PICKUP_SECURED - 04 = PICKUP_EXCEPTION - * - * @var string - */ + * Type of event for POM Notification. Add up to four events. + * 01 = PICKUP_REQUEST_CONFIRM + * 02 = DRIVER_EN_ROUTE + * 03 = PICKUP_SECURED + * 04 = PICKUP_EXCEPTION + * + * @var string + */ protected $eventType; /** * Email address which should receive pre-pickup notification @@ -51,14 +51,14 @@ public function setEMailAddress(string $eMailAddress): self return $this; } /** - * Type of event for POM Notification. Add up to four events. - 01 = PICKUP_REQUEST_CONFIRM - 02 = DRIVER_EN_ROUTE - 03 = PICKUP_SECURED - 04 = PICKUP_EXCEPTION - * - * @return string - */ + * Type of event for POM Notification. Add up to four events. + * 01 = PICKUP_REQUEST_CONFIRM + * 02 = DRIVER_EN_ROUTE + * 03 = PICKUP_SECURED + * 04 = PICKUP_EXCEPTION + * + * @return string + */ public function getEventType(): string { return $this->eventType; diff --git a/src/Api/Model/FreightShipRequestRequest.php b/src/Api/Model/FreightShipRequestRequest.php index 9889a7e4..7c25da70 100644 --- a/src/Api/Model/FreightShipRequestRequest.php +++ b/src/Api/Model/FreightShipRequestRequest.php @@ -13,25 +13,25 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Type of Shipping desired. - Valid value: 1 - Ground Freight Shipping - * - * @var string - */ + * Type of Shipping desired. + * Valid value: 1 - Ground Freight Shipping + * + * @var string + */ protected $requestOption; /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. - - Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. - - Format: YYMM = Year and month of the release. - Example: 1601 = 2016 January - Supported values: 1601, 1607 - * - * @var string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. + * + * Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. + * + * Format: YYMM = Year and month of the release. + * Example: 1601 = 2016 January + * Supported values: 1601, 1607 + * + * @var string + */ protected $subVersion; /** * TransactionReference identifies transactions between client and server. @@ -40,11 +40,11 @@ public function isInitialized($property): bool */ protected $transactionReference; /** - * Type of Shipping desired. - Valid value: 1 - Ground Freight Shipping - * - * @return string - */ + * Type of Shipping desired. + * Valid value: 1 - Ground Freight Shipping + * + * @return string + */ public function getRequestOption(): string { return $this->requestOption; @@ -64,18 +64,18 @@ public function setRequestOption(string $requestOption): self return $this; } /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. - - Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. - - Format: YYMM = Year and month of the release. - Example: 1601 = 2016 January - Supported values: 1601, 1607 - * - * @return string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. + * + * Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. + * + * Format: YYMM = Year and month of the release. + * Example: 1601 = 2016 January + * Supported values: 1601, 1607 + * + * @return string + */ public function getSubVersion(): string { return $this->subVersion; diff --git a/src/Api/Model/FreightShipRequestShipment.php b/src/Api/Model/FreightShipRequestShipment.php index a57c0c99..6c4c5781 100644 --- a/src/Api/Model/FreightShipRequestShipment.php +++ b/src/Api/Model/FreightShipRequestShipment.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $shipFrom; /** - * Shipper�s six digit account number. - Size must be six alphanumeric characters. Must be associated with the User Id specified in the Access Request XML. - * - * @var string - */ + * Shipper�s six digit account number. + * Size must be six alphanumeric characters. Must be associated with the User Id specified in the Access Request XML. + * + * @var string + */ protected $shipperNumber; /** * ShipTo Container. @@ -44,11 +44,11 @@ public function isInitialized($property): bool */ protected $service; /** - * HandlingUnit Container. - Required for Ground Shipments. - * - * @var ShipmentHandlingUnitOne - */ + * HandlingUnit Container. + * Required for Ground Shipments. + * + * @var ShipmentHandlingUnitOne + */ protected $handlingUnitOne; /** * HandlingUnit Container. @@ -63,11 +63,11 @@ public function isInitialized($property): bool */ protected $existingShipmentID; /** - * General purpose instructions to the driver. - Example: Call 30 minutes before - * - * @var string - */ + * General purpose instructions to the driver. + * Example: Call 30 minutes before + * + * @var string + */ protected $handlingInstructions; /** * Delivery Instructions. @@ -82,14 +82,10 @@ public function isInitialized($property): bool */ protected $pickupInstructions; /** - * - * * @var list */ protected $commodity; /** - * - * * @var list */ protected $reference; @@ -152,11 +148,11 @@ public function setShipFrom(FreightShipShipmentShipFrom $shipFrom): self return $this; } /** - * Shipper�s six digit account number. - Size must be six alphanumeric characters. Must be associated with the User Id specified in the Access Request XML. - * - * @return string - */ + * Shipper�s six digit account number. + * Size must be six alphanumeric characters. Must be associated with the User Id specified in the Access Request XML. + * + * @return string + */ public function getShipperNumber(): string { return $this->shipperNumber; @@ -242,11 +238,11 @@ public function setService(ShipmentService $service): self return $this; } /** - * HandlingUnit Container. - Required for Ground Shipments. - * - * @return ShipmentHandlingUnitOne - */ + * HandlingUnit Container. + * Required for Ground Shipments. + * + * @return ShipmentHandlingUnitOne + */ public function getHandlingUnitOne(): ShipmentHandlingUnitOne { return $this->handlingUnitOne; @@ -310,11 +306,11 @@ public function setExistingShipmentID(ShipmentExistingShipmentID $existingShipme return $this; } /** - * General purpose instructions to the driver. - Example: Call 30 minutes before - * - * @return string - */ + * General purpose instructions to the driver. + * Example: Call 30 minutes before + * + * @return string + */ public function getHandlingInstructions(): string { return $this->handlingInstructions; @@ -378,8 +374,6 @@ public function setPickupInstructions(string $pickupInstructions): self return $this; } /** - * - * * @return list */ public function getCommodity(): array @@ -387,8 +381,6 @@ public function getCommodity(): array return $this->commodity; } /** - * - * * @param list $commodity * * @return self @@ -400,8 +392,6 @@ public function setCommodity(array $commodity): self return $this; } /** - * - * * @return list */ public function getReference(): array @@ -409,8 +399,6 @@ public function getReference(): array return $this->reference; } /** - * - * * @param list $reference * * @return self diff --git a/src/Api/Model/FreightShipResponseShipmentResults.php b/src/Api/Model/FreightShipResponseShipmentResults.php index 202f5441..ab19b030 100644 --- a/src/Api/Model/FreightShipResponseShipmentResults.php +++ b/src/Api/Model/FreightShipResponseShipmentResults.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $pickupRequestConfirmationNumber; /** - * Estimated date that the shipment will be delivered. - Format: YYYYMMDD. - * - * @var string - */ + * Estimated date that the shipment will be delivered. + * Format: YYYYMMDD. + * + * @var string + */ protected $deliveryDate; /** * The shipment Number assigned to the shipment. @@ -50,8 +50,6 @@ public function isInitialized($property): bool */ protected $minimumChargeAppliedIndicator; /** - * - * * @var list */ protected $rate; @@ -114,11 +112,11 @@ public function setPickupRequestConfirmationNumber(string $pickupRequestConfirma return $this; } /** - * Estimated date that the shipment will be delivered. - Format: YYYYMMDD. - * - * @return string - */ + * Estimated date that the shipment will be delivered. + * Format: YYYYMMDD. + * + * @return string + */ public function getDeliveryDate(): string { return $this->deliveryDate; @@ -226,8 +224,6 @@ public function setMinimumChargeAppliedIndicator(string $minimumChargeAppliedInd return $this; } /** - * - * * @return list */ public function getRate(): array @@ -235,8 +231,6 @@ public function getRate(): array return $this->rate; } /** - * - * * @param list $rate * * @return self diff --git a/src/Api/Model/FreightShipShipmentShipFrom.php b/src/Api/Model/FreightShipShipmentShipFrom.php index d84c114f..d91e2b9d 100644 --- a/src/Api/Model/FreightShipShipmentShipFrom.php +++ b/src/Api/Model/FreightShipShipmentShipFrom.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $name; /** - * Company�s Tax Identification Number at the pickup location. - Required if SED form (International forms) is requested - * - * @var string - */ + * Company�s Tax Identification Number at the pickup location. + * Required if SED form (International forms) is requested + * + * @var string + */ protected $taxIdentificationNumber; /** * Shipper�s Address Container. @@ -78,11 +78,11 @@ public function setName(string $name): self return $this; } /** - * Company�s Tax Identification Number at the pickup location. - Required if SED form (International forms) is requested - * - * @return string - */ + * Company�s Tax Identification Number at the pickup location. + * Required if SED form (International forms) is requested + * + * @return string + */ public function getTaxIdentificationNumber(): string { return $this->taxIdentificationNumber; diff --git a/src/Api/Model/FreightShipShipmentShipmentServiceOptions.php b/src/Api/Model/FreightShipShipmentShipmentServiceOptions.php index 41d82b5e..f4e8de27 100644 --- a/src/Api/Model/FreightShipShipmentShipmentServiceOptions.php +++ b/src/Api/Model/FreightShipShipmentShipmentServiceOptions.php @@ -13,8 +13,6 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $eMailInformation; @@ -31,11 +29,11 @@ public function isInitialized($property): bool */ protected $deliveryOptions; /** - * OverSeasLeg Container. - Accessorial required when origin or destination is Hawaii, Alaska, and Puerto Rico. - * - * @var ShipmentServiceOptionsOverSeasLeg - */ + * OverSeasLeg Container. + * Accessorial required when origin or destination is Hawaii, Alaska, and Puerto Rico. + * + * @var ShipmentServiceOptionsOverSeasLeg + */ protected $overSeasLeg; /** * COD Container. @@ -80,25 +78,23 @@ public function isInitialized($property): bool */ protected $freezableProtectionIndicator; /** - * The presence of the tag ExtremeLengthIndicator indicates that the customs clearance is required. - It is recommended to provide 'LinearFeet' if this indicator is sent. - * - * @var string - */ + * The presence of the tag ExtremeLengthIndicator indicates that the customs clearance is required. + * It is recommended to provide 'LinearFeet' if this indicator is sent. + * + * @var string + */ protected $extremeLengthIndicator; /** - * Dimensional length of the article(s), in 'feet'. - Numeric value greater than �0� (Zero) should be given in LinearFeet. - If Proper LinearFeet is not provided, accurate charge for extreme length articles might not be returned. - If linear feet �0� (Zero) or any non-numeric/invalid character is sent, accurate charge for extreme length articles might not be returned. - Ignored if ExtremeLengthIndicator is not present. - * - * @var string - */ + * Dimensional length of the article(s), in 'feet'. + * Numeric value greater than �0� (Zero) should be given in LinearFeet. + * If Proper LinearFeet is not provided, accurate charge for extreme length articles might not be returned. + * If linear feet �0� (Zero) or any non-numeric/invalid character is sent, accurate charge for extreme length articles might not be returned. + * Ignored if ExtremeLengthIndicator is not present. + * + * @var string + */ protected $linearFeet; /** - * - * * @return list */ public function getEMailInformation(): array @@ -106,8 +102,6 @@ public function getEMailInformation(): array return $this->eMailInformation; } /** - * - * * @param list $eMailInformation * * @return self @@ -163,11 +157,11 @@ public function setDeliveryOptions(FreightShipmentServiceOptionsDeliveryOptions return $this; } /** - * OverSeasLeg Container. - Accessorial required when origin or destination is Hawaii, Alaska, and Puerto Rico. - * - * @return ShipmentServiceOptionsOverSeasLeg - */ + * OverSeasLeg Container. + * Accessorial required when origin or destination is Hawaii, Alaska, and Puerto Rico. + * + * @return ShipmentServiceOptionsOverSeasLeg + */ public function getOverSeasLeg(): ShipmentServiceOptionsOverSeasLeg { return $this->overSeasLeg; @@ -341,11 +335,11 @@ public function setFreezableProtectionIndicator(string $freezableProtectionIndic return $this; } /** - * The presence of the tag ExtremeLengthIndicator indicates that the customs clearance is required. - It is recommended to provide 'LinearFeet' if this indicator is sent. - * - * @return string - */ + * The presence of the tag ExtremeLengthIndicator indicates that the customs clearance is required. + * It is recommended to provide 'LinearFeet' if this indicator is sent. + * + * @return string + */ public function getExtremeLengthIndicator(): string { return $this->extremeLengthIndicator; @@ -365,14 +359,14 @@ public function setExtremeLengthIndicator(string $extremeLengthIndicator): self return $this; } /** - * Dimensional length of the article(s), in 'feet'. - Numeric value greater than �0� (Zero) should be given in LinearFeet. - If Proper LinearFeet is not provided, accurate charge for extreme length articles might not be returned. - If linear feet �0� (Zero) or any non-numeric/invalid character is sent, accurate charge for extreme length articles might not be returned. - Ignored if ExtremeLengthIndicator is not present. - * - * @return string - */ + * Dimensional length of the article(s), in 'feet'. + * Numeric value greater than �0� (Zero) should be given in LinearFeet. + * If Proper LinearFeet is not provided, accurate charge for extreme length articles might not be returned. + * If linear feet �0� (Zero) or any non-numeric/invalid character is sent, accurate charge for extreme length articles might not be returned. + * Ignored if ExtremeLengthIndicator is not present. + * + * @return string + */ public function getLinearFeet(): string { return $this->linearFeet; diff --git a/src/Api/Model/FreightShipmentInformationFreightDensityInfo.php b/src/Api/Model/FreightShipmentInformationFreightDensityInfo.php index 1c469692..a47312b0 100644 --- a/src/Api/Model/FreightShipmentInformationFreightDensityInfo.php +++ b/src/Api/Model/FreightShipmentInformationFreightDensityInfo.php @@ -25,8 +25,6 @@ public function isInitialized($property): bool */ protected $adjustedHeight; /** - * - * * @var list */ protected $handlingUnits; @@ -75,8 +73,6 @@ public function setAdjustedHeight(FreightDensityInfoAdjustedHeight $adjustedHeig return $this; } /** - * - * * @return list */ public function getHandlingUnits(): array @@ -84,8 +80,6 @@ public function getHandlingUnits(): array return $this->handlingUnits; } /** - * - * * @param list $handlingUnits * * @return self diff --git a/src/Api/Model/GenericBillToAccount.php b/src/Api/Model/GenericBillToAccount.php index 6ab76ce6..ae300972 100644 --- a/src/Api/Model/GenericBillToAccount.php +++ b/src/Api/Model/GenericBillToAccount.php @@ -13,17 +13,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Indicates how shipping charges for the package were billed. - Valid Values: 01, 02, 03, 04, 99 - Value Definitions: - 01 Shipper - 02 Consignee Billing - 03 Third Party - 04 Freight Collect - 99 International Bill Option - * - * @var string - */ + * Indicates how shipping charges for the package were billed. + * Valid Values: 01, 02, 03, 04, 99 + * Value Definitions: + * 01 Shipper + * 02 Consignee Billing + * 03 Third Party + * 04 Freight Collect + * 99 International Bill Option + * + * @var string + */ protected $option; /** * The UPS Account number to which the shipping charges were billed. @@ -32,17 +32,17 @@ public function isInitialized($property): bool */ protected $number; /** - * Indicates how shipping charges for the package were billed. - Valid Values: 01, 02, 03, 04, 99 - Value Definitions: - 01 Shipper - 02 Consignee Billing - 03 Third Party - 04 Freight Collect - 99 International Bill Option - * - * @return string - */ + * Indicates how shipping charges for the package were billed. + * Valid Values: 01, 02, 03, 04, 99 + * Value Definitions: + * 01 Shipper + * 02 Consignee Billing + * 03 Third Party + * 04 Freight Collect + * 99 International Bill Option + * + * @return string + */ public function getOption(): string { return $this->option; diff --git a/src/Api/Model/GenericPackageReferenceNumber.php b/src/Api/Model/GenericPackageReferenceNumber.php index 98f1d5a2..303387cb 100644 --- a/src/Api/Model/GenericPackageReferenceNumber.php +++ b/src/Api/Model/GenericPackageReferenceNumber.php @@ -25,11 +25,11 @@ public function isInitialized($property): bool */ protected $number; /** - * Reflects what will go on the label as the name of the reference. - For addition information, refer to the Service Codes table in the Appendix. - * - * @var string - */ + * Reflects what will go on the label as the name of the reference. + * For addition information, refer to the Service Codes table in the Appendix. + * + * @var string + */ protected $code; /** * Customer supplied reference number. Reference numbers are defined by the shipper and can contain any character string. @@ -82,11 +82,11 @@ public function setNumber(string $number): self return $this; } /** - * Reflects what will go on the label as the name of the reference. - For addition information, refer to the Service Codes table in the Appendix. - * - * @return string - */ + * Reflects what will go on the label as the name of the reference. + * For addition information, refer to the Service Codes table in the Appendix. + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/GenericShipmentReferenceNumber.php b/src/Api/Model/GenericShipmentReferenceNumber.php index a8dbf27e..5daba3eb 100644 --- a/src/Api/Model/GenericShipmentReferenceNumber.php +++ b/src/Api/Model/GenericShipmentReferenceNumber.php @@ -25,11 +25,11 @@ public function isInitialized($property): bool */ protected $number; /** - * Reflects what will go on the label as the name of the reference. - For addition information, refer to the Service Codes table in the Appendix. - * - * @var string - */ + * Reflects what will go on the label as the name of the reference. + * For addition information, refer to the Service Codes table in the Appendix. + * + * @var string + */ protected $code; /** * Customer supplied reference number. Reference numbers are defined by the shipper and can contain any character string. @@ -82,11 +82,11 @@ public function setNumber(string $number): self return $this; } /** - * Reflects what will go on the label as the name of the reference. - For addition information, refer to the Service Codes table in the Appendix. - * - * @return string - */ + * Reflects what will go on the label as the name of the reference. + * For addition information, refer to the Service Codes table in the Appendix. + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/HandlingChargeAmount.php b/src/Api/Model/HandlingChargeAmount.php index 1a361a10..0bbd93d6 100644 --- a/src/Api/Model/HandlingChargeAmount.php +++ b/src/Api/Model/HandlingChargeAmount.php @@ -19,18 +19,18 @@ public function isInitialized($property): bool */ protected $currencyCode; /** - * Handling Charge amount. - Negative value allowed. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @var string - */ + * Handling Charge amount. + * Negative value allowed. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @var string + */ protected $monetaryValue; /** * Handling charge amount currency type. @@ -55,18 +55,18 @@ public function setCurrencyCode(string $currencyCode): self return $this; } /** - * Handling Charge amount. - Negative value allowed. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @return string - */ + * Handling Charge amount. + * Negative value allowed. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @return string + */ public function getMonetaryValue(): string { return $this->monetaryValue; diff --git a/src/Api/Model/HazMatHazMatChemicalRecord.php b/src/Api/Model/HazMatHazMatChemicalRecord.php index 4550bf2b..810dfdff 100644 --- a/src/Api/Model/HazMatHazMatChemicalRecord.php +++ b/src/Api/Model/HazMatHazMatChemicalRecord.php @@ -103,13 +103,13 @@ public function isInitialized($property): bool */ protected $technicalName; /** - * Additional remarks or special provision information. Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. - - Additional information that may be required by regulation about a hazardous material, such as, "Limited Quantity", DOT-SP numbers, EX numbers. Applies only if SubVersion is greater than or equal to 1701. - - * - * @var string - */ + * Additional remarks or special provision information. Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. + * + * Additional information that may be required by regulation about a hazardous material, such as, "Limited Quantity", DOT-SP numbers, EX numbers. Applies only if SubVersion is greater than or equal to 1701. + * + * + * @var string + */ protected $additionalDescription; /** * The package type code identifying the type of packaging used for the commodity. (Ex: Fiberboard Box). Required if CommodityRegulatedLevelCode = LQ or FR. Applies only if SubVersion is greater than or equal to 1701. @@ -478,13 +478,13 @@ public function setTechnicalName(string $technicalName): self return $this; } /** - * Additional remarks or special provision information. Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. - - Additional information that may be required by regulation about a hazardous material, such as, "Limited Quantity", DOT-SP numbers, EX numbers. Applies only if SubVersion is greater than or equal to 1701. - - * - * @return string - */ + * Additional remarks or special provision information. Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. + * + * Additional information that may be required by regulation about a hazardous material, such as, "Limited Quantity", DOT-SP numbers, EX numbers. Applies only if SubVersion is greater than or equal to 1701. + * + * + * @return string + */ public function getAdditionalDescription(): string { return $this->additionalDescription; diff --git a/src/Api/Model/HighValueReportImageImageFormat.php b/src/Api/Model/HighValueReportImageImageFormat.php index e48a99be..f2a61e45 100644 --- a/src/Api/Model/HighValueReportImageImageFormat.php +++ b/src/Api/Model/HighValueReportImageImageFormat.php @@ -13,14 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code representing the format in which the High Value Report is generated. - - Valid values: - - PDF = pdf. - - * - * @var string - */ + * Code representing the format in which the High Value Report is generated. + * + * Valid values: + * - PDF = pdf. + * + * + * @var string + */ protected $code; /** * Description of the High Value Report image format code. @@ -29,14 +29,14 @@ public function isInitialized($property): bool */ protected $description; /** - * Code representing the format in which the High Value Report is generated. - - Valid values: - - PDF = pdf. - - * - * @return string - */ + * Code representing the format in which the High Value Report is generated. + * + * Valid values: + * - PDF = pdf. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ImagePrintFormat.php b/src/Api/Model/ImagePrintFormat.php index c24b9082..9a4772bd 100644 --- a/src/Api/Model/ImagePrintFormat.php +++ b/src/Api/Model/ImagePrintFormat.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Print Format of the image contained in Documents Image. - Valid values: - 01 � Laser - 02 - Thermal - * - * @var string - */ + * Print Format of the image contained in Documents Image. + * Valid values: + * 01 � Laser + * 02 - Thermal + * + * @var string + */ protected $code; /** * Description of the print format of the image contained in Documents Image. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $description; /** - * Print Format of the image contained in Documents Image. - Valid values: - 01 � Laser - 02 - Thermal - * - * @return string - */ + * Print Format of the image contained in Documents Image. + * Valid values: + * 01 � Laser + * 02 - Thermal + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/IncludeCriteriaServiceOfferingList.php b/src/Api/Model/IncludeCriteriaServiceOfferingList.php index 18048761..75fd66fa 100644 --- a/src/Api/Model/IncludeCriteriaServiceOfferingList.php +++ b/src/Api/Model/IncludeCriteriaServiceOfferingList.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $serviceOffering; /** - * - * * @return list */ public function getServiceOffering(): array @@ -28,8 +24,6 @@ public function getServiceOffering(): array return $this->serviceOffering; } /** - * - * * @param list $serviceOffering * * @return self diff --git a/src/Api/Model/InquireNumbers.php b/src/Api/Model/InquireNumbers.php index 0b5557f5..fb378425 100644 --- a/src/Api/Model/InquireNumbers.php +++ b/src/Api/Model/InquireNumbers.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $inquiryNumbers; /** - * - * * @return list */ public function getInquiryNumbers(): array @@ -28,8 +24,6 @@ public function getInquiryNumbers(): array return $this->inquiryNumbers; } /** - * - * * @param list $inquiryNumbers * * @return self diff --git a/src/Api/Model/InternationalFormsCN22Form.php b/src/Api/Model/InternationalFormsCN22Form.php index 3feb89b3..3b671081 100644 --- a/src/Api/Model/InternationalFormsCN22Form.php +++ b/src/Api/Model/InternationalFormsCN22Form.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Provide the valid values: - 6 = 4X6 - 1 = 8.5X11 - Required if the CN22 form container is present. - * - * @var string - */ + * Provide the valid values: + * 6 = 4X6 + * 1 = 8.5X11 + * Required if the CN22 form container is present. + * + * @var string + */ protected $labelSize; /** * Number of label per page. Currently 1 per page is supported. Required if the CN22 form container is present. @@ -28,21 +28,21 @@ public function isInitialized($property): bool */ protected $printsPerPage; /** - * Valid Values are pdf, png, gif, zpl, star, epl2 and spl. - Required if the CN22 form container is present. - * - * @var string - */ + * Valid Values are pdf, png, gif, zpl, star, epl2 and spl. + * Required if the CN22 form container is present. + * + * @var string + */ protected $labelPrintType; /** - * Valid values: - 1 = GIFT - 2 = DOCUMENTS - 3 = COMMERCIAL SAMPLE - 4 = OTHER Required if the CN22 form container is present. - * - * @var string - */ + * Valid values: + * 1 = GIFT + * 2 = DOCUMENTS + * 3 = COMMERCIAL SAMPLE + * 4 = OTHER Required if the CN22 form container is present. + * + * @var string + */ protected $cN22Type; /** * Required if CN22Type is OTHER. Required if the CN22 form container is present. @@ -57,19 +57,17 @@ public function isInitialized($property): bool */ protected $foldHereText; /** - * - * * @var list */ protected $cN22Content; /** - * Provide the valid values: - 6 = 4X6 - 1 = 8.5X11 - Required if the CN22 form container is present. - * - * @return string - */ + * Provide the valid values: + * 6 = 4X6 + * 1 = 8.5X11 + * Required if the CN22 form container is present. + * + * @return string + */ public function getLabelSize(): string { return $this->labelSize; @@ -113,11 +111,11 @@ public function setPrintsPerPage(string $printsPerPage): self return $this; } /** - * Valid Values are pdf, png, gif, zpl, star, epl2 and spl. - Required if the CN22 form container is present. - * - * @return string - */ + * Valid Values are pdf, png, gif, zpl, star, epl2 and spl. + * Required if the CN22 form container is present. + * + * @return string + */ public function getLabelPrintType(): string { return $this->labelPrintType; @@ -137,14 +135,14 @@ public function setLabelPrintType(string $labelPrintType): self return $this; } /** - * Valid values: - 1 = GIFT - 2 = DOCUMENTS - 3 = COMMERCIAL SAMPLE - 4 = OTHER Required if the CN22 form container is present. - * - * @return string - */ + * Valid values: + * 1 = GIFT + * 2 = DOCUMENTS + * 3 = COMMERCIAL SAMPLE + * 4 = OTHER Required if the CN22 form container is present. + * + * @return string + */ public function getCN22Type(): string { return $this->cN22Type; @@ -211,8 +209,6 @@ public function setFoldHereText(string $foldHereText): self return $this; } /** - * - * * @return list */ public function getCN22Content(): array @@ -220,8 +216,6 @@ public function getCN22Content(): array return $this->cN22Content; } /** - * - * * @param list $cN22Content * * @return self diff --git a/src/Api/Model/InternationalFormsContacts.php b/src/Api/Model/InternationalFormsContacts.php index a75c5f0b..467415fe 100644 --- a/src/Api/Model/InternationalFormsContacts.php +++ b/src/Api/Model/InternationalFormsContacts.php @@ -31,11 +31,11 @@ public function isInitialized($property): bool */ protected $intermediateConsignee; /** - * Information of the producer. The NAFTA Certificate of Origin must be completed, signed, and dated by the exporter. - When the Certificate is completed by the producer for use by the exporter, it must be completed, signed, and dated by the producer. The date must be the date the Certificate was completed and signed. Applies to NAFTA CO. Required for NAFTA CO forms. - * - * @var ContactsProducer - */ + * Information of the producer. The NAFTA Certificate of Origin must be completed, signed, and dated by the exporter. + * When the Certificate is completed by the producer for use by the exporter, it must be completed, signed, and dated by the producer. The date must be the date the Certificate was completed and signed. Applies to NAFTA CO. Required for NAFTA CO forms. + * + * @var ContactsProducer + */ protected $producer; /** * SoldTo Container. The Sold To party's country code must be the same as the Ship To party's country code with the exception of Canada and satellite countries. Applies to Invoice and NAFTA CO Forms. Required if Invoice or NAFTA CO (International Form) is requested. @@ -110,11 +110,11 @@ public function setIntermediateConsignee(ContactsIntermediateConsignee $intermed return $this; } /** - * Information of the producer. The NAFTA Certificate of Origin must be completed, signed, and dated by the exporter. - When the Certificate is completed by the producer for use by the exporter, it must be completed, signed, and dated by the producer. The date must be the date the Certificate was completed and signed. Applies to NAFTA CO. Required for NAFTA CO forms. - * - * @return ContactsProducer - */ + * Information of the producer. The NAFTA Certificate of Origin must be completed, signed, and dated by the exporter. + * When the Certificate is completed by the producer for use by the exporter, it must be completed, signed, and dated by the producer. The date must be the date the Certificate was completed and signed. Applies to NAFTA CO. Required for NAFTA CO forms. + * + * @return ContactsProducer + */ public function getProducer(): ContactsProducer { return $this->producer; diff --git a/src/Api/Model/InternationalFormsEEIFilingOption.php b/src/Api/Model/InternationalFormsEEIFilingOption.php index 550a9219..53d4617b 100644 --- a/src/Api/Model/InternationalFormsEEIFilingOption.php +++ b/src/Api/Model/InternationalFormsEEIFilingOption.php @@ -13,14 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Required for EEI Form. Applicable for EEI form. - Valid values: - 1 - Shipper filed, - 2 - AES Direct, - 3 - UPS filed. - * - * @var string - */ + * Required for EEI Form. Applicable for EEI form. + * Valid values: + * 1 - Shipper filed, + * 2 - AES Direct, + * 3 - UPS filed. + * + * @var string + */ protected $code; /** * Email Address where the notification is sent. Valid for UPS filed (option 3), Shipper filed (option 1- A , 1-C) Applicable for EEI form. @@ -47,14 +47,14 @@ public function isInitialized($property): bool */ protected $shipperFiled; /** - * Required for EEI Form. Applicable for EEI form. - Valid values: - 1 - Shipper filed, - 2 - AES Direct, - 3 - UPS filed. - * - * @return string - */ + * Required for EEI Form. Applicable for EEI form. + * Valid values: + * 1 - Shipper filed, + * 2 - AES Direct, + * 3 - UPS filed. + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/InternationalFormsProduct.php b/src/Api/Model/InternationalFormsProduct.php index c5ea4881..20ddf4cd 100644 --- a/src/Api/Model/InternationalFormsProduct.php +++ b/src/Api/Model/InternationalFormsProduct.php @@ -49,14 +49,14 @@ public function isInitialized($property): bool */ protected $jointProductionIndicator; /** - * For each good described in the Description of Goods field, where the good is subject to a regional value content (RVC) requirement, indicate NC if the RVC is calculated according to the net cost method; otherwise, indicate NO. If the RVC is calculated over a period of time then indicate "NC with begin/end date" by passing code "ND" Applies to NAFTA CO only. Required for NAFTA CO. Valid values: - - NC - - ND - - NO - - * - * @var string - */ + * For each good described in the Description of Goods field, where the good is subject to a regional value content (RVC) requirement, indicate NC if the RVC is calculated according to the net cost method; otherwise, indicate NO. If the RVC is calculated over a period of time then indicate "NC with begin/end date" by passing code "ND" Applies to NAFTA CO only. Required for NAFTA CO. Valid values: + * - NC + * - ND + * - NO + * + * + * @var string + */ protected $netCostCode; /** * Date Range for regional value content (RVC). Applies to NAFTA CO only. @@ -65,23 +65,23 @@ public function isInitialized($property): bool */ protected $netCostDateRange; /** - * Indicates the criterion (A through F) for each good described in the Description of Goods field if applicable. - - The rules of origin are contained in Chapter Four and Annex 401. - - Additional rules are described in Annex 703.2 (certain agricultural goods), Annex 300-B, Appendix 6 (certain textile goods) and Annex 308.1 (certain automatic data processing goods and their parts). Applies to NAFTA CO only. - * - * @var string - */ + * Indicates the criterion (A through F) for each good described in the Description of Goods field if applicable. + * + * The rules of origin are contained in Chapter Four and Annex 401. + * + * Additional rules are described in Annex 703.2 (certain agricultural goods), Annex 300-B, Appendix 6 (certain textile goods) and Annex 308.1 (certain automatic data processing goods and their parts). Applies to NAFTA CO only. + * + * @var string + */ protected $preferenceCriteria; /** - * Indicate the following: Yes - If shipper is the producer of the good. If not, state 02, 03, and 04 depending on whether this certificate was based upon: - No [1] - Knowledge of whether the good qualifies as an originating good. - No [2] - Reliance on the producers written representation (other than a Certificate of Origin) that the good qualifies as an originating good. - No [3] - A completed and signed Certificate for the good voluntarily provided to the exporter by the producer. Applicable for NAFTA CO and is required. Valid values: Yes, No [1], No [2], and No [3]. - * - * @var string - */ + * Indicate the following: Yes - If shipper is the producer of the good. If not, state 02, 03, and 04 depending on whether this certificate was based upon: + * No [1] - Knowledge of whether the good qualifies as an originating good. + * No [2] - Reliance on the producers written representation (other than a Certificate of Origin) that the good qualifies as an originating good. + * No [3] - A completed and signed Certificate for the good voluntarily provided to the exporter by the producer. Applicable for NAFTA CO and is required. Valid values: Yes, No [1], No [2], and No [3]. + * + * @var string + */ protected $producerInfo; /** * Any special marks, codes, and numbers that may appear on package. Applies to CO Only. @@ -120,13 +120,13 @@ public function isInitialized($property): bool */ protected $exportType; /** - * This amount will always be USD. Applies to EEI forms only. Required for EEI form. Valid characters are 0-9 and \'.\' (Decimal point). Limit to 2 digit after the decimal. The maximum length of the field is 15 including \'.\' and can hold up to 2 decimal places. - - Note: This value is calculated based on the Product/Unit/Value and /Product/Unit/Number (Number of Units * Price per Unit). If the total value is incorrect it will be replaced by the actual calculated total value. - - * - * @var string - */ + * This amount will always be USD. Applies to EEI forms only. Required for EEI form. Valid characters are 0-9 and \'.\' (Decimal point). Limit to 2 digit after the decimal. The maximum length of the field is 15 including \'.\' and can hold up to 2 decimal places. + * + * Note: This value is calculated based on the Product/Unit/Value and /Product/Unit/Number (Number of Units * Price per Unit). If the total value is incorrect it will be replaced by the actual calculated total value. + * + * + * @var string + */ protected $sEDTotalValue; /** * Container tag for determining whether or not to exclude product information from a particular form. If this container is not present we assume that the DEFAULT is selected which is "none" and all products will appear on all forms. @@ -279,14 +279,14 @@ public function setJointProductionIndicator(string $jointProductionIndicator): s return $this; } /** - * For each good described in the Description of Goods field, where the good is subject to a regional value content (RVC) requirement, indicate NC if the RVC is calculated according to the net cost method; otherwise, indicate NO. If the RVC is calculated over a period of time then indicate "NC with begin/end date" by passing code "ND" Applies to NAFTA CO only. Required for NAFTA CO. Valid values: - - NC - - ND - - NO - - * - * @return string - */ + * For each good described in the Description of Goods field, where the good is subject to a regional value content (RVC) requirement, indicate NC if the RVC is calculated according to the net cost method; otherwise, indicate NO. If the RVC is calculated over a period of time then indicate "NC with begin/end date" by passing code "ND" Applies to NAFTA CO only. Required for NAFTA CO. Valid values: + * - NC + * - ND + * - NO + * + * + * @return string + */ public function getNetCostCode(): string { return $this->netCostCode; @@ -331,14 +331,14 @@ public function setNetCostDateRange(ProductNetCostDateRange $netCostDateRange): return $this; } /** - * Indicates the criterion (A through F) for each good described in the Description of Goods field if applicable. - - The rules of origin are contained in Chapter Four and Annex 401. - - Additional rules are described in Annex 703.2 (certain agricultural goods), Annex 300-B, Appendix 6 (certain textile goods) and Annex 308.1 (certain automatic data processing goods and their parts). Applies to NAFTA CO only. - * - * @return string - */ + * Indicates the criterion (A through F) for each good described in the Description of Goods field if applicable. + * + * The rules of origin are contained in Chapter Four and Annex 401. + * + * Additional rules are described in Annex 703.2 (certain agricultural goods), Annex 300-B, Appendix 6 (certain textile goods) and Annex 308.1 (certain automatic data processing goods and their parts). Applies to NAFTA CO only. + * + * @return string + */ public function getPreferenceCriteria(): string { return $this->preferenceCriteria; @@ -361,13 +361,13 @@ public function setPreferenceCriteria(string $preferenceCriteria): self return $this; } /** - * Indicate the following: Yes - If shipper is the producer of the good. If not, state 02, 03, and 04 depending on whether this certificate was based upon: - No [1] - Knowledge of whether the good qualifies as an originating good. - No [2] - Reliance on the producers written representation (other than a Certificate of Origin) that the good qualifies as an originating good. - No [3] - A completed and signed Certificate for the good voluntarily provided to the exporter by the producer. Applicable for NAFTA CO and is required. Valid values: Yes, No [1], No [2], and No [3]. - * - * @return string - */ + * Indicate the following: Yes - If shipper is the producer of the good. If not, state 02, 03, and 04 depending on whether this certificate was based upon: + * No [1] - Knowledge of whether the good qualifies as an originating good. + * No [2] - Reliance on the producers written representation (other than a Certificate of Origin) that the good qualifies as an originating good. + * No [3] - A completed and signed Certificate for the good voluntarily provided to the exporter by the producer. Applicable for NAFTA CO and is required. Valid values: Yes, No [1], No [2], and No [3]. + * + * @return string + */ public function getProducerInfo(): string { return $this->producerInfo; @@ -521,13 +521,13 @@ public function setExportType(string $exportType): self return $this; } /** - * This amount will always be USD. Applies to EEI forms only. Required for EEI form. Valid characters are 0-9 and \'.\' (Decimal point). Limit to 2 digit after the decimal. The maximum length of the field is 15 including \'.\' and can hold up to 2 decimal places. - - Note: This value is calculated based on the Product/Unit/Value and /Product/Unit/Number (Number of Units * Price per Unit). If the total value is incorrect it will be replaced by the actual calculated total value. - - * - * @return string - */ + * This amount will always be USD. Applies to EEI forms only. Required for EEI form. Valid characters are 0-9 and \'.\' (Decimal point). Limit to 2 digit after the decimal. The maximum length of the field is 15 including \'.\' and can hold up to 2 decimal places. + * + * Note: This value is calculated based on the Product/Unit/Value and /Product/Unit/Number (Number of Units * Price per Unit). If the total value is incorrect it will be replaced by the actual calculated total value. + * + * + * @return string + */ public function getSEDTotalValue(): string { return $this->sEDTotalValue; diff --git a/src/Api/Model/InternationalFormsUPSPremiumCareForm.php b/src/Api/Model/InternationalFormsUPSPremiumCareForm.php index 0ed8b8ab..8efb45d6 100644 --- a/src/Api/Model/InternationalFormsUPSPremiumCareForm.php +++ b/src/Api/Model/InternationalFormsUPSPremiumCareForm.php @@ -19,20 +19,20 @@ public function isInitialized($property): bool */ protected $shipmentDate; /** - * Size of UPS Premium Care Form. Valid values: - 01 = A4 Size - 02 = Letter Size - * - * @var string - */ + * Size of UPS Premium Care Form. Valid values: + * 01 = A4 Size + * 02 = Letter Size + * + * @var string + */ protected $pageSize; /** - * Format of UPS Premium Care Form. Valid values: - 01 = PNG - 02 = PDF - * - * @var string - */ + * Format of UPS Premium Care Form. Valid values: + * 01 = PNG + * 02 = PDF + * + * @var string + */ protected $printType; /** * Number of Copies of UPS Premium Care Form. Valid value is 02. @@ -69,12 +69,12 @@ public function setShipmentDate(string $shipmentDate): self return $this; } /** - * Size of UPS Premium Care Form. Valid values: - 01 = A4 Size - 02 = Letter Size - * - * @return string - */ + * Size of UPS Premium Care Form. Valid values: + * 01 = A4 Size + * 02 = Letter Size + * + * @return string + */ public function getPageSize(): string { return $this->pageSize; @@ -95,12 +95,12 @@ public function setPageSize(string $pageSize): self return $this; } /** - * Format of UPS Premium Care Form. Valid values: - 01 = PNG - 02 = PDF - * - * @return string - */ + * Format of UPS Premium Care Form. Valid values: + * 01 = PNG + * 02 = PDF + * + * @return string + */ public function getPrintType(): string { return $this->printType; diff --git a/src/Api/Model/LabelDeliveryEMail.php b/src/Api/Model/LabelDeliveryEMail.php index 185d5906..c3767c66 100644 --- a/src/Api/Model/LabelDeliveryEMail.php +++ b/src/Api/Model/LabelDeliveryEMail.php @@ -49,27 +49,27 @@ public function isInitialized($property): bool */ protected $subject; /** - * Specifies a reference code and reference number to display in the subject of the Label Delivery notification. - - When the subject code is provided, the subject will contain the following: UPS Label Delivery, the reference code (the reference code will be mapped to the corresponding ANSI value) and the reference number. - - The valid subject codes are: - - 01 - Shipment Reference Number 1, - - 02 - Shipment Reference Number 2, - - 03 - package Reference Number 1, - - 04 - package Reference Number 2, - - 05 - package Reference Number 3, - - 06 - package Reference Number 4, - - 07 - package Reference Number 5, - - 08 - Subject Text (Return Notification only). - - If the subject code tag is not provided and the subject text is provided, the subject of the notification will be the subject text. - - If the subject text is provided, and the subject code tag exists, then the subject code value must be 08. If Subject code is 08, subject text must exist. If a subject code is provided that refers to a nonexistent reference number, the subject will default to the shipment identification number. - - * - * @var string - */ + * Specifies a reference code and reference number to display in the subject of the Label Delivery notification. + * + * When the subject code is provided, the subject will contain the following: UPS Label Delivery, the reference code (the reference code will be mapped to the corresponding ANSI value) and the reference number. + * + * The valid subject codes are: + * - 01 - Shipment Reference Number 1, + * - 02 - Shipment Reference Number 2, + * - 03 - package Reference Number 1, + * - 04 - package Reference Number 2, + * - 05 - package Reference Number 3, + * - 06 - package Reference Number 4, + * - 07 - package Reference Number 5, + * - 08 - Subject Text (Return Notification only). + * + * If the subject code tag is not provided and the subject text is provided, the subject of the notification will be the subject text. + * + * If the subject text is provided, and the subject code tag exists, then the subject code value must be 08. If Subject code is 08, subject text must exist. If a subject code is provided that refers to a nonexistent reference number, the subject will default to the shipment identification number. + * + * + * @var string + */ protected $subjectCode; /** * The destination eMail address for the Label Delivery. @@ -204,27 +204,27 @@ public function setSubject(string $subject): self return $this; } /** - * Specifies a reference code and reference number to display in the subject of the Label Delivery notification. - - When the subject code is provided, the subject will contain the following: UPS Label Delivery, the reference code (the reference code will be mapped to the corresponding ANSI value) and the reference number. - - The valid subject codes are: - - 01 - Shipment Reference Number 1, - - 02 - Shipment Reference Number 2, - - 03 - package Reference Number 1, - - 04 - package Reference Number 2, - - 05 - package Reference Number 3, - - 06 - package Reference Number 4, - - 07 - package Reference Number 5, - - 08 - Subject Text (Return Notification only). - - If the subject code tag is not provided and the subject text is provided, the subject of the notification will be the subject text. - - If the subject text is provided, and the subject code tag exists, then the subject code value must be 08. If Subject code is 08, subject text must exist. If a subject code is provided that refers to a nonexistent reference number, the subject will default to the shipment identification number. - - * - * @return string - */ + * Specifies a reference code and reference number to display in the subject of the Label Delivery notification. + * + * When the subject code is provided, the subject will contain the following: UPS Label Delivery, the reference code (the reference code will be mapped to the corresponding ANSI value) and the reference number. + * + * The valid subject codes are: + * - 01 - Shipment Reference Number 1, + * - 02 - Shipment Reference Number 2, + * - 03 - package Reference Number 1, + * - 04 - package Reference Number 2, + * - 05 - package Reference Number 3, + * - 06 - package Reference Number 4, + * - 07 - package Reference Number 5, + * - 08 - Subject Text (Return Notification only). + * + * If the subject code tag is not provided and the subject text is provided, the subject of the notification will be the subject text. + * + * If the subject text is provided, and the subject code tag exists, then the subject code value must be 08. If Subject code is 08, subject text must exist. If a subject code is provided that refers to a nonexistent reference number, the subject will default to the shipment identification number. + * + * + * @return string + */ public function getSubjectCode(): string { return $this->subjectCode; diff --git a/src/Api/Model/LabelRecoveryLabelSpecificationLabelImageFormat.php b/src/Api/Model/LabelRecoveryLabelSpecificationLabelImageFormat.php index 6d62b40c..871bd9e0 100644 --- a/src/Api/Model/LabelRecoveryLabelSpecificationLabelImageFormat.php +++ b/src/Api/Model/LabelRecoveryLabelSpecificationLabelImageFormat.php @@ -13,18 +13,18 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * File type that the label is to be generated in. Valid values are: - - GIF -- label is in HTML format. - - PDF -- label is in PDF format. - - ZPL -- Thermal label in ZPL format. - - EPL -- Thermal label in EPL2 format. - - SPL -- Thermal label in SPL format. - - Default is GIF - - * - * @var string - */ + * File type that the label is to be generated in. Valid values are: + * - GIF -- label is in HTML format. + * - PDF -- label is in PDF format. + * - ZPL -- Thermal label in ZPL format. + * - EPL -- Thermal label in EPL2 format. + * - SPL -- Thermal label in SPL format. + * + * Default is GIF + * + * + * @var string + */ protected $code; /** * Description of the label image format code. @@ -33,18 +33,18 @@ public function isInitialized($property): bool */ protected $description; /** - * File type that the label is to be generated in. Valid values are: - - GIF -- label is in HTML format. - - PDF -- label is in PDF format. - - ZPL -- Thermal label in ZPL format. - - EPL -- Thermal label in EPL2 format. - - SPL -- Thermal label in SPL format. - - Default is GIF - - * - * @return string - */ + * File type that the label is to be generated in. Valid values are: + * - GIF -- label is in HTML format. + * - PDF -- label is in PDF format. + * - ZPL -- Thermal label in ZPL format. + * - EPL -- Thermal label in EPL2 format. + * - SPL -- Thermal label in SPL format. + * + * Default is GIF + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/LabelRecoveryLabelSpecificationLabelStockSize.php b/src/Api/Model/LabelRecoveryLabelSpecificationLabelStockSize.php index 084cef70..407374f8 100644 --- a/src/Api/Model/LabelRecoveryLabelSpecificationLabelStockSize.php +++ b/src/Api/Model/LabelRecoveryLabelSpecificationLabelStockSize.php @@ -13,31 +13,31 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Height of the Label. Only valid values are 6 or 8. - - Note: Label Image will only scale up to 4 X 6, even when requesting 4 X 8. - - * - * @var string - */ + * Height of the Label. Only valid values are 6 or 8. + * + * Note: Label Image will only scale up to 4 X 6, even when requesting 4 X 8. + * + * + * @var string + */ protected $height; /** - * Width of the Label. Valid value is 4. - - Note: Label Image will only scale up to 4 X 6, even when requesting 4 X 8. - - * - * @var string - */ + * Width of the Label. Valid value is 4. + * + * Note: Label Image will only scale up to 4 X 6, even when requesting 4 X 8. + * + * + * @var string + */ protected $width; /** - * Height of the Label. Only valid values are 6 or 8. - - Note: Label Image will only scale up to 4 X 6, even when requesting 4 X 8. - - * - * @return string - */ + * Height of the Label. Only valid values are 6 or 8. + * + * Note: Label Image will only scale up to 4 X 6, even when requesting 4 X 8. + * + * + * @return string + */ public function getHeight(): string { return $this->height; @@ -59,13 +59,13 @@ public function setHeight(string $height): self return $this; } /** - * Width of the Label. Valid value is 4. - - Note: Label Image will only scale up to 4 X 6, even when requesting 4 X 8. - - * - * @return string - */ + * Width of the Label. Valid value is 4. + * + * Note: Label Image will only scale up to 4 X 6, even when requesting 4 X 8. + * + * + * @return string + */ public function getWidth(): string { return $this->width; diff --git a/src/Api/Model/LabelRecoveryRequest.php b/src/Api/Model/LabelRecoveryRequest.php index 03f06912..d2e0ddae 100644 --- a/src/Api/Model/LabelRecoveryRequest.php +++ b/src/Api/Model/LabelRecoveryRequest.php @@ -25,33 +25,33 @@ public function isInitialized($property): bool */ protected $labelSpecification; /** - * Translate container allows the user to specify the language he/she would like a specific portion of response to return. - The language is specified by the combination of language code and dialect code. - Valid combinations are: LanguageCode + DialectCode. Either Translate container or Locale element can be present in a given request. Both can't be requested together in same request. - Combinations: - eng GB = Queen's English - Spa 97 = Castilian Spanish - ita 97 = Italian - fra 97 = France French - fra CA = Canadian French - deu 97 = German - por 97 = Portugal Portuguese - nld 97 = Dutch - dan 97 = Danish - fin 97 = Finnish - swe 97 = Swedish - eng CA = Canadian English - Eng US = US English - Default language is Queen's English - - If the Ship from country or territory is Canada, the Language defaults to Canadian English. - - If the ship from country or territory is US, the language defaults to US English. - - If shipping from some other country or territory, the language defaults to Queens English. - * - * @var LabelRecoveryRequestTranslate - */ + * Translate container allows the user to specify the language he/she would like a specific portion of response to return. + * The language is specified by the combination of language code and dialect code. + * Valid combinations are: LanguageCode + DialectCode. Either Translate container or Locale element can be present in a given request. Both can't be requested together in same request. + * Combinations: + * eng GB = Queen's English + * Spa 97 = Castilian Spanish + * ita 97 = Italian + * fra 97 = France French + * fra CA = Canadian French + * deu 97 = German + * por 97 = Portugal Portuguese + * nld 97 = Dutch + * dan 97 = Danish + * fin 97 = Finnish + * swe 97 = Swedish + * eng CA = Canadian English + * Eng US = US English + * Default language is Queen's English + * + * If the Ship from country or territory is Canada, the Language defaults to Canadian English. + * + * If the ship from country or territory is US, the language defaults to US English. + * + * If shipping from some other country or territory, the language defaults to Queens English. + * + * @var LabelRecoveryRequestTranslate + */ protected $translate; /** * Container for the Label Delivery accessorial. One Label Delivery per shipment. @@ -60,19 +60,19 @@ public function isInitialized($property): bool */ protected $labelDelivery; /** - * Small Package Tracking Number. Required if Mail Innovations Tracking Number or ReferenceNumber/Value and ShipperNumber is not provided. If only TrackingNumber is provided, the request will be treated as Small Package Shipment. Label Recovery will return label for Small Package Tracking Number. - If both, TrackingNumber and MailInnovationsTrackingNumber are provided, the request will be treated as Dual Mail Innovations Return Shipment. Label Recovery will return two labels one each for - Small Package Tracking Number and Mail Innovations Return Tracking Number. - * - * @var string - */ + * Small Package Tracking Number. Required if Mail Innovations Tracking Number or ReferenceNumber/Value and ShipperNumber is not provided. If only TrackingNumber is provided, the request will be treated as Small Package Shipment. Label Recovery will return label for Small Package Tracking Number. + * If both, TrackingNumber and MailInnovationsTrackingNumber are provided, the request will be treated as Dual Mail Innovations Return Shipment. Label Recovery will return two labels one each for - Small Package Tracking Number and Mail Innovations Return Tracking Number. + * + * @var string + */ protected $trackingNumber; /** - * Mail Innovations Tracking Number. Required if Tracking Number or ReferenceNumber/Value is not populated. - If only MailInnovationsTrackingNumber is provided, the request will be treated as Single Mail Innovations Return Shipment. Label Recovery will return label for Mail Innovations Return Tracking Number. - If both, TrackingNumber and MailInnovationsTrackingNumber are provided, the request will be treated as Dual Mail Innovations Return Shipment. Label Recovery will return two labels one each for - Small Package Tracking Number and Mail Innovations Return Tracking Number. - * - * @var string - */ + * Mail Innovations Tracking Number. Required if Tracking Number or ReferenceNumber/Value is not populated. + * If only MailInnovationsTrackingNumber is provided, the request will be treated as Single Mail Innovations Return Shipment. Label Recovery will return label for Mail Innovations Return Tracking Number. + * If both, TrackingNumber and MailInnovationsTrackingNumber are provided, the request will be treated as Dual Mail Innovations Return Shipment. Label Recovery will return two labels one each for - Small Package Tracking Number and Mail Innovations Return Tracking Number. + * + * @var string + */ protected $mailInnovationsTrackingNumber; /** * Container that holds reference number and shipper number If tracking number is not present use reference Number @@ -81,18 +81,18 @@ public function isInitialized($property): bool */ protected $referenceValues; /** - * Represents 5 character ISO Locale that allows the user to request Reference Number Code on Label, Label instructions, Receipt instructions (if available for given tracking number) and High Value Report (if available for given tracking number) in desired language. - Locale is specified by the combination of language code and country or territory code - 2 character language code and 2 character country code seperated by an underscore ('_') character. Example - de_DE. Please refer to Appendix for supported values for Locale. Either Translate container or Locale element can be present in a given request. Both can't be requested together in same request. - * - * @var string - */ + * Represents 5 character ISO Locale that allows the user to request Reference Number Code on Label, Label instructions, Receipt instructions (if available for given tracking number) and High Value Report (if available for given tracking number) in desired language. + * Locale is specified by the combination of language code and country or territory code - 2 character language code and 2 character country code seperated by an underscore ('_') character. Example - de_DE. Please refer to Appendix for supported values for Locale. Either Translate container or Locale element can be present in a given request. Both can't be requested together in same request. + * + * @var string + */ protected $locale; /** - * UPS Premium Care Form container. Default is PDF when container is not provided. - Valid only for Canada to Canada movements. UPS Premium Care Form will be returned in both US English and Canadian French language. - * - * @var LabelRecoveryRequestUPSPremiumCareForm - */ + * UPS Premium Care Form container. Default is PDF when container is not provided. + * Valid only for Canada to Canada movements. UPS Premium Care Form will be returned in both US English and Canadian French language. + * + * @var LabelRecoveryRequestUPSPremiumCareForm + */ protected $uPSPremiumCareForm; /** * Request Container. @@ -139,33 +139,33 @@ public function setLabelSpecification(LabelRecoveryRequestLabelSpecification $la return $this; } /** - * Translate container allows the user to specify the language he/she would like a specific portion of response to return. - The language is specified by the combination of language code and dialect code. - Valid combinations are: LanguageCode + DialectCode. Either Translate container or Locale element can be present in a given request. Both can't be requested together in same request. - Combinations: - eng GB = Queen's English - Spa 97 = Castilian Spanish - ita 97 = Italian - fra 97 = France French - fra CA = Canadian French - deu 97 = German - por 97 = Portugal Portuguese - nld 97 = Dutch - dan 97 = Danish - fin 97 = Finnish - swe 97 = Swedish - eng CA = Canadian English - Eng US = US English - Default language is Queen's English - - If the Ship from country or territory is Canada, the Language defaults to Canadian English. - - If the ship from country or territory is US, the language defaults to US English. - - If shipping from some other country or territory, the language defaults to Queens English. - * - * @return LabelRecoveryRequestTranslate - */ + * Translate container allows the user to specify the language he/she would like a specific portion of response to return. + * The language is specified by the combination of language code and dialect code. + * Valid combinations are: LanguageCode + DialectCode. Either Translate container or Locale element can be present in a given request. Both can't be requested together in same request. + * Combinations: + * eng GB = Queen's English + * Spa 97 = Castilian Spanish + * ita 97 = Italian + * fra 97 = France French + * fra CA = Canadian French + * deu 97 = German + * por 97 = Portugal Portuguese + * nld 97 = Dutch + * dan 97 = Danish + * fin 97 = Finnish + * swe 97 = Swedish + * eng CA = Canadian English + * Eng US = US English + * Default language is Queen's English + * + * If the Ship from country or territory is Canada, the Language defaults to Canadian English. + * + * If the ship from country or territory is US, the language defaults to US English. + * + * If shipping from some other country or territory, the language defaults to Queens English. + * + * @return LabelRecoveryRequestTranslate + */ public function getTranslate(): LabelRecoveryRequestTranslate { return $this->translate; @@ -229,11 +229,11 @@ public function setLabelDelivery(LabelRecoveryRequestLabelDelivery $labelDeliver return $this; } /** - * Small Package Tracking Number. Required if Mail Innovations Tracking Number or ReferenceNumber/Value and ShipperNumber is not provided. If only TrackingNumber is provided, the request will be treated as Small Package Shipment. Label Recovery will return label for Small Package Tracking Number. - If both, TrackingNumber and MailInnovationsTrackingNumber are provided, the request will be treated as Dual Mail Innovations Return Shipment. Label Recovery will return two labels one each for - Small Package Tracking Number and Mail Innovations Return Tracking Number. - * - * @return string - */ + * Small Package Tracking Number. Required if Mail Innovations Tracking Number or ReferenceNumber/Value and ShipperNumber is not provided. If only TrackingNumber is provided, the request will be treated as Small Package Shipment. Label Recovery will return label for Small Package Tracking Number. + * If both, TrackingNumber and MailInnovationsTrackingNumber are provided, the request will be treated as Dual Mail Innovations Return Shipment. Label Recovery will return two labels one each for - Small Package Tracking Number and Mail Innovations Return Tracking Number. + * + * @return string + */ public function getTrackingNumber(): string { return $this->trackingNumber; @@ -253,12 +253,12 @@ public function setTrackingNumber(string $trackingNumber): self return $this; } /** - * Mail Innovations Tracking Number. Required if Tracking Number or ReferenceNumber/Value is not populated. - If only MailInnovationsTrackingNumber is provided, the request will be treated as Single Mail Innovations Return Shipment. Label Recovery will return label for Mail Innovations Return Tracking Number. - If both, TrackingNumber and MailInnovationsTrackingNumber are provided, the request will be treated as Dual Mail Innovations Return Shipment. Label Recovery will return two labels one each for - Small Package Tracking Number and Mail Innovations Return Tracking Number. - * - * @return string - */ + * Mail Innovations Tracking Number. Required if Tracking Number or ReferenceNumber/Value is not populated. + * If only MailInnovationsTrackingNumber is provided, the request will be treated as Single Mail Innovations Return Shipment. Label Recovery will return label for Mail Innovations Return Tracking Number. + * If both, TrackingNumber and MailInnovationsTrackingNumber are provided, the request will be treated as Dual Mail Innovations Return Shipment. Label Recovery will return two labels one each for - Small Package Tracking Number and Mail Innovations Return Tracking Number. + * + * @return string + */ public function getMailInnovationsTrackingNumber(): string { return $this->mailInnovationsTrackingNumber; @@ -301,11 +301,11 @@ public function setReferenceValues(LabelRecoveryRequestReferenceValues $referenc return $this; } /** - * Represents 5 character ISO Locale that allows the user to request Reference Number Code on Label, Label instructions, Receipt instructions (if available for given tracking number) and High Value Report (if available for given tracking number) in desired language. - Locale is specified by the combination of language code and country or territory code - 2 character language code and 2 character country code seperated by an underscore ('_') character. Example - de_DE. Please refer to Appendix for supported values for Locale. Either Translate container or Locale element can be present in a given request. Both can't be requested together in same request. - * - * @return string - */ + * Represents 5 character ISO Locale that allows the user to request Reference Number Code on Label, Label instructions, Receipt instructions (if available for given tracking number) and High Value Report (if available for given tracking number) in desired language. + * Locale is specified by the combination of language code and country or territory code - 2 character language code and 2 character country code seperated by an underscore ('_') character. Example - de_DE. Please refer to Appendix for supported values for Locale. Either Translate container or Locale element can be present in a given request. Both can't be requested together in same request. + * + * @return string + */ public function getLocale(): string { return $this->locale; @@ -325,11 +325,11 @@ public function setLocale(string $locale): self return $this; } /** - * UPS Premium Care Form container. Default is PDF when container is not provided. - Valid only for Canada to Canada movements. UPS Premium Care Form will be returned in both US English and Canadian French language. - * - * @return LabelRecoveryRequestUPSPremiumCareForm - */ + * UPS Premium Care Form container. Default is PDF when container is not provided. + * Valid only for Canada to Canada movements. UPS Premium Care Form will be returned in both US English and Canadian French language. + * + * @return LabelRecoveryRequestUPSPremiumCareForm + */ public function getUPSPremiumCareForm(): LabelRecoveryRequestUPSPremiumCareForm { return $this->uPSPremiumCareForm; diff --git a/src/Api/Model/LabelRecoveryRequestLabelDelivery.php b/src/Api/Model/LabelRecoveryRequestLabelDelivery.php index 62fdbb08..3254c816 100644 --- a/src/Api/Model/LabelRecoveryRequestLabelDelivery.php +++ b/src/Api/Model/LabelRecoveryRequestLabelDelivery.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Indicates the Label Recovery and Receipt Recovery URL links are to be returned in the XML Response. Valid for following shipment - - Print/Electronic Return Label - Print/Electronic Import Control Label - Forward shipment except for Mail Innovations Forward - * - * @var string - */ + * Indicates the Label Recovery and Receipt Recovery URL links are to be returned in the XML Response. Valid for following shipment - + * Print/Electronic Return Label + * Print/Electronic Import Control Label + * Forward shipment except for Mail Innovations Forward + * + * @var string + */ protected $labelLinkIndicator; /** * Not Used. If this tag is present, resend the Label Delivery notification email. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $resendEMailIndicator; /** - * Indicates the Label Recovery and Receipt Recovery URL links are to be returned in the XML Response. Valid for following shipment - - Print/Electronic Return Label - Print/Electronic Import Control Label - Forward shipment except for Mail Innovations Forward - * - * @return string - */ + * Indicates the Label Recovery and Receipt Recovery URL links are to be returned in the XML Response. Valid for following shipment - + * Print/Electronic Return Label + * Print/Electronic Import Control Label + * Forward shipment except for Mail Innovations Forward + * + * @return string + */ public function getLabelLinkIndicator(): string { return $this->labelLinkIndicator; diff --git a/src/Api/Model/LabelRecoveryRequestRequest.php b/src/Api/Model/LabelRecoveryRequestRequest.php index e7419b5a..cd68b937 100644 --- a/src/Api/Model/LabelRecoveryRequestRequest.php +++ b/src/Api/Model/LabelRecoveryRequestRequest.php @@ -13,15 +13,15 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. - - Format: YYMM = Year and month of the release. - Example: 1701 = 2017 January Supported values: 1701, 1707, 1903 - * - * @var string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. + * + * Format: YYMM = Year and month of the release. + * Example: 1701 = 2017 January Supported values: 1701, 1707, 1903 + * + * @var string + */ protected $subVersion; /** * Request option is no longer used. @@ -36,15 +36,15 @@ public function isInitialized($property): bool */ protected $transactionReference; /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. - - Format: YYMM = Year and month of the release. - Example: 1701 = 2017 January Supported values: 1701, 1707, 1903 - * - * @return string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. + * + * Format: YYMM = Year and month of the release. + * Example: 1701 = 2017 January Supported values: 1701, 1707, 1903 + * + * @return string + */ public function getSubVersion(): string { return $this->subVersion; diff --git a/src/Api/Model/LabelRecoveryRequestTranslate.php b/src/Api/Model/LabelRecoveryRequestTranslate.php index 2be3fe01..eb9b57d5 100644 --- a/src/Api/Model/LabelRecoveryRequestTranslate.php +++ b/src/Api/Model/LabelRecoveryRequestTranslate.php @@ -13,59 +13,59 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The Language code. The language codes are three letter language codes. Supported languages are: - - eng - English - - spa - Spanish - - ita - Italian - - fra - French - - deu - German - - por -Portuguese - - nld – Dutch - - dan - Danish - - fin - Finnish - - swe – Swedish - - nor – Norwegian - - * - * @var string - */ + * The Language code. The language codes are three letter language codes. Supported languages are: + * - eng - English + * - spa - Spanish + * - ita - Italian + * - fra - French + * - deu - German + * - por -Portuguese + * - nld – Dutch + * - dan - Danish + * - fin - Finnish + * - swe – Swedish + * - nor – Norwegian + * + * + * @var string + */ protected $languageCode; /** - * Valid dialect codes are: - - CA - Canada - - GB - Great Britain - - US - United States - - 97 – Not Applicable - - * - * @var string - */ + * Valid dialect codes are: + * - CA - Canada + * - GB - Great Britain + * - US - United States + * - 97 – Not Applicable + * + * + * @var string + */ protected $dialectCode; /** - * Used to specify what will be translated. - Valid code: - 01 = label direction instructions and receipt - * - * @var string - */ + * Used to specify what will be translated. + * Valid code: + * 01 = label direction instructions and receipt + * + * @var string + */ protected $code; /** - * The Language code. The language codes are three letter language codes. Supported languages are: - - eng - English - - spa - Spanish - - ita - Italian - - fra - French - - deu - German - - por -Portuguese - - nld – Dutch - - dan - Danish - - fin - Finnish - - swe – Swedish - - nor – Norwegian - - * - * @return string - */ + * The Language code. The language codes are three letter language codes. Supported languages are: + * - eng - English + * - spa - Spanish + * - ita - Italian + * - fra - French + * - deu - German + * - por -Portuguese + * - nld – Dutch + * - dan - Danish + * - fin - Finnish + * - swe – Swedish + * - nor – Norwegian + * + * + * @return string + */ public function getLanguageCode(): string { return $this->languageCode; @@ -96,15 +96,15 @@ public function setLanguageCode(string $languageCode): self return $this; } /** - * Valid dialect codes are: - - CA - Canada - - GB - Great Britain - - US - United States - - 97 – Not Applicable - - * - * @return string - */ + * Valid dialect codes are: + * - CA - Canada + * - GB - Great Britain + * - US - United States + * - 97 – Not Applicable + * + * + * @return string + */ public function getDialectCode(): string { return $this->dialectCode; @@ -128,12 +128,12 @@ public function setDialectCode(string $dialectCode): self return $this; } /** - * Used to specify what will be translated. - Valid code: - 01 = label direction instructions and receipt - * - * @return string - */ + * Used to specify what will be translated. + * Valid code: + * 01 = label direction instructions and receipt + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/LabelRecoveryRequestUPSPremiumCareForm.php b/src/Api/Model/LabelRecoveryRequestUPSPremiumCareForm.php index 28e175ea..1711f666 100644 --- a/src/Api/Model/LabelRecoveryRequestUPSPremiumCareForm.php +++ b/src/Api/Model/LabelRecoveryRequestUPSPremiumCareForm.php @@ -13,28 +13,28 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Size of UPS Premium Care Form. Valid values: - 01 = A4 Size - 02 = Letter Size - * - * @var string - */ + * Size of UPS Premium Care Form. Valid values: + * 01 = A4 Size + * 02 = Letter Size + * + * @var string + */ protected $pageSize; /** - * Format of UPS Premium Care Form. Valid values: - 01 = PNG - 02 = PDF - * - * @var string - */ + * Format of UPS Premium Care Form. Valid values: + * 01 = PNG + * 02 = PDF + * + * @var string + */ protected $printType; /** - * Size of UPS Premium Care Form. Valid values: - 01 = A4 Size - 02 = Letter Size - * - * @return string - */ + * Size of UPS Premium Care Form. Valid values: + * 01 = A4 Size + * 02 = Letter Size + * + * @return string + */ public function getPageSize(): string { return $this->pageSize; @@ -55,12 +55,12 @@ public function setPageSize(string $pageSize): self return $this; } /** - * Format of UPS Premium Care Form. Valid values: - 01 = PNG - 02 = PDF - * - * @return string - */ + * Format of UPS Premium Care Form. Valid values: + * 01 = PNG + * 02 = PDF + * + * @return string + */ public function getPrintType(): string { return $this->printType; diff --git a/src/Api/Model/LabelRecoveryResponse.php b/src/Api/Model/LabelRecoveryResponse.php index cdfe6f27..d7e8ebc5 100644 --- a/src/Api/Model/LabelRecoveryResponse.php +++ b/src/Api/Model/LabelRecoveryResponse.php @@ -25,8 +25,6 @@ public function isInitialized($property): bool */ protected $shipmentIdentificationNumber; /** - * - * * @var list */ protected $labelResults; @@ -49,8 +47,6 @@ public function isInitialized($property): bool */ protected $highValueReport; /** - * - * * @var list */ protected $trackingCandidate; @@ -99,8 +95,6 @@ public function setShipmentIdentificationNumber(string $shipmentIdentificationNu return $this; } /** - * - * * @return list */ public function getLabelResults(): array @@ -108,8 +102,6 @@ public function getLabelResults(): array return $this->labelResults; } /** - * - * * @param list $labelResults * * @return self @@ -187,8 +179,6 @@ public function setHighValueReport(LabelRecoveryResponseHighValueReport $highVal return $this; } /** - * - * * @return list */ public function getTrackingCandidate(): array @@ -196,8 +186,6 @@ public function getTrackingCandidate(): array return $this->trackingCandidate; } /** - * - * * @param list $trackingCandidate * * @return self diff --git a/src/Api/Model/LabelRecoveryResponseLabelResults.php b/src/Api/Model/LabelRecoveryResponseLabelResults.php index b5d5715e..e990bfeb 100644 --- a/src/Api/Model/LabelRecoveryResponseLabelResults.php +++ b/src/Api/Model/LabelRecoveryResponseLabelResults.php @@ -31,11 +31,11 @@ public function isInitialized($property): bool */ protected $mailInnovationsTrackingNumber; /** - * Container to hold Mail Innovations shipments label. The elements needed to render a label on a printer or in a browser. Specifies the format in which GraphicImage is represented. If LabelImageFormat is GIF, LabelImage contains GraphicImage and HTMLImage. Otherwise, it contains only GraphicImage. Applicable for Single Mail Innovations Returns and Dual Mail Innovations Returns shipment. Returned only if MailInnovationsTrackingNumber is provided in request. - If LabelImageFormat requested was PDF and TrackingNumber was present along with MailInnovationsTrackingNumber in the request, only LabelImage container is returned. MailInnovationsLabelImage will not be returned. In that case, the labels for Small Package Tracking Number and Mail Innovations Tracking Number will be stitched in single PDF file. - * - * @var LabelResultsMailInnovationsLabelImage - */ + * Container to hold Mail Innovations shipments label. The elements needed to render a label on a printer or in a browser. Specifies the format in which GraphicImage is represented. If LabelImageFormat is GIF, LabelImage contains GraphicImage and HTMLImage. Otherwise, it contains only GraphicImage. Applicable for Single Mail Innovations Returns and Dual Mail Innovations Returns shipment. Returned only if MailInnovationsTrackingNumber is provided in request. + * If LabelImageFormat requested was PDF and TrackingNumber was present along with MailInnovationsTrackingNumber in the request, only LabelImage container is returned. MailInnovationsLabelImage will not be returned. In that case, the labels for Small Package Tracking Number and Mail Innovations Tracking Number will be stitched in single PDF file. + * + * @var LabelResultsMailInnovationsLabelImage + */ protected $mailInnovationsLabelImage; /** * Container for the HTML receipt and the receipt link. @@ -116,11 +116,11 @@ public function setMailInnovationsTrackingNumber(string $mailInnovationsTracking return $this; } /** - * Container to hold Mail Innovations shipments label. The elements needed to render a label on a printer or in a browser. Specifies the format in which GraphicImage is represented. If LabelImageFormat is GIF, LabelImage contains GraphicImage and HTMLImage. Otherwise, it contains only GraphicImage. Applicable for Single Mail Innovations Returns and Dual Mail Innovations Returns shipment. Returned only if MailInnovationsTrackingNumber is provided in request. - If LabelImageFormat requested was PDF and TrackingNumber was present along with MailInnovationsTrackingNumber in the request, only LabelImage container is returned. MailInnovationsLabelImage will not be returned. In that case, the labels for Small Package Tracking Number and Mail Innovations Tracking Number will be stitched in single PDF file. - * - * @return LabelResultsMailInnovationsLabelImage - */ + * Container to hold Mail Innovations shipments label. The elements needed to render a label on a printer or in a browser. Specifies the format in which GraphicImage is represented. If LabelImageFormat is GIF, LabelImage contains GraphicImage and HTMLImage. Otherwise, it contains only GraphicImage. Applicable for Single Mail Innovations Returns and Dual Mail Innovations Returns shipment. Returned only if MailInnovationsTrackingNumber is provided in request. + * If LabelImageFormat requested was PDF and TrackingNumber was present along with MailInnovationsTrackingNumber in the request, only LabelImage container is returned. MailInnovationsLabelImage will not be returned. In that case, the labels for Small Package Tracking Number and Mail Innovations Tracking Number will be stitched in single PDF file. + * + * @return LabelResultsMailInnovationsLabelImage + */ public function getMailInnovationsLabelImage(): LabelResultsMailInnovationsLabelImage { return $this->mailInnovationsLabelImage; diff --git a/src/Api/Model/LabelResultsLabelImage.php b/src/Api/Model/LabelResultsLabelImage.php index 8f4c514c..30dcdcb9 100644 --- a/src/Api/Model/LabelResultsLabelImage.php +++ b/src/Api/Model/LabelResultsLabelImage.php @@ -31,12 +31,12 @@ public function isInitialized($property): bool */ protected $hTMLImage; /** - * PDF-417 is a two-dimensional barcode, which can store up to about 1,800 printable ASCII characters or 1,100 binary characters per symbol. The symbol is rectangular. - - The PDF417 image will be returned when the shipment is trans-border and the service option is one of the following: Standard Express, Saver Express Plus. The image is Base 64 encoded and only returned for GIF image format. - * - * @var string - */ + * PDF-417 is a two-dimensional barcode, which can store up to about 1,800 printable ASCII characters or 1,100 binary characters per symbol. The symbol is rectangular. + * + * The PDF417 image will be returned when the shipment is trans-border and the service option is one of the following: Standard Express, Saver Express Plus. The image is Base 64 encoded and only returned for GIF image format. + * + * @var string + */ protected $pDF417; /** * Base 64 encoded graphic image of the Warsaw text and signature box. @@ -45,13 +45,13 @@ public function isInitialized($property): bool */ protected $internationalSignatureGraphicImage; /** - * This is only returned if the label link is requested to be returned and only at the first package result Applicable for following types of shipments: - Print/Electronic Return Label - Print/Electronic Import Control Label - Forward shipment except for Mail Innovations Forward - * - * @var string - */ + * This is only returned if the label link is requested to be returned and only at the first package result Applicable for following types of shipments: + * Print/Electronic Return Label + * Print/Electronic Import Control Label + * Forward shipment except for Mail Innovations Forward + * + * @var string + */ protected $uRL; /** * The format of a label image byte stream. @@ -120,12 +120,12 @@ public function setHTMLImage(string $hTMLImage): self return $this; } /** - * PDF-417 is a two-dimensional barcode, which can store up to about 1,800 printable ASCII characters or 1,100 binary characters per symbol. The symbol is rectangular. - - The PDF417 image will be returned when the shipment is trans-border and the service option is one of the following: Standard Express, Saver Express Plus. The image is Base 64 encoded and only returned for GIF image format. - * - * @return string - */ + * PDF-417 is a two-dimensional barcode, which can store up to about 1,800 printable ASCII characters or 1,100 binary characters per symbol. The symbol is rectangular. + * + * The PDF417 image will be returned when the shipment is trans-border and the service option is one of the following: Standard Express, Saver Express Plus. The image is Base 64 encoded and only returned for GIF image format. + * + * @return string + */ public function getPDF417(): string { return $this->pDF417; @@ -168,13 +168,13 @@ public function setInternationalSignatureGraphicImage(string $internationalSigna return $this; } /** - * This is only returned if the label link is requested to be returned and only at the first package result Applicable for following types of shipments: - Print/Electronic Return Label - Print/Electronic Import Control Label - Forward shipment except for Mail Innovations Forward - * - * @return string - */ + * This is only returned if the label link is requested to be returned and only at the first package result Applicable for following types of shipments: + * Print/Electronic Return Label + * Print/Electronic Import Control Label + * Forward shipment except for Mail Innovations Forward + * + * @return string + */ public function getURL(): string { return $this->uRL; diff --git a/src/Api/Model/LabelResultsMailInnovationsLabelImage.php b/src/Api/Model/LabelResultsMailInnovationsLabelImage.php index f1764f26..cb843cd0 100644 --- a/src/Api/Model/LabelResultsMailInnovationsLabelImage.php +++ b/src/Api/Model/LabelResultsMailInnovationsLabelImage.php @@ -43,11 +43,11 @@ public function isInitialized($property): bool */ protected $internationalSignatureGraphicImage; /** - * This is only returned if the label link is requested to be returned and only at the first package result Applicable for following types of shipments: - Print/Electronic Return Label - * - * @var string - */ + * This is only returned if the label link is requested to be returned and only at the first package result Applicable for following types of shipments: + * Print/Electronic Return Label + * + * @var string + */ protected $uRL; /** * The format of a label image byte stream. @@ -160,11 +160,11 @@ public function setInternationalSignatureGraphicImage(string $internationalSigna return $this; } /** - * This is only returned if the label link is requested to be returned and only at the first package result Applicable for following types of shipments: - Print/Electronic Return Label - * - * @return string - */ + * This is only returned if the label link is requested to be returned and only at the first package result Applicable for following types of shipments: + * Print/Electronic Return Label + * + * @return string + */ public function getURL(): string { return $this->uRL; diff --git a/src/Api/Model/LabelResultsReceipt.php b/src/Api/Model/LabelResultsReceipt.php index 2fff4f05..8c0372a5 100644 --- a/src/Api/Model/LabelResultsReceipt.php +++ b/src/Api/Model/LabelResultsReceipt.php @@ -25,12 +25,12 @@ public function isInitialized($property): bool */ protected $image; /** - * Receipt's url Applicable for following types of shipments: - Print/Electronic Return Label - Print/Electronic Import Control Label - * - * @var string - */ + * Receipt's url Applicable for following types of shipments: + * Print/Electronic Return Label + * Print/Electronic Import Control Label + * + * @var string + */ protected $uRL; /** * Base 64 encoded html browser image. @@ -77,12 +77,12 @@ public function setImage(ReceiptImage $image): self return $this; } /** - * Receipt's url Applicable for following types of shipments: - Print/Electronic Return Label - Print/Electronic Import Control Label - * - * @return string - */ + * Receipt's url Applicable for following types of shipments: + * Print/Electronic Return Label + * Print/Electronic Import Control Label + * + * @return string + */ public function getURL(): string { return $this->uRL; diff --git a/src/Api/Model/LandedCostRequest.php b/src/Api/Model/LandedCostRequest.php index a22c6ee8..08358d58 100644 --- a/src/Api/Model/LandedCostRequest.php +++ b/src/Api/Model/LandedCostRequest.php @@ -25,13 +25,13 @@ public function isInitialized($property): bool */ protected $transID; /** - * An optional flag to indicate that partial landed cost calculations are acceptable to be used by upstream systems. - When set to *false*, the system will return an error when at least one commodity in the shipment is invalid (all or none), and no results will be sent back for that request. When set to *true*, the system will return partial calculations when applicable. - - Valid values: true = Partial Landed Cost result will return. false = All or No result will return (default). - * - * @var bool - */ + * An optional flag to indicate that partial landed cost calculations are acceptable to be used by upstream systems. + * When set to *false*, the system will return an error when at least one commodity in the shipment is invalid (all or none), and no results will be sent back for that request. When set to *true*, the system will return partial calculations when applicable. + * + * Valid values: true = Partial Landed Cost result will return. false = All or No result will return (default). + * + * @var bool + */ protected $allowPartialLandedCostResult; /** * Version number of the instance that processed this request. This must match the major number of the corresponding ICD version. @@ -90,13 +90,13 @@ public function setTransID(string $transID): self return $this; } /** - * An optional flag to indicate that partial landed cost calculations are acceptable to be used by upstream systems. - When set to *false*, the system will return an error when at least one commodity in the shipment is invalid (all or none), and no results will be sent back for that request. When set to *true*, the system will return partial calculations when applicable. - - Valid values: true = Partial Landed Cost result will return. false = All or No result will return (default). - * - * @return bool - */ + * An optional flag to indicate that partial landed cost calculations are acceptable to be used by upstream systems. + * When set to *false*, the system will return an error when at least one commodity in the shipment is invalid (all or none), and no results will be sent back for that request. When set to *true*, the system will return partial calculations when applicable. + * + * Valid values: true = Partial Landed Cost result will return. false = All or No result will return (default). + * + * @return bool + */ public function getAllowPartialLandedCostResult(): bool { return $this->allowPartialLandedCostResult; diff --git a/src/Api/Model/LandedCostRequestShipment.php b/src/Api/Model/LandedCostRequestShipment.php index 9dcb4beb..88425c9c 100644 --- a/src/Api/Model/LandedCostRequestShipment.php +++ b/src/Api/Model/LandedCostRequestShipment.php @@ -37,73 +37,74 @@ public function isInitialized($property): bool */ protected $shipDate; /** - * Supported Incoterm Values: - 1. CFR - Cost & Freight - 2. CIF - Cost, Insurance & Freight - 3. CIP - Carriage and Insurance Paid-To - 4. CPT - Carriage Paid-To - 5. DAP - Delivered At Place - 6. DAT - Delivered At Terminal - 7. DDP - Delivered Duty Paid - 8. DPU - Delivered at Place Unloaded - 9. EXW - Ex Works - 10. FAS - Free Alongside Ship - 11. FCA - Free Carrier - 12. FOB - Free On Board (Default) - * - * @var string - */ + * Supported Incoterm Values: + * 1. CFR - Cost & Freight + * 2. CIF - Cost, Insurance & Freight + * 3. CIP - Carriage and Insurance Paid-To + * 4. CPT - Carriage Paid-To + * 5. DAP - Delivered At Place + * 6. DAT - Delivered At Terminal + * 7. DDP - Delivered Duty Paid + * 8. DPU - Delivered at Place Unloaded + * 9. EXW - Ex Works + * 10. FAS - Free Alongside Ship + * 11. FCA - Free Carrier + * 12. FOB - Free On Board (Default) + * + * @var string + */ protected $incoterms = 'FOB'; /** * Specifies the export/ship-from/origin country of the shipment. Please check country List in the Appendix section. - **Note:** Export country code must be different from the import country code. + * + * **Note:** Export country code must be different from the import country code. * * @var string */ protected $exportCountryCode; /** - * The modes of transportation (in upper case). - Supported Values: - 1. INT_AIR 2. - INT_OCEAN - 3. INT_RAIL - 4. INT_TRUCK - 5. DOM_AIR - 6. DOM_OCEAN - 7. DOM_RAIL - 8. DOM_TRUCK - - Default value will vary based on the import country. - * - * @var string - */ + * The modes of transportation (in upper case). + * Supported Values: + * 1. INT_AIR 2. + * INT_OCEAN + * 3. INT_RAIL + * 4. INT_TRUCK + * 5. DOM_AIR + * 6. DOM_OCEAN + * 7. DOM_RAIL + * 8. DOM_TRUCK + * + * Default value will vary based on the import country. + * + * @var string + */ protected $transModes; /** - * Specifies the Freight charge or transport costs, which are used for tariff calculations. Landed cost result might have some dependency on the freight charges in some countries. Therefore, freight amount should be always provided for accurate Landed Cost result. - - Allowed values: - 1. Any non-negative floating-point number. - 2. Numeric value with optional decimal value. - * - * @var float - */ + * Specifies the Freight charge or transport costs, which are used for tariff calculations. Landed cost result might have some dependency on the freight charges in some countries. Therefore, freight amount should be always provided for accurate Landed Cost result. + * + * Allowed values: + * 1. Any non-negative floating-point number. + * 2. Numeric value with optional decimal value. + * + * @var float + */ protected $transportCost; /** - * Specifies the shipment type such as Gift, Document, Commercial (Sale), etc. - - Supported Shipment Types: - 1. GIFT - 2. COMMERCIAL - 3. SALE - 4. SAMPLE - 5. REPAIR - 6. RETURN - 7. OTHER - - Default value will vary and based on import country. - * - * @var string - */ + * Specifies the shipment type such as Gift, Document, Commercial (Sale), etc. + * + * Supported Shipment Types: + * 1. GIFT + * 2. COMMERCIAL + * 3. SALE + * 4. SAMPLE + * 5. REPAIR + * 6. RETURN + * 7. OTHER + * + * Default value will vary and based on import country. + * + * @var string + */ protected $shipmentType; /** * Array of shipment item objects (commodities), that are in a shipment. @@ -200,22 +201,22 @@ public function setShipDate(string $shipDate): self return $this; } /** - * Supported Incoterm Values: - 1. CFR - Cost & Freight - 2. CIF - Cost, Insurance & Freight - 3. CIP - Carriage and Insurance Paid-To - 4. CPT - Carriage Paid-To - 5. DAP - Delivered At Place - 6. DAT - Delivered At Terminal - 7. DDP - Delivered Duty Paid - 8. DPU - Delivered at Place Unloaded - 9. EXW - Ex Works - 10. FAS - Free Alongside Ship - 11. FCA - Free Carrier - 12. FOB - Free On Board (Default) - * - * @return string - */ + * Supported Incoterm Values: + * 1. CFR - Cost & Freight + * 2. CIF - Cost, Insurance & Freight + * 3. CIP - Carriage and Insurance Paid-To + * 4. CPT - Carriage Paid-To + * 5. DAP - Delivered At Place + * 6. DAT - Delivered At Terminal + * 7. DDP - Delivered Duty Paid + * 8. DPU - Delivered at Place Unloaded + * 9. EXW - Ex Works + * 10. FAS - Free Alongside Ship + * 11. FCA - Free Carrier + * 12. FOB - Free On Board (Default) + * + * @return string + */ public function getIncoterms(): string { return $this->incoterms; @@ -247,7 +248,8 @@ public function setIncoterms(string $incoterms): self } /** * Specifies the export/ship-from/origin country of the shipment. Please check country List in the Appendix section. - **Note:** Export country code must be different from the import country code. + * + * **Note:** Export country code must be different from the import country code. * * @return string */ @@ -270,21 +272,21 @@ public function setExportCountryCode(string $exportCountryCode): self return $this; } /** - * The modes of transportation (in upper case). - Supported Values: - 1. INT_AIR 2. - INT_OCEAN - 3. INT_RAIL - 4. INT_TRUCK - 5. DOM_AIR - 6. DOM_OCEAN - 7. DOM_RAIL - 8. DOM_TRUCK - - Default value will vary based on the import country. - * - * @return string - */ + * The modes of transportation (in upper case). + * Supported Values: + * 1. INT_AIR 2. + * INT_OCEAN + * 3. INT_RAIL + * 4. INT_TRUCK + * 5. DOM_AIR + * 6. DOM_OCEAN + * 7. DOM_RAIL + * 8. DOM_TRUCK + * + * Default value will vary based on the import country. + * + * @return string + */ public function getTransModes(): string { return $this->transModes; @@ -314,14 +316,14 @@ public function setTransModes(string $transModes): self return $this; } /** - * Specifies the Freight charge or transport costs, which are used for tariff calculations. Landed cost result might have some dependency on the freight charges in some countries. Therefore, freight amount should be always provided for accurate Landed Cost result. - - Allowed values: - 1. Any non-negative floating-point number. - 2. Numeric value with optional decimal value. - * - * @return float - */ + * Specifies the Freight charge or transport costs, which are used for tariff calculations. Landed cost result might have some dependency on the freight charges in some countries. Therefore, freight amount should be always provided for accurate Landed Cost result. + * + * Allowed values: + * 1. Any non-negative floating-point number. + * 2. Numeric value with optional decimal value. + * + * @return float + */ public function getTransportCost(): float { return $this->transportCost; @@ -344,21 +346,21 @@ public function setTransportCost(float $transportCost): self return $this; } /** - * Specifies the shipment type such as Gift, Document, Commercial (Sale), etc. - - Supported Shipment Types: - 1. GIFT - 2. COMMERCIAL - 3. SALE - 4. SAMPLE - 5. REPAIR - 6. RETURN - 7. OTHER - - Default value will vary and based on import country. - * - * @return string - */ + * Specifies the shipment type such as Gift, Document, Commercial (Sale), etc. + * + * Supported Shipment Types: + * 1. GIFT + * 2. COMMERCIAL + * 3. SALE + * 4. SAMPLE + * 5. REPAIR + * 6. RETURN + * 7. OTHER + * + * Default value will vary and based on import country. + * + * @return string + */ public function getShipmentType(): string { return $this->shipmentType; diff --git a/src/Api/Model/LocationAttributeOptionCode.php b/src/Api/Model/LocationAttributeOptionCode.php index 0cb92d6a..1d898e64 100644 --- a/src/Api/Model/LocationAttributeOptionCode.php +++ b/src/Api/Model/LocationAttributeOptionCode.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Only applicabe for OptionType = 03 (Additional Services). Valid values: - - 06 - Non transportation - - 07 - Transportation - - * - * @var string - */ + * Only applicabe for OptionType = 03 (Additional Services). Valid values: + * - 06 - Non transportation + * - 07 - Transportation + * + * + * @var string + */ protected $category; /** * These codes vary by country or territory. It is strongly recommended that clients contact UPS to retrieve the primary search indicator and the valid Location Types and Service Level Options for each country. Refer to Location Search Option Codes in the Appendix for additional information. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $code; /** - * Description is only applicable for Location and Retail Location. The description for Program types and additional service is not provided with Location detail. - - It is only provided when the request is for 8, 24, 40, 56-All available additional services or 16, 24, 48, 56-all available Program types. - - * - * @var string - */ + * Description is only applicable for Location and Retail Location. The description for Program types and additional service is not provided with Location detail. + * + * It is only provided when the request is for 8, 24, 40, 56-All available additional services or 16, 24, 48, 56-all available Program types. + * + * + * @var string + */ protected $description; /** * Name will indicate the name of any Additional Services/ Program Types depending on the option code. Text will be displayed in the locale selected. @@ -49,13 +49,13 @@ public function isInitialized($property): bool */ protected $transportationPickUpSchedule; /** - * Only applicabe for OptionType = 03 (Additional Services). Valid values: - - 06 - Non transportation - - 07 - Transportation - - * - * @return string - */ + * Only applicabe for OptionType = 03 (Additional Services). Valid values: + * - 06 - Non transportation + * - 07 - Transportation + * + * + * @return string + */ public function getCategory(): string { return $this->category; @@ -99,13 +99,13 @@ public function setCode(string $code): self return $this; } /** - * Description is only applicable for Location and Retail Location. The description for Program types and additional service is not provided with Location detail. - - It is only provided when the request is for 8, 24, 40, 56-All available additional services or 16, 24, 48, 56-all available Program types. - - * - * @return string - */ + * Description is only applicable for Location and Retail Location. The description for Program types and additional service is not provided with Location detail. + * + * It is only provided when the request is for 8, 24, 40, 56-All available additional services or 16, 24, 48, 56-all available Program types. + * + * + * @return string + */ public function getDescription(): string { return $this->description; diff --git a/src/Api/Model/LocationAttributeOptionType.php b/src/Api/Model/LocationAttributeOptionType.php index 77c158bf..6df62b0e 100644 --- a/src/Api/Model/LocationAttributeOptionType.php +++ b/src/Api/Model/LocationAttributeOptionType.php @@ -13,15 +13,15 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code for Option type. Valid values: - - 01 - Location - - 02 - Retail Location - - 03 - Additional Services - - 04 - Program Type - - * - * @var string - */ + * Code for Option type. Valid values: + * - 01 - Location + * - 02 - Retail Location + * - 03 - Additional Services + * - 04 - Program Type + * + * + * @var string + */ protected $code; /** * Description for Option type such as Location, RetailLocation, AdditionalServices and ProgramType. @@ -30,15 +30,15 @@ public function isInitialized($property): bool */ protected $description; /** - * Code for Option type. Valid values: - - 01 - Location - - 02 - Retail Location - - 03 - Additional Services - - 04 - Program Type - - * - * @return string - */ + * Code for Option type. Valid values: + * - 01 - Location + * - 02 - Retail Location + * - 03 - Additional Services + * - 04 - Program Type + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/LocationSearchCriteriaAccessPointSearch.php b/src/Api/Model/LocationSearchCriteriaAccessPointSearch.php index ce7c07c9..f56ee0f8 100644 --- a/src/Api/Model/LocationSearchCriteriaAccessPointSearch.php +++ b/src/Api/Model/LocationSearchCriteriaAccessPointSearch.php @@ -19,12 +19,12 @@ public function isInitialized($property): bool */ protected $publicAccessPointID; /** - * Status of UPS Access Point. Valid values are: - 01-Active-available - 07-Active-unavailable. - * - * @var string - */ + * Status of UPS Access Point. Valid values are: + * 01-Active-available + * 07-Active-unavailable. + * + * @var string + */ protected $accessPointStatus; /** * The account number to use for UPS Access Point Search in the country or territory. Used to locate a private network for the account. Once this parameter is present any access point address or geocode search is ignored. It cannot be combined with PublicAccessPointID search parameter. @@ -79,12 +79,12 @@ public function setPublicAccessPointID(string $publicAccessPointID): self return $this; } /** - * Status of UPS Access Point. Valid values are: - 01-Active-available - 07-Active-unavailable. - * - * @return string - */ + * Status of UPS Access Point. Valid values are: + * 01-Active-available + * 07-Active-unavailable. + * + * @return string + */ public function getAccessPointStatus(): string { return $this->accessPointStatus; diff --git a/src/Api/Model/LocationSearchCriteriaFreightWillCallSearch.php b/src/Api/Model/LocationSearchCriteriaFreightWillCallSearch.php index 8b796f73..d05e36b8 100644 --- a/src/Api/Model/LocationSearchCriteriaFreightWillCallSearch.php +++ b/src/Api/Model/LocationSearchCriteriaFreightWillCallSearch.php @@ -13,61 +13,59 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Valid values are: - 1 - Postal Code - 2 - Delivery SLIC - 3 - Delivery City/State. - 1: Freight Will Call Search based on Postal Code, this search is valid for Postal code countries. 2: Freight Will Call Search based on SLIC. 3: Freight Will Call Search based on City and/or State. This Search is valid for non-postal code Countries - * - * @var string - */ + * Valid values are: + * 1 - Postal Code + * 2 - Delivery SLIC + * 3 - Delivery City/State. + * 1: Freight Will Call Search based on Postal Code, this search is valid for Postal code countries. 2: Freight Will Call Search based on SLIC. 3: Freight Will Call Search based on City and/or State. This Search is valid for non-postal code Countries + * + * @var string + */ protected $freightWillCallRequestType; /** - * - * * @var list */ protected $facilityAddress; /** - * OriginOrDestination is required for FreightWillCallRequestType 1 and type 3 . Valid values: - 01-Origin facilities - 02-Destination facilities. - * - * @var string - */ + * OriginOrDestination is required for FreightWillCallRequestType 1 and type 3 . Valid values: + * 01-Origin facilities + * 02-Destination facilities. + * + * @var string + */ protected $originOrDestination; /** - * FormatPostalCode would be required in the request when FreightWillCallRequestType is 1. Valid values are: - NFR-No format requested - FR-format requested - FS-format and search - NVR-No validation requested. - * - * @var string - */ + * FormatPostalCode would be required in the request when FreightWillCallRequestType is 1. Valid values are: + * NFR-No format requested + * FR-format requested + * FS-format and search + * NVR-No validation requested. + * + * @var string + */ protected $formatPostalCode; /** - * Day Of week Code. Valid Values are 1 to 7. - 1-Sunday - 2-Monday - 3-Tuesday - 4-Wednesday - 5-Thursday - 6-Friday - 7-Saturday. - * - * @var string - */ + * Day Of week Code. Valid Values are 1 to 7. + * 1-Sunday + * 2-Monday + * 3-Tuesday + * 4-Wednesday + * 5-Thursday + * 6-Friday + * 7-Saturday. + * + * @var string + */ protected $dayOfWeekCode; /** - * Valid values are: - 1 - Postal Code - 2 - Delivery SLIC - 3 - Delivery City/State. - 1: Freight Will Call Search based on Postal Code, this search is valid for Postal code countries. 2: Freight Will Call Search based on SLIC. 3: Freight Will Call Search based on City and/or State. This Search is valid for non-postal code Countries - * - * @return string - */ + * Valid values are: + * 1 - Postal Code + * 2 - Delivery SLIC + * 3 - Delivery City/State. + * 1: Freight Will Call Search based on Postal Code, this search is valid for Postal code countries. 2: Freight Will Call Search based on SLIC. 3: Freight Will Call Search based on City and/or State. This Search is valid for non-postal code Countries + * + * @return string + */ public function getFreightWillCallRequestType(): string { return $this->freightWillCallRequestType; @@ -90,8 +88,6 @@ public function setFreightWillCallRequestType(string $freightWillCallRequestType return $this; } /** - * - * * @return list */ public function getFacilityAddress(): array @@ -99,8 +95,6 @@ public function getFacilityAddress(): array return $this->facilityAddress; } /** - * - * * @param list $facilityAddress * * @return self @@ -112,12 +106,12 @@ public function setFacilityAddress(array $facilityAddress): self return $this; } /** - * OriginOrDestination is required for FreightWillCallRequestType 1 and type 3 . Valid values: - 01-Origin facilities - 02-Destination facilities. - * - * @return string - */ + * OriginOrDestination is required for FreightWillCallRequestType 1 and type 3 . Valid values: + * 01-Origin facilities + * 02-Destination facilities. + * + * @return string + */ public function getOriginOrDestination(): string { return $this->originOrDestination; @@ -138,14 +132,14 @@ public function setOriginOrDestination(string $originOrDestination): self return $this; } /** - * FormatPostalCode would be required in the request when FreightWillCallRequestType is 1. Valid values are: - NFR-No format requested - FR-format requested - FS-format and search - NVR-No validation requested. - * - * @return string - */ + * FormatPostalCode would be required in the request when FreightWillCallRequestType is 1. Valid values are: + * NFR-No format requested + * FR-format requested + * FS-format and search + * NVR-No validation requested. + * + * @return string + */ public function getFormatPostalCode(): string { return $this->formatPostalCode; @@ -168,17 +162,17 @@ public function setFormatPostalCode(string $formatPostalCode): self return $this; } /** - * Day Of week Code. Valid Values are 1 to 7. - 1-Sunday - 2-Monday - 3-Tuesday - 4-Wednesday - 5-Thursday - 6-Friday - 7-Saturday. - * - * @return string - */ + * Day Of week Code. Valid Values are 1 to 7. + * 1-Sunday + * 2-Monday + * 3-Tuesday + * 4-Wednesday + * 5-Thursday + * 6-Friday + * 7-Saturday. + * + * @return string + */ public function getDayOfWeekCode(): string { return $this->dayOfWeekCode; diff --git a/src/Api/Model/LocationSearchCriteriaOpenTimeCriteria.php b/src/Api/Model/LocationSearchCriteriaOpenTimeCriteria.php index ff920c09..76bf3667 100644 --- a/src/Api/Model/LocationSearchCriteriaOpenTimeCriteria.php +++ b/src/Api/Model/LocationSearchCriteriaOpenTimeCriteria.php @@ -13,18 +13,18 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Day Of week Code. - Valid values: - 1-Sunday - 2-Monday - 3-Tuesday - 4-Wednesday - 5-Thursday - 6-Friday - 7-Saturday - * - * @var string - */ + * Day Of week Code. + * Valid values: + * 1-Sunday + * 2-Monday + * 3-Tuesday + * 4-Wednesday + * 5-Thursday + * 6-Friday + * 7-Saturday + * + * @var string + */ protected $dayOfWeekCode; /** * From time. Time Format HHMM. @@ -39,18 +39,18 @@ public function isInitialized($property): bool */ protected $toTime; /** - * Day Of week Code. - Valid values: - 1-Sunday - 2-Monday - 3-Tuesday - 4-Wednesday - 5-Thursday - 6-Friday - 7-Saturday - * - * @return string - */ + * Day Of week Code. + * Valid values: + * 1-Sunday + * 2-Monday + * 3-Tuesday + * 4-Wednesday + * 5-Thursday + * 6-Friday + * 7-Saturday + * + * @return string + */ public function getDayOfWeekCode(): string { return $this->dayOfWeekCode; diff --git a/src/Api/Model/LocationSearchCriteriaSearchOption.php b/src/Api/Model/LocationSearchCriteriaSearchOption.php index 581e1ef9..ca6c0d25 100644 --- a/src/Api/Model/LocationSearchCriteriaSearchOption.php +++ b/src/Api/Model/LocationSearchCriteriaSearchOption.php @@ -13,32 +13,30 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * OptionType is a container that indicates the type of search for locations. There are 5 types of search. They are search by: Location, Retail Location, Additional Services, Program Type, and a Service Level Option. - If search criteria by Location or Retail Location is not provided the default search of The UPS Store, UPS Center, UPS Drop Box, and Authorized Shipping Outlet location types will be performed. - * - * @var SearchOptionOptionType - */ + * OptionType is a container that indicates the type of search for locations. There are 5 types of search. They are search by: Location, Retail Location, Additional Services, Program Type, and a Service Level Option. + * If search criteria by Location or Retail Location is not provided the default search of The UPS Store, UPS Center, UPS Drop Box, and Authorized Shipping Outlet location types will be performed. + * + * @var SearchOptionOptionType + */ protected $optionType; /** - * - * * @var list */ protected $optionCode; /** - * The relation container will contain the relation parameter (And/Or) that has to be used among multiple option codes in the location search. - - This is only applicable to option type Additional Services and Program Types. If this container is not present for Additional Services and Program Types, the default relation of And is used. - * - * @var SearchOptionRelation - */ + * The relation container will contain the relation parameter (And/Or) that has to be used among multiple option codes in the location search. + * + * This is only applicable to option type Additional Services and Program Types. If this container is not present for Additional Services and Program Types, the default relation of And is used. + * + * @var SearchOptionRelation + */ protected $relation; /** - * OptionType is a container that indicates the type of search for locations. There are 5 types of search. They are search by: Location, Retail Location, Additional Services, Program Type, and a Service Level Option. - If search criteria by Location or Retail Location is not provided the default search of The UPS Store, UPS Center, UPS Drop Box, and Authorized Shipping Outlet location types will be performed. - * - * @return SearchOptionOptionType - */ + * OptionType is a container that indicates the type of search for locations. There are 5 types of search. They are search by: Location, Retail Location, Additional Services, Program Type, and a Service Level Option. + * If search criteria by Location or Retail Location is not provided the default search of The UPS Store, UPS Center, UPS Drop Box, and Authorized Shipping Outlet location types will be performed. + * + * @return SearchOptionOptionType + */ public function getOptionType(): SearchOptionOptionType { return $this->optionType; @@ -58,8 +56,6 @@ public function setOptionType(SearchOptionOptionType $optionType): self return $this; } /** - * - * * @return list */ public function getOptionCode(): array @@ -67,8 +63,6 @@ public function getOptionCode(): array return $this->optionCode; } /** - * - * * @param list $optionCode * * @return self @@ -80,12 +74,12 @@ public function setOptionCode(array $optionCode): self return $this; } /** - * The relation container will contain the relation parameter (And/Or) that has to be used among multiple option codes in the location search. - - This is only applicable to option type Additional Services and Program Types. If this container is not present for Additional Services and Program Types, the default relation of And is used. - * - * @return SearchOptionRelation - */ + * The relation container will contain the relation parameter (And/Or) that has to be used among multiple option codes in the location search. + * + * This is only applicable to option type Additional Services and Program Types. If this container is not present for Additional Services and Program Types, the default relation of And is used. + * + * @return SearchOptionRelation + */ public function getRelation(): SearchOptionRelation { return $this->relation; diff --git a/src/Api/Model/LocationSearchCriteriaServiceSearch.php b/src/Api/Model/LocationSearchCriteriaServiceSearch.php index dca7386e..ee999614 100644 --- a/src/Api/Model/LocationSearchCriteriaServiceSearch.php +++ b/src/Api/Model/LocationSearchCriteriaServiceSearch.php @@ -19,14 +19,10 @@ public function isInitialized($property): bool */ protected $time; /** - * - * * @var list */ protected $serviceCode; /** - * - * * @var list */ protected $serviceOptionCode; @@ -53,8 +49,6 @@ public function setTime(string $time): self return $this; } /** - * - * * @return list */ public function getServiceCode(): array @@ -62,8 +56,6 @@ public function getServiceCode(): array return $this->serviceCode; } /** - * - * * @param list $serviceCode * * @return self @@ -75,8 +67,6 @@ public function setServiceCode(array $serviceCode): self return $this; } /** - * - * * @return list */ public function getServiceOptionCode(): array @@ -84,8 +74,6 @@ public function getServiceOptionCode(): array return $this->serviceOptionCode; } /** - * - * * @param list $serviceOptionCode * * @return self diff --git a/src/Api/Model/LocatorRequest.php b/src/Api/Model/LocatorRequest.php index 106695ba..fd577a17 100644 --- a/src/Api/Model/LocatorRequest.php +++ b/src/Api/Model/LocatorRequest.php @@ -43,11 +43,11 @@ public function isInitialized($property): bool */ protected $locationID; /** - * The Location search criteria container allows the user to further define the basis to which they wish to receive the UPS locations. - Only relevant when the user requests a Location search (request option 1). - * - * @var LocatorRequestLocationSearchCriteria - */ + * The Location search criteria container allows the user to further define the basis to which they wish to receive the UPS locations. + * Only relevant when the user requests a Location search (request option 1). + * + * @var LocatorRequestLocationSearchCriteria + */ protected $locationSearchCriteria; /** * Container for Sort Criteria @@ -62,16 +62,16 @@ public function isInitialized($property): bool */ protected $allowAllConfidenceLevels; /** - * Valid values: - 01-Proximity Search Details - 02-Address Search Details - 03-Proximity Search Summary - 04-Address Search Summary - 05-Freight Will Call Search. - Either OptionType 03 or 04 is required. - * - * @var string - */ + * Valid values: + * 01-Proximity Search Details + * 02-Address Search Details + * 03-Proximity Search Summary + * 04-Address Search Summary + * 05-Freight Will Call Search. + * Either OptionType 03 or 04 is required. + * + * @var string + */ protected $searchOptionCode; /** * ServiceGeoUnit Container. Required to search for the freight facility information @@ -196,11 +196,11 @@ public function setLocationID(array $locationID): self return $this; } /** - * The Location search criteria container allows the user to further define the basis to which they wish to receive the UPS locations. - Only relevant when the user requests a Location search (request option 1). - * - * @return LocatorRequestLocationSearchCriteria - */ + * The Location search criteria container allows the user to further define the basis to which they wish to receive the UPS locations. + * Only relevant when the user requests a Location search (request option 1). + * + * @return LocatorRequestLocationSearchCriteria + */ public function getLocationSearchCriteria(): LocatorRequestLocationSearchCriteria { return $this->locationSearchCriteria; @@ -264,16 +264,16 @@ public function setAllowAllConfidenceLevels(string $allowAllConfidenceLevels): s return $this; } /** - * Valid values: - 01-Proximity Search Details - 02-Address Search Details - 03-Proximity Search Summary - 04-Address Search Summary - 05-Freight Will Call Search. - Either OptionType 03 or 04 is required. - * - * @return string - */ + * Valid values: + * 01-Proximity Search Details + * 02-Address Search Details + * 03-Proximity Search Summary + * 04-Address Search Summary + * 05-Freight Will Call Search. + * Either OptionType 03 or 04 is required. + * + * @return string + */ public function getSearchOptionCode(): string { return $this->searchOptionCode; diff --git a/src/Api/Model/LocatorRequestLocationSearchCriteria.php b/src/Api/Model/LocatorRequestLocationSearchCriteria.php index 80713280..54a64187 100644 --- a/src/Api/Model/LocatorRequestLocationSearchCriteria.php +++ b/src/Api/Model/LocatorRequestLocationSearchCriteria.php @@ -13,8 +13,6 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $searchOption; @@ -25,14 +23,14 @@ public function isInitialized($property): bool */ protected $maximumListSize; /** - * Defines the maximum radius the user wishes to search for a UPS location. If the user does not specify, the default value is 100 miles. Whole numbers only. - - Valid values are: - 5-100 for UnitOfMeasure MI - 5-150 for UnitOfMesaure KM - * - * @var string - */ + * Defines the maximum radius the user wishes to search for a UPS location. If the user does not specify, the default value is 100 miles. Whole numbers only. + * + * Valid values are: + * 5-100 for UnitOfMeasure MI + * 5-150 for UnitOfMesaure KM + * + * @var string + */ protected $searchRadius; /** * Allows for users to further define the search criteria. Refer to the rules specified in Service Search section. @@ -65,8 +63,6 @@ public function isInitialized($property): bool */ protected $brexitFilter; /** - * - * * @return list */ public function getSearchOption(): array @@ -74,8 +70,6 @@ public function getSearchOption(): array return $this->searchOption; } /** - * - * * @param list $searchOption * * @return self @@ -109,14 +103,14 @@ public function setMaximumListSize(string $maximumListSize): self return $this; } /** - * Defines the maximum radius the user wishes to search for a UPS location. If the user does not specify, the default value is 100 miles. Whole numbers only. - - Valid values are: - 5-100 for UnitOfMeasure MI - 5-150 for UnitOfMesaure KM - * - * @return string - */ + * Defines the maximum radius the user wishes to search for a UPS location. If the user does not specify, the default value is 100 miles. Whole numbers only. + * + * Valid values are: + * 5-100 for UnitOfMeasure MI + * 5-150 for UnitOfMesaure KM + * + * @return string + */ public function getSearchRadius(): string { return $this->searchRadius; diff --git a/src/Api/Model/LocatorRequestOriginAddress.php b/src/Api/Model/LocatorRequestOriginAddress.php index d57081e0..3513240b 100644 --- a/src/Api/Model/LocatorRequestOriginAddress.php +++ b/src/Api/Model/LocatorRequestOriginAddress.php @@ -19,19 +19,19 @@ public function isInitialized($property): bool */ protected $geocode; /** - * Contains all of the basic information about the origin such as: Address Lines, City, State/Province, Postal Code and Country or Territory Code. - The element CountryCode is required. - * - * @var OriginAddressAddressKeyFormat - */ + * Contains all of the basic information about the origin such as: Address Lines, City, State/Province, Postal Code and Country or Territory Code. + * The element CountryCode is required. + * + * @var OriginAddressAddressKeyFormat + */ protected $addressKeyFormat; /** - * If present, indicates the maximum number of locations the client wishes to receive in an address candidate response where the provided origin information is insufficient to accurately establish location. - - Valid values: 1-50, default 10 - * - * @var string - */ + * If present, indicates the maximum number of locations the client wishes to receive in an address candidate response where the provided origin information is insufficient to accurately establish location. + * + * Valid values: 1-50, default 10 + * + * @var string + */ protected $maximumListSize; /** * Geocode is the latitude and longitude of the origin address. @@ -56,11 +56,11 @@ public function setGeocode(OriginAddressGeocode $geocode): self return $this; } /** - * Contains all of the basic information about the origin such as: Address Lines, City, State/Province, Postal Code and Country or Territory Code. - The element CountryCode is required. - * - * @return OriginAddressAddressKeyFormat - */ + * Contains all of the basic information about the origin such as: Address Lines, City, State/Province, Postal Code and Country or Territory Code. + * The element CountryCode is required. + * + * @return OriginAddressAddressKeyFormat + */ public function getAddressKeyFormat(): OriginAddressAddressKeyFormat { return $this->addressKeyFormat; @@ -80,12 +80,12 @@ public function setAddressKeyFormat(OriginAddressAddressKeyFormat $addressKeyFor return $this; } /** - * If present, indicates the maximum number of locations the client wishes to receive in an address candidate response where the provided origin information is insufficient to accurately establish location. - - Valid values: 1-50, default 10 - * - * @return string - */ + * If present, indicates the maximum number of locations the client wishes to receive in an address candidate response where the provided origin information is insufficient to accurately establish location. + * + * Valid values: 1-50, default 10 + * + * @return string + */ public function getMaximumListSize(): string { return $this->maximumListSize; diff --git a/src/Api/Model/LocatorRequestRequest.php b/src/Api/Model/LocatorRequestRequest.php index 7e3666d5..8205cb57 100644 --- a/src/Api/Model/LocatorRequestRequest.php +++ b/src/Api/Model/LocatorRequestRequest.php @@ -19,27 +19,27 @@ public function isInitialized($property): bool */ protected $transactionReference; /** - * Indicates the action to be taken by the XML service. - The only valid value is 'Locator'. - * - * @var string - */ + * Indicates the action to be taken by the XML service. + * The only valid value is 'Locator'. + * + * @var string + */ protected $requestAction; /** - * Indicates the type of request. - Valid values: - 1-Locations (Drop Locations and Will call locations) - 8-All available Additional Services - 16-All available Program Types - 24-All available Additional Services and Program types - 32-All available Retail Locations - 40-All available Retail Locations and Additional Services - 48-All available Retail Locations and Program Types - 56-All available Retail Locations, Additional Services and Program Types - 64-Search for UPS Access Point Locations. - * - * @var string - */ + * Indicates the type of request. + * Valid values: + * 1-Locations (Drop Locations and Will call locations) + * 8-All available Additional Services + * 16-All available Program Types + * 24-All available Additional Services and Program types + * 32-All available Retail Locations + * 40-All available Retail Locations and Additional Services + * 48-All available Retail Locations and Program Types + * 56-All available Retail Locations, Additional Services and Program Types + * 64-Search for UPS Access Point Locations. + * + * @var string + */ protected $requestOption; /** * TransactionReference identifies transactions between client and server. @@ -64,11 +64,11 @@ public function setTransactionReference(RequestTransactionReference $transaction return $this; } /** - * Indicates the action to be taken by the XML service. - The only valid value is 'Locator'. - * - * @return string - */ + * Indicates the action to be taken by the XML service. + * The only valid value is 'Locator'. + * + * @return string + */ public function getRequestAction(): string { return $this->requestAction; @@ -88,20 +88,20 @@ public function setRequestAction(string $requestAction): self return $this; } /** - * Indicates the type of request. - Valid values: - 1-Locations (Drop Locations and Will call locations) - 8-All available Additional Services - 16-All available Program Types - 24-All available Additional Services and Program types - 32-All available Retail Locations - 40-All available Retail Locations and Additional Services - 48-All available Retail Locations and Program Types - 56-All available Retail Locations, Additional Services and Program Types - 64-Search for UPS Access Point Locations. - * - * @return string - */ + * Indicates the type of request. + * Valid values: + * 1-Locations (Drop Locations and Will call locations) + * 8-All available Additional Services + * 16-All available Program Types + * 24-All available Additional Services and Program types + * 32-All available Retail Locations + * 40-All available Retail Locations and Additional Services + * 48-All available Retail Locations and Program Types + * 56-All available Retail Locations, Additional Services and Program Types + * 64-Search for UPS Access Point Locations. + * + * @return string + */ public function getRequestOption(): string { return $this->requestOption; diff --git a/src/Api/Model/LocatorRequestServiceGeoUnit.php b/src/Api/Model/LocatorRequestServiceGeoUnit.php index 0bd46636..cad8de85 100644 --- a/src/Api/Model/LocatorRequestServiceGeoUnit.php +++ b/src/Api/Model/LocatorRequestServiceGeoUnit.php @@ -13,25 +13,25 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Service Code. Required if ServiceGeoUnit Container present. - Valid value is '096' . - * - * @var string - */ + * Service Code. Required if ServiceGeoUnit Container present. + * Valid value is '096' . + * + * @var string + */ protected $serviceCode; /** - * GeoPoliticalUnit. Required if ServiceGeoUnit container present. - Valid value is '002' . - * - * @var string - */ + * GeoPoliticalUnit. Required if ServiceGeoUnit container present. + * Valid value is '002' . + * + * @var string + */ protected $geoPoliticalUnit; /** - * Service Code. Required if ServiceGeoUnit Container present. - Valid value is '096' . - * - * @return string - */ + * Service Code. Required if ServiceGeoUnit Container present. + * Valid value is '096' . + * + * @return string + */ public function getServiceCode(): string { return $this->serviceCode; @@ -51,11 +51,11 @@ public function setServiceCode(string $serviceCode): self return $this; } /** - * GeoPoliticalUnit. Required if ServiceGeoUnit container present. - Valid value is '002' . - * - * @return string - */ + * GeoPoliticalUnit. Required if ServiceGeoUnit container present. + * Valid value is '002' . + * + * @return string + */ public function getGeoPoliticalUnit(): string { return $this->geoPoliticalUnit; diff --git a/src/Api/Model/LocatorRequestSortCriteria.php b/src/Api/Model/LocatorRequestSortCriteria.php index f112a320..5ddcdb55 100644 --- a/src/Api/Model/LocatorRequestSortCriteria.php +++ b/src/Api/Model/LocatorRequestSortCriteria.php @@ -13,26 +13,26 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * For different sort type. Valid values: - 01-Closest Location - 02-Deadline for Drop-off by Air/Express - 03-Deadline for Drop-off by Ground/Standard - 04-Latest Close Time - 05-Earliest Open Time. - * - * @var string - */ + * For different sort type. Valid values: + * 01-Closest Location + * 02-Deadline for Drop-off by Air/Express + * 03-Deadline for Drop-off by Ground/Standard + * 04-Latest Close Time + * 05-Earliest Open Time. + * + * @var string + */ protected $sortType; /** - * For different sort type. Valid values: - 01-Closest Location - 02-Deadline for Drop-off by Air/Express - 03-Deadline for Drop-off by Ground/Standard - 04-Latest Close Time - 05-Earliest Open Time. - * - * @return string - */ + * For different sort type. Valid values: + * 01-Closest Location + * 02-Deadline for Drop-off by Air/Express + * 03-Deadline for Drop-off by Ground/Standard + * 04-Latest Close Time + * 05-Earliest Open Time. + * + * @return string + */ public function getSortType(): string { return $this->sortType; diff --git a/src/Api/Model/LocatorRequestTranslate.php b/src/Api/Model/LocatorRequestTranslate.php index 8e13b689..b82fb069 100644 --- a/src/Api/Model/LocatorRequestTranslate.php +++ b/src/Api/Model/LocatorRequestTranslate.php @@ -13,20 +13,20 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Locale is the 5 digit combination of 2 character language code and 2 character country or territory code separated by an underscore ('_') character. Will be used to determine what language the response will be sent in. - Default value is: en_US. - Examples are: fr_CA, es_MX. - * - * @var string - */ + * Locale is the 5 digit combination of 2 character language code and 2 character country or territory code separated by an underscore ('_') character. Will be used to determine what language the response will be sent in. + * Default value is: en_US. + * Examples are: fr_CA, es_MX. + * + * @var string + */ protected $locale; /** - * Locale is the 5 digit combination of 2 character language code and 2 character country or territory code separated by an underscore ('_') character. Will be used to determine what language the response will be sent in. - Default value is: en_US. - Examples are: fr_CA, es_MX. - * - * @return string - */ + * Locale is the 5 digit combination of 2 character language code and 2 character country or territory code separated by an underscore ('_') character. Will be used to determine what language the response will be sent in. + * Default value is: en_US. + * Examples are: fr_CA, es_MX. + * + * @return string + */ public function getLocale(): string { return $this->locale; diff --git a/src/Api/Model/LocatorRequestUnitOfMeasurement.php b/src/Api/Model/LocatorRequestUnitOfMeasurement.php index 3dc14aa7..b5fb686a 100644 --- a/src/Api/Model/LocatorRequestUnitOfMeasurement.php +++ b/src/Api/Model/LocatorRequestUnitOfMeasurement.php @@ -13,24 +13,24 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Valid values are: - - - MI-Miles - - KM-Kilometers - - * - * @var string - */ + * Valid values are: + * + * - MI-Miles + * - KM-Kilometers + * + * + * @var string + */ protected $code; /** - * Valid values are: - - - MI-Miles - - KM-Kilometers - - * - * @return string - */ + * Valid values are: + * + * - MI-Miles + * - KM-Kilometers + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/LocatorResponse.php b/src/Api/Model/LocatorResponse.php index 266a4ec7..1e06476c 100644 --- a/src/Api/Model/LocatorResponse.php +++ b/src/Api/Model/LocatorResponse.php @@ -31,11 +31,11 @@ public function isInitialized($property): bool */ protected $searchResults; /** - * Confidence level. - Valid values: True or False - * - * @var string - */ + * Confidence level. + * Valid values: True or False + * + * @var string + */ protected $allowAllConfidenceLevels; /** * Container for Response. @@ -104,11 +104,11 @@ public function setSearchResults(LocatorResponseSearchResults $searchResults): s return $this; } /** - * Confidence level. - Valid values: True or False - * - * @return string - */ + * Confidence level. + * Valid values: True or False + * + * @return string + */ public function getAllowAllConfidenceLevels(): string { return $this->allowAllConfidenceLevels; diff --git a/src/Api/Model/LocatorResponseResponse.php b/src/Api/Model/LocatorResponseResponse.php index 1c45da5e..24f493bd 100644 --- a/src/Api/Model/LocatorResponseResponse.php +++ b/src/Api/Model/LocatorResponseResponse.php @@ -19,12 +19,12 @@ public function isInitialized($property): bool */ protected $transactionReference; /** - * Identifies the success or failure of the interchange. - 1-Success - 0-Failure - * - * @var string - */ + * Identifies the success or failure of the interchange. + * 1-Success + * 0-Failure + * + * @var string + */ protected $responseStatusCode; /** * Describes the Response Status Code. @@ -33,8 +33,6 @@ public function isInitialized($property): bool */ protected $responseStatusDescription; /** - * - * * @var ResponseError */ protected $error; @@ -61,12 +59,12 @@ public function setTransactionReference(ResponseTransactionReference $transactio return $this; } /** - * Identifies the success or failure of the interchange. - 1-Success - 0-Failure - * - * @return string - */ + * Identifies the success or failure of the interchange. + * 1-Success + * 0-Failure + * + * @return string + */ public function getResponseStatusCode(): string { return $this->responseStatusCode; @@ -109,8 +107,6 @@ public function setResponseStatusDescription(string $responseStatusDescription): return $this; } /** - * - * * @return ResponseError */ public function getError(): ResponseError @@ -118,8 +114,6 @@ public function getError(): ResponseError return $this->error; } /** - * - * * @param ResponseError $error * * @return self diff --git a/src/Api/Model/LocatorResponseSearchResults.php b/src/Api/Model/LocatorResponseSearchResults.php index df273c6e..b5104ef5 100644 --- a/src/Api/Model/LocatorResponseSearchResults.php +++ b/src/Api/Model/LocatorResponseSearchResults.php @@ -14,44 +14,52 @@ public function isInitialized($property): bool } /** * If the origin address provided in the location request document does not have a match, a list of candidate addresses, geocodes and optionally a landmark will be returned. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $geocodeCandidate; /** - * Disclaimer. In the event the user requested Ground and Air service types and the maximum UPS locations list size has not been met, the list of locations will continue with locations that provide either ground or air within the search radius. - - The disclaimer will note this deviation from the requested search criteria. The disclaimer is also the location where the user will receive information regarding a one-time pickup option if the first location is greater than 20 miles from the origin. - * - * @var string - */ + * Disclaimer. In the event the user requested Ground and Air service types and the maximum UPS locations list size has not been met, the list of locations will continue with locations that provide either ground or air within the search radius. + * + * The disclaimer will note this deviation from the requested search criteria. The disclaimer is also the location where the user will receive information regarding a one-time pickup option if the first location is greater than 20 miles from the origin. + * + * @var string + */ protected $disclaimer; /** * When a location request is submitted with a valid origin address, UPS locations will be returned. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $dropLocation; /** * This container contains the information about the currently existing Retail Locations or Additional Services or Program types. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $availableLocationAttributes; /** - * Indicates whether the country or territory has AccessPoints or not. - - This tag is populated in the Response only if tag "ExistIndicator" was present in the Locator request. - * - * @var string - */ + * Indicates whether the country or territory has AccessPoints or not. + * + * This tag is populated in the Response only if tag "ExistIndicator" was present in the Locator request. + * + * @var string + */ protected $activeAvailableAccessPointIndicator; /** * If the origin address provided in the location request document does not have a match, a list of candidate addresses, geocodes and optionally a landmark will be returned. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -74,12 +82,12 @@ public function setGeocodeCandidate(array $geocodeCandidate): self return $this; } /** - * Disclaimer. In the event the user requested Ground and Air service types and the maximum UPS locations list size has not been met, the list of locations will continue with locations that provide either ground or air within the search radius. - - The disclaimer will note this deviation from the requested search criteria. The disclaimer is also the location where the user will receive information regarding a one-time pickup option if the first location is greater than 20 miles from the origin. - * - * @return string - */ + * Disclaimer. In the event the user requested Ground and Air service types and the maximum UPS locations list size has not been met, the list of locations will continue with locations that provide either ground or air within the search radius. + * + * The disclaimer will note this deviation from the requested search criteria. The disclaimer is also the location where the user will receive information regarding a one-time pickup option if the first location is greater than 20 miles from the origin. + * + * @return string + */ public function getDisclaimer(): string { return $this->disclaimer; @@ -101,7 +109,9 @@ public function setDisclaimer(string $disclaimer): self } /** * When a location request is submitted with a valid origin address, UPS locations will be returned. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -125,7 +135,9 @@ public function setDropLocation(array $dropLocation): self } /** * This container contains the information about the currently existing Retail Locations or Additional Services or Program types. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -148,12 +160,12 @@ public function setAvailableLocationAttributes(array $availableLocationAttribute return $this; } /** - * Indicates whether the country or territory has AccessPoints or not. - - This tag is populated in the Response only if tag "ExistIndicator" was present in the Locator request. - * - * @return string - */ + * Indicates whether the country or territory has AccessPoints or not. + * + * This tag is populated in the Response only if tag "ExistIndicator" was present in the Locator request. + * + * @return string + */ public function getActiveAvailableAccessPointIndicator(): string { return $this->activeAvailableAccessPointIndicator; diff --git a/src/Api/Model/ManifestBillToAccount.php b/src/Api/Model/ManifestBillToAccount.php index 1216faec..a203226e 100644 --- a/src/Api/Model/ManifestBillToAccount.php +++ b/src/Api/Model/ManifestBillToAccount.php @@ -13,15 +13,15 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Indicates how shipping charges for the package were billed. Valid values: - - 01 - Shipper - - 02 - Consignee Billing - - 03 - Third Party - - 04 - Freight Collect - - * - * @var string - */ + * Indicates how shipping charges for the package were billed. Valid values: + * - 01 - Shipper + * - 02 - Consignee Billing + * - 03 - Third Party + * - 04 - Freight Collect + * + * + * @var string + */ protected $option; /** * The UPS Account number to which the shipping charges were billed. @@ -30,15 +30,15 @@ public function isInitialized($property): bool */ protected $number; /** - * Indicates how shipping charges for the package were billed. Valid values: - - 01 - Shipper - - 02 - Consignee Billing - - 03 - Third Party - - 04 - Freight Collect - - * - * @return string - */ + * Indicates how shipping charges for the package were billed. Valid values: + * - 01 - Shipper + * - 02 - Consignee Billing + * - 03 - Third Party + * - 04 - Freight Collect + * + * + * @return string + */ public function getOption(): string { return $this->option; diff --git a/src/Api/Model/ManifestPackage.php b/src/Api/Model/ManifestPackage.php index ce9cfec1..2928122a 100644 --- a/src/Api/Model/ManifestPackage.php +++ b/src/Api/Model/ManifestPackage.php @@ -14,7 +14,9 @@ public function isInitialized($property): bool } /** * Information about package delivery activity. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -26,11 +28,11 @@ public function isInitialized($property): bool */ protected $description; /** - * Container tag for package dimension information. - Length + 2 * (Width + Height) must be less than or equal to 130 IN or 330 CM. - * - * @var ManifestPackageDimensions - */ + * Container tag for package dimension information. + * Length + 2 * (Width + Height) must be less than or equal to 130 IN or 330 CM. + * + * @var ManifestPackageDimensions + */ protected $dimensions; /** * Container tag for package dimensional weight. @@ -45,14 +47,14 @@ public function isInitialized($property): bool */ protected $packageWeight; /** - * Values for LargePackage are: - - 1 - Oversize 1 - - 2 - Oversize 2 - - 4 - Large package - - * - * @var string - */ + * Values for LargePackage are: + * - 1 - Oversize 1 + * - 2 - Oversize 2 + * - 4 - Large package + * + * + * @var string + */ protected $largePackage; /** * Package's tracking number. @@ -62,7 +64,9 @@ public function isInitialized($property): bool protected $trackingNumber; /** * Container tag for information about the package-level reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -81,7 +85,9 @@ public function isInitialized($property): bool protected $uPSPremiumCareIndicator; /** * Information about package delivery activity. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -126,11 +132,11 @@ public function setDescription(string $description): self return $this; } /** - * Container tag for package dimension information. - Length + 2 * (Width + Height) must be less than or equal to 130 IN or 330 CM. - * - * @return ManifestPackageDimensions - */ + * Container tag for package dimension information. + * Length + 2 * (Width + Height) must be less than or equal to 130 IN or 330 CM. + * + * @return ManifestPackageDimensions + */ public function getDimensions(): ManifestPackageDimensions { return $this->dimensions; @@ -194,14 +200,14 @@ public function setPackageWeight(ManifestPackagePackageWeight $packageWeight): s return $this; } /** - * Values for LargePackage are: - - 1 - Oversize 1 - - 2 - Oversize 2 - - 4 - Large package - - * - * @return string - */ + * Values for LargePackage are: + * - 1 - Oversize 1 + * - 2 - Oversize 2 + * - 4 - Large package + * + * + * @return string + */ public function getLargePackage(): string { return $this->largePackage; @@ -247,7 +253,9 @@ public function setTrackingNumber(string $trackingNumber): self } /** * Container tag for information about the package-level reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/ManifestPackageDimensions.php b/src/Api/Model/ManifestPackageDimensions.php index 5ecdb2de..f67a8ca5 100644 --- a/src/Api/Model/ManifestPackageDimensions.php +++ b/src/Api/Model/ManifestPackageDimensions.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Package length. - Valid values: 0 to 108 IN and 0 to 270 CM - * - * @var string - */ + * Package length. + * Valid values: 0 to 108 IN and 0 to 270 CM + * + * @var string + */ protected $length; /** * Package width. @@ -32,11 +32,11 @@ public function isInitialized($property): bool */ protected $height; /** - * Package length. - Valid values: 0 to 108 IN and 0 to 270 CM - * - * @return string - */ + * Package length. + * Valid values: 0 to 108 IN and 0 to 270 CM + * + * @return string + */ public function getLength(): string { return $this->length; diff --git a/src/Api/Model/ManifestPackagePackageServiceOptions.php b/src/Api/Model/ManifestPackagePackageServiceOptions.php index f1b1d1c7..175d7d02 100644 --- a/src/Api/Model/ManifestPackagePackageServiceOptions.php +++ b/src/Api/Model/ManifestPackagePackageServiceOptions.php @@ -31,15 +31,15 @@ public function isInitialized($property): bool */ protected $earliestDeliveryTime; /** - * Indicates if the package contains hazardous materials. Valid values: - - 1 - Hazardous Material - - 2 - Electronically billed hazardous material. - - If present, only one package may exist in the shipment. - - * - * @var string - */ + * Indicates if the package contains hazardous materials. Valid values: + * - 1 - Hazardous Material + * - 2 - Electronically billed hazardous material. + * + * If present, only one package may exist in the shipment. + * + * + * @var string + */ protected $hazardousMaterialsCode; /** * A flag indicating if a package should be held for pickup. True if tag exists, false otherwise. @@ -120,15 +120,15 @@ public function setEarliestDeliveryTime(string $earliestDeliveryTime): self return $this; } /** - * Indicates if the package contains hazardous materials. Valid values: - - 1 - Hazardous Material - - 2 - Electronically billed hazardous material. - - If present, only one package may exist in the shipment. - - * - * @return string - */ + * Indicates if the package contains hazardous materials. Valid values: + * - 1 - Hazardous Material + * - 2 - Electronically billed hazardous material. + * + * If present, only one package may exist in the shipment. + * + * + * @return string + */ public function getHazardousMaterialsCode(): string { return $this->hazardousMaterialsCode; diff --git a/src/Api/Model/ManifestPackageReferenceNumber.php b/src/Api/Model/ManifestPackageReferenceNumber.php index 53d8dce2..a25a3925 100644 --- a/src/Api/Model/ManifestPackageReferenceNumber.php +++ b/src/Api/Model/ManifestPackageReferenceNumber.php @@ -19,13 +19,13 @@ public function isInitialized($property): bool */ protected $number; /** - * Reference number type code for entire shipment, two-character alphanumeric. - The code specifies the Reference name. - Valid if the origin/destination pair is US/US or PR/PR. - For additional information, refer to the Reference Codes table in the Appendix. - * - * @var string - */ + * Reference number type code for entire shipment, two-character alphanumeric. + * The code specifies the Reference name. + * Valid if the origin/destination pair is US/US or PR/PR. + * For additional information, refer to the Reference Codes table in the Appendix. + * + * @var string + */ protected $code; /** * Customer supplied reference number, defined by the shipper and can contain any character string. Valid if the origin/destination pair is US/US or PR/PR. @@ -56,13 +56,13 @@ public function setNumber(string $number): self return $this; } /** - * Reference number type code for entire shipment, two-character alphanumeric. - The code specifies the Reference name. - Valid if the origin/destination pair is US/US or PR/PR. - For additional information, refer to the Reference Codes table in the Appendix. - * - * @return string - */ + * Reference number type code for entire shipment, two-character alphanumeric. + * The code specifies the Reference name. + * Valid if the origin/destination pair is US/US or PR/PR. + * For additional information, refer to the Reference Codes table in the Appendix. + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ManifestPackageServiceOptionsCOD.php b/src/Api/Model/ManifestPackageServiceOptionsCOD.php index d5c884f8..853e9ad0 100644 --- a/src/Api/Model/ManifestPackageServiceOptionsCOD.php +++ b/src/Api/Model/ManifestPackageServiceOptionsCOD.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The code associated with the type of COD. Valid values: - 1 - Regular COD - 2 - Express COD - 3 - Tagless COD - * - * @var string - */ + * The code associated with the type of COD. Valid values: + * 1 - Regular COD + * 2 - Express COD + * 3 - Tagless COD + * + * @var string + */ protected $cODCode; /** * COD Amount container. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $cODAmount; /** - * The code associated with the type of COD. Valid values: - 1 - Regular COD - 2 - Express COD - 3 - Tagless COD - * - * @return string - */ + * The code associated with the type of COD. Valid values: + * 1 - Regular COD + * 2 - Express COD + * 3 - Tagless COD + * + * @return string + */ public function getCODCode(): string { return $this->cODCode; diff --git a/src/Api/Model/ManifestShipToAddress.php b/src/Api/Model/ManifestShipToAddress.php index bb5b45fe..ff75a460 100644 --- a/src/Api/Model/ManifestShipToAddress.php +++ b/src/Api/Model/ManifestShipToAddress.php @@ -50,18 +50,19 @@ public function isInitialized($property): bool protected $stateProvinceCode; /** * Consignee's postal code. If the address is US then 5 or 9 digits are required. CA addresses must provide a 6 character postal code that has the format of A#A#A#, where A is a alphabetic character and # is numeric digit. Otherwise, 1 to 9 alphanumeric characters are allowed. + * * * @var string */ protected $postalCode; /** - * Consignee's country or territory code. - - Valid values: CA,MX, PR, US, AT, BE, DE, DK, ES, FI, FR, GB, IE, IT, NL, PT, SE, MC and VA - - * - * @var string - */ + * Consignee's country or territory code. + * + * Valid values: CA,MX, PR, US, AT, BE, DE, DK, ES, FI, FR, GB, IE, IT, NL, PT, SE, MC and VA + * + * + * @var string + */ protected $countryCode; /** * Consignee's name. @@ -197,6 +198,7 @@ public function setStateProvinceCode(string $stateProvinceCode): self } /** * Consignee's postal code. If the address is US then 5 or 9 digits are required. CA addresses must provide a 6 character postal code that has the format of A#A#A#, where A is a alphabetic character and # is numeric digit. Otherwise, 1 to 9 alphanumeric characters are allowed. + * * * @return string */ @@ -218,13 +220,13 @@ public function setPostalCode(string $postalCode): self return $this; } /** - * Consignee's country or territory code. - - Valid values: CA,MX, PR, US, AT, BE, DE, DK, ES, FI, FR, GB, IE, IT, NL, PT, SE, MC and VA - - * - * @return string - */ + * Consignee's country or territory code. + * + * Valid values: CA,MX, PR, US, AT, BE, DE, DK, ES, FI, FR, GB, IE, IT, NL, PT, SE, MC and VA + * + * + * @return string + */ public function getCountryCode(): string { return $this->countryCode; diff --git a/src/Api/Model/ManifestShipperAddress.php b/src/Api/Model/ManifestShipperAddress.php index 4e5d87dc..77455abe 100644 --- a/src/Api/Model/ManifestShipperAddress.php +++ b/src/Api/Model/ManifestShipperAddress.php @@ -44,18 +44,19 @@ public function isInitialized($property): bool protected $stateProvinceCode; /** * Shipper's postal code. If the address is US then 5 or 9 digits are required. CA addresses must provide a 6 character postal code that has the format of A#A#A#, where A is a alphabetic character and # is numeric digit. Otherwise, 1 to 9 alphanumeric characters are allowed. + * * * @var string */ protected $postalCode; /** - * Shipper's country or territory code. - - Valid values: CA,MX, PR, US, AT, BE, DE, DK, ES, FI, FR, GB, IE, IT, NL, PT, SE, MC and VA - - * - * @var string - */ + * Shipper's country or territory code. + * + * Valid values: CA,MX, PR, US, AT, BE, DE, DK, ES, FI, FR, GB, IE, IT, NL, PT, SE, MC and VA + * + * + * @var string + */ protected $countryCode; /** * If tag is present, then the address is residential address. Pickup location residential address indicator. The presence indicates residential address, the absence indicates a business address. @@ -175,6 +176,7 @@ public function setStateProvinceCode(string $stateProvinceCode): self } /** * Shipper's postal code. If the address is US then 5 or 9 digits are required. CA addresses must provide a 6 character postal code that has the format of A#A#A#, where A is a alphabetic character and # is numeric digit. Otherwise, 1 to 9 alphanumeric characters are allowed. + * * * @return string */ @@ -196,13 +198,13 @@ public function setPostalCode(string $postalCode): self return $this; } /** - * Shipper's country or territory code. - - Valid values: CA,MX, PR, US, AT, BE, DE, DK, ES, FI, FR, GB, IE, IT, NL, PT, SE, MC and VA - - * - * @return string - */ + * Shipper's country or territory code. + * + * Valid values: CA,MX, PR, US, AT, BE, DE, DK, ES, FI, FR, GB, IE, IT, NL, PT, SE, MC and VA + * + * + * @return string + */ public function getCountryCode(): string { return $this->countryCode; diff --git a/src/Api/Model/OperatingHoursStandardHours.php b/src/Api/Model/OperatingHoursStandardHours.php index f5ba4bd1..b1cab573 100644 --- a/src/Api/Model/OperatingHoursStandardHours.php +++ b/src/Api/Model/OperatingHoursStandardHours.php @@ -13,39 +13,41 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Hours Type. - - Valid values: - 10-Regular Operating Hours - 11-Will Call Hours - 12-Same Day Will Call Hours - 14-Customer PickUp - 50-Drop Off Hours - 51-Prep Hours - * - * @var string - */ + * Hours Type. + * + * Valid values: + * 10-Regular Operating Hours + * 11-Will Call Hours + * 12-Same Day Will Call Hours + * 14-Customer PickUp + * 50-Drop Off Hours + * 51-Prep Hours + * + * @var string + */ protected $hoursType; /** * Container for the Day of Week. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $dayOfWeek; /** - * Hours Type. - - Valid values: - 10-Regular Operating Hours - 11-Will Call Hours - 12-Same Day Will Call Hours - 14-Customer PickUp - 50-Drop Off Hours - 51-Prep Hours - * - * @return string - */ + * Hours Type. + * + * Valid values: + * 10-Regular Operating Hours + * 11-Will Call Hours + * 12-Same Day Will Call Hours + * 14-Customer PickUp + * 50-Drop Off Hours + * 51-Prep Hours + * + * @return string + */ public function getHoursType(): string { return $this->hoursType; @@ -73,7 +75,9 @@ public function setHoursType(string $hoursType): self } /** * Container for the Day of Week. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/OptionCodeTransportationPickUpSchedule.php b/src/Api/Model/OptionCodeTransportationPickUpSchedule.php index ab73039a..ef10c35f 100644 --- a/src/Api/Model/OptionCodeTransportationPickUpSchedule.php +++ b/src/Api/Model/OptionCodeTransportationPickUpSchedule.php @@ -14,14 +14,18 @@ public function isInitialized($property): bool } /** * PickUp container contains details of day of week and corresponding pickup times for that service. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $pickUp; /** * PickUp container contains details of day of week and corresponding pickup times for that service. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/OriginAddressAddressKeyFormat.php b/src/Api/Model/OriginAddressAddressKeyFormat.php index 94f2bf3a..24f17ffd 100644 --- a/src/Api/Model/OriginAddressAddressKeyFormat.php +++ b/src/Api/Model/OriginAddressAddressKeyFormat.php @@ -73,17 +73,17 @@ public function isInitialized($property): bool */ protected $countryCode; /** - * Single line search information. Can contain values of origin address in a single line. Will override other origin address information. - - Conditionally Required for Non-Postal Code Countries. Applicable Country Ireland (IE) - - SingleLineAddress used for the lookup - - SingleLineAddress (Format - CSV) (\"Values:\" + postalCode + city + state + address + landmark + phoneNumber) - - * - * @var string - */ + * Single line search information. Can contain values of origin address in a single line. Will override other origin address information. + * + * Conditionally Required for Non-Postal Code Countries. Applicable Country Ireland (IE) + * + * SingleLineAddress used for the lookup + * + * SingleLineAddress (Format - CSV) (\"Values:\" + postalCode + city + state + address + landmark + phoneNumber) + * + * + * @var string + */ protected $singleLineAddress; /** * Name. Not relevant for this tool @@ -306,17 +306,17 @@ public function setCountryCode(string $countryCode): self return $this; } /** - * Single line search information. Can contain values of origin address in a single line. Will override other origin address information. - - Conditionally Required for Non-Postal Code Countries. Applicable Country Ireland (IE) - - SingleLineAddress used for the lookup - - SingleLineAddress (Format - CSV) (\"Values:\" + postalCode + city + state + address + landmark + phoneNumber) - - * - * @return string - */ + * Single line search information. Can contain values of origin address in a single line. Will override other origin address information. + * + * Conditionally Required for Non-Postal Code Countries. Applicable Country Ireland (IE) + * + * SingleLineAddress used for the lookup + * + * SingleLineAddress (Format - CSV) (\"Values:\" + postalCode + city + state + address + landmark + phoneNumber) + * + * + * @return string + */ public function getSingleLineAddress(): string { return $this->singleLineAddress; diff --git a/src/Api/Model/OriginAddressOriginSearchCriteria.php b/src/Api/Model/OriginAddressOriginSearchCriteria.php index ba64da29..c9b01247 100644 --- a/src/Api/Model/OriginAddressOriginSearchCriteria.php +++ b/src/Api/Model/OriginAddressOriginSearchCriteria.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Search Request range. Valied values: - - 1 to 200 - - Default: 200 - * - * @var string - */ + * Search Request range. Valied values: + * - 1 to 200 + * + * Default: 200 + * + * @var string + */ protected $searchRadius; /** * Unit of Measure Required if ProximitySearchIndicator is present. Example: MI or KM @@ -28,22 +28,22 @@ public function isInitialized($property): bool */ protected $distanceUnitOfMeasure; /** - * Maximum Number of locations. Valied values: - - 1 to 100 - - Default: 100 - * - * @var string - */ + * Maximum Number of locations. Valied values: + * - 1 to 100 + * + * Default: 100 + * + * @var string + */ protected $maximumLocation; /** - * Search Request range. Valied values: - - 1 to 200 - - Default: 200 - * - * @return string - */ + * Search Request range. Valied values: + * - 1 to 200 + * + * Default: 200 + * + * @return string + */ public function getSearchRadius(): string { return $this->searchRadius; @@ -87,13 +87,13 @@ public function setDistanceUnitOfMeasure(string $distanceUnitOfMeasure): self return $this; } /** - * Maximum Number of locations. Valied values: - - 1 to 100 - - Default: 100 - * - * @return string - */ + * Maximum Number of locations. Valied values: + * - 1 to 100 + * + * Default: 100 + * + * @return string + */ public function getMaximumLocation(): string { return $this->maximumLocation; diff --git a/src/Api/Model/OriginBillToAccount.php b/src/Api/Model/OriginBillToAccount.php index 83cbc405..8770af41 100644 --- a/src/Api/Model/OriginBillToAccount.php +++ b/src/Api/Model/OriginBillToAccount.php @@ -13,15 +13,15 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Indicates how shipping charges for the package were billed. Valid Values: - - 01 - Shipper - - 02 - Consignee Billing - - 03 - Third Party - - 04 - Freight Collect - - * - * @var string - */ + * Indicates how shipping charges for the package were billed. Valid Values: + * - 01 - Shipper + * - 02 - Consignee Billing + * - 03 - Third Party + * - 04 - Freight Collect + * + * + * @var string + */ protected $option; /** * The UPS Account number to which the shipping charges were billed. @@ -30,15 +30,15 @@ public function isInitialized($property): bool */ protected $number; /** - * Indicates how shipping charges for the package were billed. Valid Values: - - 01 - Shipper - - 02 - Consignee Billing - - 03 - Third Party - - 04 - Freight Collect - - * - * @return string - */ + * Indicates how shipping charges for the package were billed. Valid Values: + * - 01 - Shipper + * - 02 - Consignee Billing + * - 03 - Third Party + * - 04 - Freight Collect + * + * + * @return string + */ public function getOption(): string { return $this->option; diff --git a/src/Api/Model/OriginPackageReferenceNumber.php b/src/Api/Model/OriginPackageReferenceNumber.php index 8b73eaac..a7d00e71 100644 --- a/src/Api/Model/OriginPackageReferenceNumber.php +++ b/src/Api/Model/OriginPackageReferenceNumber.php @@ -25,13 +25,13 @@ public function isInitialized($property): bool */ protected $number; /** - * Reflects what will go on the label as the name of the reference. - - For additional information, refer to the Reference Codes table in the Appendix. - - * - * @var string - */ + * Reflects what will go on the label as the name of the reference. + * + * For additional information, refer to the Reference Codes table in the Appendix. + * + * + * @var string + */ protected $code; /** * Customer supplied reference number. Reference numbers are defined by the shipper and can contain any character string. @@ -84,13 +84,13 @@ public function setNumber(string $number): self return $this; } /** - * Reflects what will go on the label as the name of the reference. - - For additional information, refer to the Reference Codes table in the Appendix. - - * - * @return string - */ + * Reflects what will go on the label as the name of the reference. + * + * For additional information, refer to the Reference Codes table in the Appendix. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/OriginShipmentReferenceNumber.php b/src/Api/Model/OriginShipmentReferenceNumber.php index 656a5aa9..e3dd9b82 100644 --- a/src/Api/Model/OriginShipmentReferenceNumber.php +++ b/src/Api/Model/OriginShipmentReferenceNumber.php @@ -25,13 +25,13 @@ public function isInitialized($property): bool */ protected $number; /** - * Reflects what will go on the label as the name of the reference. - - For additional information, refer to the Reference Codes table in the Appendix. - - * - * @var string - */ + * Reflects what will go on the label as the name of the reference. + * + * For additional information, refer to the Reference Codes table in the Appendix. + * + * + * @var string + */ protected $code; /** * Customer supplied reference number. Reference numbers are defined by the shipper and can contain any character string. @@ -84,13 +84,13 @@ public function setNumber(string $number): self return $this; } /** - * Reflects what will go on the label as the name of the reference. - - For additional information, refer to the Reference Codes table in the Appendix. - - * - * @return string - */ + * Reflects what will go on the label as the name of the reference. + * + * For additional information, refer to the Reference Codes table in the Appendix. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/OverSeasLegDimensions.php b/src/Api/Model/OverSeasLegDimensions.php index 53d71bde..298cb56a 100644 --- a/src/Api/Model/OverSeasLegDimensions.php +++ b/src/Api/Model/OverSeasLegDimensions.php @@ -13,21 +13,21 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Represents the size as volume. - - Volume being required if height, length, width is not specified. - If volume is present then height, length, width is ignored. - - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @var string - */ + * Represents the size as volume. + * + * Volume being required if height, length, width is not specified. + * If volume is present then height, length, width is ignored. + * + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @var string + */ protected $volume; /** * The height of the line item used to determine density based rating. @@ -54,21 +54,21 @@ public function isInitialized($property): bool */ protected $unitOfMeasurement; /** - * Represents the size as volume. - - Volume being required if height, length, width is not specified. - If volume is present then height, length, width is ignored. - - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @return string - */ + * Represents the size as volume. + * + * Volume being required if height, length, width is not specified. + * If volume is present then height, length, width is ignored. + * + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @return string + */ public function getVolume(): string { return $this->volume; diff --git a/src/Api/Model/OverSeasLegValue.php b/src/Api/Model/OverSeasLegValue.php index 0bf4523d..a0497f85 100644 --- a/src/Api/Model/OverSeasLegValue.php +++ b/src/Api/Model/OverSeasLegValue.php @@ -13,25 +13,25 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Dimensions Value Cube Container. - Request should contain PricerPerCubicFoot, PricerPerCWT, or both. - * - * @var ValueCube - */ + * Dimensions Value Cube Container. + * Request should contain PricerPerCubicFoot, PricerPerCWT, or both. + * + * @var ValueCube + */ protected $cube; /** - * Dimensions Value CWT Container. - Request should contain PricerPerCubicFoot, PricerPerCWT, or both. - * - * @var ValueCWT - */ + * Dimensions Value CWT Container. + * Request should contain PricerPerCubicFoot, PricerPerCWT, or both. + * + * @var ValueCWT + */ protected $cWT; /** - * Dimensions Value Cube Container. - Request should contain PricerPerCubicFoot, PricerPerCWT, or both. - * - * @return ValueCube - */ + * Dimensions Value Cube Container. + * Request should contain PricerPerCubicFoot, PricerPerCWT, or both. + * + * @return ValueCube + */ public function getCube(): ValueCube { return $this->cube; @@ -51,11 +51,11 @@ public function setCube(ValueCube $cube): self return $this; } /** - * Dimensions Value CWT Container. - Request should contain PricerPerCubicFoot, PricerPerCWT, or both. - * - * @return ValueCWT - */ + * Dimensions Value CWT Container. + * Request should contain PricerPerCubicFoot, PricerPerCWT, or both. + * + * @return ValueCWT + */ public function getCWT(): ValueCWT { return $this->cWT; diff --git a/src/Api/Model/POMPickupNotifications.php b/src/Api/Model/POMPickupNotifications.php index 93a815b3..3486508f 100644 --- a/src/Api/Model/POMPickupNotifications.php +++ b/src/Api/Model/POMPickupNotifications.php @@ -19,8 +19,6 @@ public function isInitialized($property): bool */ protected $companyName; /** - * - * * @var list */ protected $eMailNotification; @@ -53,8 +51,6 @@ public function setCompanyName(string $companyName): self return $this; } /** - * - * * @return list */ public function getEMailNotification(): array @@ -62,8 +58,6 @@ public function getEMailNotification(): array return $this->eMailNotification; } /** - * - * * @param list $eMailNotification * * @return self diff --git a/src/Api/Model/Package.php b/src/Api/Model/Package.php index 32331328..b1592ffd 100644 --- a/src/Api/Model/Package.php +++ b/src/Api/Model/Package.php @@ -19,8 +19,6 @@ public function isInitialized($property): bool */ protected $accessPointInformation; /** - * - * * @var list */ protected $activity; @@ -37,8 +35,6 @@ public function isInitialized($property): bool */ protected $additionalServices; /** - * - * * @var list */ protected $alternateTrackingNumber; @@ -49,8 +45,6 @@ public function isInitialized($property): bool */ protected $currentStatus; /** - * - * * @var list */ protected $deliveryDate; @@ -73,8 +67,6 @@ public function isInitialized($property): bool */ protected $milestones; /** - * - * * @var list */ protected $packageAddress; @@ -85,14 +77,10 @@ public function isInitialized($property): bool */ protected $packageCount; /** - * - * * @var list */ protected $paymentInformation; /** - * - * * @var list */ protected $referenceNumber; @@ -103,8 +91,6 @@ public function isInitialized($property): bool */ protected $service; /** - * - * * @var string */ protected $statusCode; @@ -121,8 +107,6 @@ public function isInitialized($property): bool */ protected $suppressionIndicators; /** - * - * * @var string */ protected $trackingNumber; @@ -155,8 +139,6 @@ public function setAccessPointInformation(AccessPointInformation $accessPointInf return $this; } /** - * - * * @return list */ public function getActivity(): array @@ -164,8 +146,6 @@ public function getActivity(): array return $this->activity; } /** - * - * * @param list $activity * * @return self @@ -221,8 +201,6 @@ public function setAdditionalServices(array $additionalServices): self return $this; } /** - * - * * @return list */ public function getAlternateTrackingNumber(): array @@ -230,8 +208,6 @@ public function getAlternateTrackingNumber(): array return $this->alternateTrackingNumber; } /** - * - * * @param list $alternateTrackingNumber * * @return self @@ -265,8 +241,6 @@ public function setCurrentStatus(Status $currentStatus): self return $this; } /** - * - * * @return list */ public function getDeliveryDate(): array @@ -274,8 +248,6 @@ public function getDeliveryDate(): array return $this->deliveryDate; } /** - * - * * @param list $deliveryDate * * @return self @@ -353,8 +325,6 @@ public function setMilestones(array $milestones): self return $this; } /** - * - * * @return list */ public function getPackageAddress(): array @@ -362,8 +332,6 @@ public function getPackageAddress(): array return $this->packageAddress; } /** - * - * * @param list $packageAddress * * @return self @@ -397,8 +365,6 @@ public function setPackageCount(int $packageCount): self return $this; } /** - * - * * @return list */ public function getPaymentInformation(): array @@ -406,8 +372,6 @@ public function getPaymentInformation(): array return $this->paymentInformation; } /** - * - * * @param list $paymentInformation * * @return self @@ -419,8 +383,6 @@ public function setPaymentInformation(array $paymentInformation): self return $this; } /** - * - * * @return list */ public function getReferenceNumber(): array @@ -428,8 +390,6 @@ public function getReferenceNumber(): array return $this->referenceNumber; } /** - * - * * @param list $referenceNumber * * @return self @@ -463,8 +423,6 @@ public function setService(Service $service): self return $this; } /** - * - * * @return string */ public function getStatusCode(): string @@ -472,8 +430,6 @@ public function getStatusCode(): string return $this->statusCode; } /** - * - * * @param string $statusCode * * @return self @@ -529,8 +485,6 @@ public function setSuppressionIndicators(array $suppressionIndicators): self return $this; } /** - * - * * @return string */ public function getTrackingNumber(): string @@ -538,8 +492,6 @@ public function getTrackingNumber(): string return $this->trackingNumber; } /** - * - * * @param string $trackingNumber * * @return self diff --git a/src/Api/Model/PackageChemicalRecord.php b/src/Api/Model/PackageChemicalRecord.php index 44f12650..bdd10900 100644 --- a/src/Api/Model/PackageChemicalRecord.php +++ b/src/Api/Model/PackageChemicalRecord.php @@ -25,43 +25,43 @@ public function isInitialized($property): bool */ protected $reportableQuantity; /** - * This is the hazard class associated to the specified commodity. - - Required if CommodityRegulatedLevelCode is 'LQ' or 'FR' - - * - * @var string - */ + * This is the hazard class associated to the specified commodity. + * + * Required if CommodityRegulatedLevelCode is 'LQ' or 'FR' + * + * + * @var string + */ protected $classDivisionNumber; /** - * Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. - - Secondary hazardous characteristics of a package. (There can be more than one – separate each with a comma). - - * - * @var string - */ + * Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. + * + * Secondary hazardous characteristics of a package. (There can be more than one – separate each with a comma). + * + * + * @var string + */ protected $subRiskClass; /** - * This is the ID number (UN/NA/ID) for the specified commodity. - - Required if CommodityRegulatedLevelCode = LR, LQ or FR and if the field applies to the material by regulation. - - UN/NA/ID Identification Number assigned to the specified regulated good. (Include the UN/NA/ID as part of the entry). - * - * @var string - */ + * This is the ID number (UN/NA/ID) for the specified commodity. + * + * Required if CommodityRegulatedLevelCode = LR, LQ or FR and if the field applies to the material by regulation. + * + * UN/NA/ID Identification Number assigned to the specified regulated good. (Include the UN/NA/ID as part of the entry). + * + * @var string + */ protected $iDNumber; /** - * This is the packing group category associated to the specified commodity. - Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. Must be shown in Roman Numerals. Valid values are: - I - II - III - blank - * - * @var string - */ + * This is the packing group category associated to the specified commodity. + * Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. Must be shown in Roman Numerals. Valid values are: + * I + * II + * III + * blank + * + * @var string + */ protected $packagingGroupType; /** * Required if CommodityRegulatedLevelCode = LQ or FR. The numerical value of the mass capacity of the regulated good. @@ -70,11 +70,11 @@ public function isInitialized($property): bool */ protected $quantity; /** - * Required if CommodityRegulatedLevelCode = LQ or FR. The unit of measure used for the mass capacity of the regulated good. - Example: ml, L, g, mg, kg, cylinder, pound, pint, quart, gallon, ounce etc. - * - * @var string - */ + * Required if CommodityRegulatedLevelCode = LQ or FR. The unit of measure used for the mass capacity of the regulated good. + * Example: ml, L, g, mg, kg, cylinder, pound, pint, quart, gallon, ounce etc. + * + * @var string + */ protected $uOM; /** * The packing instructions related to the chemical record. Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. @@ -83,63 +83,63 @@ public function isInitialized($property): bool */ protected $packagingInstructionCode; /** - * The Proper Shipping Name assigned by ADR, CFR or IATA. - - Required if CommodityRegulatedLevelCode = LR, LQ or FR. - * - * @var string - */ + * The Proper Shipping Name assigned by ADR, CFR or IATA. + * + * Required if CommodityRegulatedLevelCode = LR, LQ or FR. + * + * @var string + */ protected $properShippingName; /** - * The technical name (when required) for the specified commodity. - - Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. - * - * @var string - */ + * The technical name (when required) for the specified commodity. + * + * Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. + * + * @var string + */ protected $technicalName; /** - * Additional remarks or special provision information. Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. - - Additional information that may be required by regulation about a hazardous material, such as, “Limited Quantity”, DOT-SP numbers, EX numbers. - - * - * @var string - */ + * Additional remarks or special provision information. Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. + * + * Additional information that may be required by regulation about a hazardous material, such as, “Limited Quantity”, DOT-SP numbers, EX numbers. + * + * + * @var string + */ protected $additionalDescription; /** - * The package type code identifying the type of packaging used for the commodity. (Ex: Fiberboard Box). - Required if CommodityRegulatedLevelCode = LQ or FR. - * - * @var string - */ + * The package type code identifying the type of packaging used for the commodity. (Ex: Fiberboard Box). + * Required if CommodityRegulatedLevelCode = LQ or FR. + * + * @var string + */ protected $packagingType; /** - * Defines the type of label that is required on the package for the commodity. - - Not applicable if CommodityRegulatedLevelCode = LR or EQ. - * - * @var string - */ + * Defines the type of label that is required on the package for the commodity. + * + * Not applicable if CommodityRegulatedLevelCode = LR or EQ. + * + * @var string + */ protected $hazardLabelRequired; /** - * The number of pieces of the specific commodity. - - Required if CommodityRegulatedLevelCode = LQ or FR. Valid values: 1 to 999 - * - * @var string - */ + * The number of pieces of the specific commodity. + * + * Required if CommodityRegulatedLevelCode = LQ or FR. Valid values: 1 to 999 + * + * @var string + */ protected $packagingTypeQuantity; /** - * Indicates the type of commodity. Valid values: LR, FR, LQ, EQ - - FR = Fully Regulated - LQ = Limited Quantity - EQ = Excepted Quantity - LR = Lightly Regulated - * - * @var string - */ + * Indicates the type of commodity. Valid values: LR, FR, LQ, EQ + * + * FR = Fully Regulated + * LQ = Limited Quantity + * EQ = Excepted Quantity + * LR = Lightly Regulated + * + * @var string + */ protected $commodityRegulatedLevelCode; /** * Transport Category. Valid values: 0 to 4 @@ -204,13 +204,13 @@ public function setReportableQuantity(string $reportableQuantity): self return $this; } /** - * This is the hazard class associated to the specified commodity. - - Required if CommodityRegulatedLevelCode is 'LQ' or 'FR' - - * - * @return string - */ + * This is the hazard class associated to the specified commodity. + * + * Required if CommodityRegulatedLevelCode is 'LQ' or 'FR' + * + * + * @return string + */ public function getClassDivisionNumber(): string { return $this->classDivisionNumber; @@ -232,13 +232,13 @@ public function setClassDivisionNumber(string $classDivisionNumber): self return $this; } /** - * Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. - - Secondary hazardous characteristics of a package. (There can be more than one – separate each with a comma). - - * - * @return string - */ + * Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. + * + * Secondary hazardous characteristics of a package. (There can be more than one – separate each with a comma). + * + * + * @return string + */ public function getSubRiskClass(): string { return $this->subRiskClass; @@ -260,14 +260,14 @@ public function setSubRiskClass(string $subRiskClass): self return $this; } /** - * This is the ID number (UN/NA/ID) for the specified commodity. - - Required if CommodityRegulatedLevelCode = LR, LQ or FR and if the field applies to the material by regulation. - - UN/NA/ID Identification Number assigned to the specified regulated good. (Include the UN/NA/ID as part of the entry). - * - * @return string - */ + * This is the ID number (UN/NA/ID) for the specified commodity. + * + * Required if CommodityRegulatedLevelCode = LR, LQ or FR and if the field applies to the material by regulation. + * + * UN/NA/ID Identification Number assigned to the specified regulated good. (Include the UN/NA/ID as part of the entry). + * + * @return string + */ public function getIDNumber(): string { return $this->iDNumber; @@ -290,15 +290,15 @@ public function setIDNumber(string $iDNumber): self return $this; } /** - * This is the packing group category associated to the specified commodity. - Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. Must be shown in Roman Numerals. Valid values are: - I - II - III - blank - * - * @return string - */ + * This is the packing group category associated to the specified commodity. + * Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. Must be shown in Roman Numerals. Valid values are: + * I + * II + * III + * blank + * + * @return string + */ public function getPackagingGroupType(): string { return $this->packagingGroupType; @@ -344,11 +344,11 @@ public function setQuantity(string $quantity): self return $this; } /** - * Required if CommodityRegulatedLevelCode = LQ or FR. The unit of measure used for the mass capacity of the regulated good. - Example: ml, L, g, mg, kg, cylinder, pound, pint, quart, gallon, ounce etc. - * - * @return string - */ + * Required if CommodityRegulatedLevelCode = LQ or FR. The unit of measure used for the mass capacity of the regulated good. + * Example: ml, L, g, mg, kg, cylinder, pound, pint, quart, gallon, ounce etc. + * + * @return string + */ public function getUOM(): string { return $this->uOM; @@ -390,12 +390,12 @@ public function setPackagingInstructionCode(string $packagingInstructionCode): s return $this; } /** - * The Proper Shipping Name assigned by ADR, CFR or IATA. - - Required if CommodityRegulatedLevelCode = LR, LQ or FR. - * - * @return string - */ + * The Proper Shipping Name assigned by ADR, CFR or IATA. + * + * Required if CommodityRegulatedLevelCode = LR, LQ or FR. + * + * @return string + */ public function getProperShippingName(): string { return $this->properShippingName; @@ -416,12 +416,12 @@ public function setProperShippingName(string $properShippingName): self return $this; } /** - * The technical name (when required) for the specified commodity. - - Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. - * - * @return string - */ + * The technical name (when required) for the specified commodity. + * + * Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. + * + * @return string + */ public function getTechnicalName(): string { return $this->technicalName; @@ -442,13 +442,13 @@ public function setTechnicalName(string $technicalName): self return $this; } /** - * Additional remarks or special provision information. Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. - - Additional information that may be required by regulation about a hazardous material, such as, “Limited Quantity”, DOT-SP numbers, EX numbers. - - * - * @return string - */ + * Additional remarks or special provision information. Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. + * + * Additional information that may be required by regulation about a hazardous material, such as, “Limited Quantity”, DOT-SP numbers, EX numbers. + * + * + * @return string + */ public function getAdditionalDescription(): string { return $this->additionalDescription; @@ -470,11 +470,11 @@ public function setAdditionalDescription(string $additionalDescription): self return $this; } /** - * The package type code identifying the type of packaging used for the commodity. (Ex: Fiberboard Box). - Required if CommodityRegulatedLevelCode = LQ or FR. - * - * @return string - */ + * The package type code identifying the type of packaging used for the commodity. (Ex: Fiberboard Box). + * Required if CommodityRegulatedLevelCode = LQ or FR. + * + * @return string + */ public function getPackagingType(): string { return $this->packagingType; @@ -494,12 +494,12 @@ public function setPackagingType(string $packagingType): self return $this; } /** - * Defines the type of label that is required on the package for the commodity. - - Not applicable if CommodityRegulatedLevelCode = LR or EQ. - * - * @return string - */ + * Defines the type of label that is required on the package for the commodity. + * + * Not applicable if CommodityRegulatedLevelCode = LR or EQ. + * + * @return string + */ public function getHazardLabelRequired(): string { return $this->hazardLabelRequired; @@ -520,12 +520,12 @@ public function setHazardLabelRequired(string $hazardLabelRequired): self return $this; } /** - * The number of pieces of the specific commodity. - - Required if CommodityRegulatedLevelCode = LQ or FR. Valid values: 1 to 999 - * - * @return string - */ + * The number of pieces of the specific commodity. + * + * Required if CommodityRegulatedLevelCode = LQ or FR. Valid values: 1 to 999 + * + * @return string + */ public function getPackagingTypeQuantity(): string { return $this->packagingTypeQuantity; @@ -546,15 +546,15 @@ public function setPackagingTypeQuantity(string $packagingTypeQuantity): self return $this; } /** - * Indicates the type of commodity. Valid values: LR, FR, LQ, EQ - - FR = Fully Regulated - LQ = Limited Quantity - EQ = Excepted Quantity - LR = Lightly Regulated - * - * @return string - */ + * Indicates the type of commodity. Valid values: LR, FR, LQ, EQ + * + * FR = Fully Regulated + * LQ = Limited Quantity + * EQ = Excepted Quantity + * LR = Lightly Regulated + * + * @return string + */ public function getCommodityRegulatedLevelCode(): string { return $this->commodityRegulatedLevelCode; diff --git a/src/Api/Model/PackagePackageServiceOptions.php b/src/Api/Model/PackagePackageServiceOptions.php index 4293efba..116f213c 100644 --- a/src/Api/Model/PackagePackageServiceOptions.php +++ b/src/Api/Model/PackagePackageServiceOptions.php @@ -13,12 +13,12 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Delivery Confirmation container. - Refer to Delivery Confirmation Origin- - Destination Pairs in the Appendix for a list of valid values. Valid only for forward shipment only. - * - * @var PackageServiceOptionsDeliveryConfirmation - */ + * Delivery Confirmation container. + * Refer to Delivery Confirmation Origin- + * Destination Pairs in the Appendix for a list of valid values. Valid only for forward shipment only. + * + * @var PackageServiceOptionsDeliveryConfirmation + */ protected $deliveryConfirmation; /** * Container for Declared Value. @@ -51,8 +51,6 @@ public function isInitialized($property): bool */ protected $notification; /** - * - * * @var list */ protected $hazMat; @@ -63,27 +61,27 @@ public function isInitialized($property): bool */ protected $dryIce; /** - * An UPSPremiumCareIndicator indicates special handling is required for shipment having controlled substances. Empty Tag means indicator is present. - - The UPSPremiumCareIndicator cannot be requested for package with Delivery Confirmation - Adult Signature Required and Delivery Confirmation- Signature Required. - - UPSPremiumCareIndicator is valid for following Return services: - - Returns Exchange (available with a contract) - - Print Return Label - - Print and Mail - - Electronic Return Label - - Return Service Three Attempt - - The UPSPremiumCareIndicator can be requested with following UPS services: - - UPS Express® Early - - UPS Express - - UPS Express Saver - - UPS Standard - - Valid only for Canada to Canada movements. - - * - * @var string - */ + * An UPSPremiumCareIndicator indicates special handling is required for shipment having controlled substances. Empty Tag means indicator is present. + * + * The UPSPremiumCareIndicator cannot be requested for package with Delivery Confirmation - Adult Signature Required and Delivery Confirmation- Signature Required. + * + * UPSPremiumCareIndicator is valid for following Return services: + * - Returns Exchange (available with a contract) + * - Print Return Label + * - Print and Mail + * - Electronic Return Label + * - Return Service Three Attempt + * + * The UPSPremiumCareIndicator can be requested with following UPS services: + * - UPS Express® Early + * - UPS Express + * - UPS Express Saver + * - UPS Standard + * - Valid only for Canada to Canada movements. + * + * + * @var string + */ protected $uPSPremiumCareIndicator; /** * Presence/Absence Indicator. Any value is ignored. If present, the package is rated for UPS Proactive Response and proactive package tracking. Contractual accessorial for health care companies to allow package monitoring throughout the UPS system. Shippers account needs to have valid contract for UPS Proactive Reponse. @@ -110,12 +108,12 @@ public function isInitialized($property): bool */ protected $refrigerationIndicator; /** - * Delivery Confirmation container. - Refer to Delivery Confirmation Origin- - Destination Pairs in the Appendix for a list of valid values. Valid only for forward shipment only. - * - * @return PackageServiceOptionsDeliveryConfirmation - */ + * Delivery Confirmation container. + * Refer to Delivery Confirmation Origin- + * Destination Pairs in the Appendix for a list of valid values. Valid only for forward shipment only. + * + * @return PackageServiceOptionsDeliveryConfirmation + */ public function getDeliveryConfirmation(): PackageServiceOptionsDeliveryConfirmation { return $this->deliveryConfirmation; @@ -246,8 +244,6 @@ public function setNotification(PackageServiceOptionsNotification $notification) return $this; } /** - * - * * @return list */ public function getHazMat(): array @@ -255,8 +251,6 @@ public function getHazMat(): array return $this->hazMat; } /** - * - * * @param list $hazMat * * @return self @@ -290,27 +284,27 @@ public function setDryIce(PackageServiceOptionsDryIce $dryIce): self return $this; } /** - * An UPSPremiumCareIndicator indicates special handling is required for shipment having controlled substances. Empty Tag means indicator is present. - - The UPSPremiumCareIndicator cannot be requested for package with Delivery Confirmation - Adult Signature Required and Delivery Confirmation- Signature Required. - - UPSPremiumCareIndicator is valid for following Return services: - - Returns Exchange (available with a contract) - - Print Return Label - - Print and Mail - - Electronic Return Label - - Return Service Three Attempt - - The UPSPremiumCareIndicator can be requested with following UPS services: - - UPS Express® Early - - UPS Express - - UPS Express Saver - - UPS Standard - - Valid only for Canada to Canada movements. - - * - * @return string - */ + * An UPSPremiumCareIndicator indicates special handling is required for shipment having controlled substances. Empty Tag means indicator is present. + * + * The UPSPremiumCareIndicator cannot be requested for package with Delivery Confirmation - Adult Signature Required and Delivery Confirmation- Signature Required. + * + * UPSPremiumCareIndicator is valid for following Return services: + * - Returns Exchange (available with a contract) + * - Print Return Label + * - Print and Mail + * - Electronic Return Label + * - Return Service Three Attempt + * + * The UPSPremiumCareIndicator can be requested with following UPS services: + * - UPS Express® Early + * - UPS Express + * - UPS Express Saver + * - UPS Standard + * - Valid only for Canada to Canada movements. + * + * + * @return string + */ public function getUPSPremiumCareIndicator(): string { return $this->uPSPremiumCareIndicator; diff --git a/src/Api/Model/PackagePackaging.php b/src/Api/Model/PackagePackaging.php index 69a96d33..d2ed2708 100644 --- a/src/Api/Model/PackagePackaging.php +++ b/src/Api/Model/PackagePackaging.php @@ -13,35 +13,35 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Package types. Values are: - 01 = UPS Letter - 02 = Customer Supplied Package - 03 = Tube - 04 = PAK - 21 = UPS Express Box - 24 = UPS 25KG Box - 25 = UPS 10KG Box - 30 = Pallet - 2a = Small Express Box - 2b = Medium Express Box - 2c = Large Express Box - 56 = Flats - 57 = Parcels - 58 = BPM - 59 = First Class - 60 = Priority - 61 = Machineables - 62 = Irregulars - 63 = Parcel Post - 64 = BPM Parcel - 65 = Media Mail - 66 = BPM Flat - 67 = Standard Flat. - Note: Only packaging type code 02 is applicable to Ground Freight Pricing. - Package type 24, or 25 is only allowed for shipment without return service. Packaging type must be valid for all the following: ShipTo country or territory, ShipFrom country or territory, a shipment going from ShipTo country or territory to ShipFrom country or territory, all Accessorials at both the shipment and package level, and the shipment service type. UPS will not accept raw wood pallets and please refer the UPS packaging guidelines for pallets on UPS.com. - * - * @var string - */ + * Package types. Values are: + * 01 = UPS Letter + * 02 = Customer Supplied Package + * 03 = Tube + * 04 = PAK + * 21 = UPS Express Box + * 24 = UPS 25KG Box + * 25 = UPS 10KG Box + * 30 = Pallet + * 2a = Small Express Box + * 2b = Medium Express Box + * 2c = Large Express Box + * 56 = Flats + * 57 = Parcels + * 58 = BPM + * 59 = First Class + * 60 = Priority + * 61 = Machineables + * 62 = Irregulars + * 63 = Parcel Post + * 64 = BPM Parcel + * 65 = Media Mail + * 66 = BPM Flat + * 67 = Standard Flat. + * Note: Only packaging type code 02 is applicable to Ground Freight Pricing. + * Package type 24, or 25 is only allowed for shipment without return service. Packaging type must be valid for all the following: ShipTo country or territory, ShipFrom country or territory, a shipment going from ShipTo country or territory to ShipFrom country or territory, all Accessorials at both the shipment and package level, and the shipment service type. UPS will not accept raw wood pallets and please refer the UPS packaging guidelines for pallets on UPS.com. + * + * @var string + */ protected $code; /** * Description of packaging type. Examples are letter, customer supplied, express box. @@ -50,35 +50,35 @@ public function isInitialized($property): bool */ protected $description; /** - * Package types. Values are: - 01 = UPS Letter - 02 = Customer Supplied Package - 03 = Tube - 04 = PAK - 21 = UPS Express Box - 24 = UPS 25KG Box - 25 = UPS 10KG Box - 30 = Pallet - 2a = Small Express Box - 2b = Medium Express Box - 2c = Large Express Box - 56 = Flats - 57 = Parcels - 58 = BPM - 59 = First Class - 60 = Priority - 61 = Machineables - 62 = Irregulars - 63 = Parcel Post - 64 = BPM Parcel - 65 = Media Mail - 66 = BPM Flat - 67 = Standard Flat. - Note: Only packaging type code 02 is applicable to Ground Freight Pricing. - Package type 24, or 25 is only allowed for shipment without return service. Packaging type must be valid for all the following: ShipTo country or territory, ShipFrom country or territory, a shipment going from ShipTo country or territory to ShipFrom country or territory, all Accessorials at both the shipment and package level, and the shipment service type. UPS will not accept raw wood pallets and please refer the UPS packaging guidelines for pallets on UPS.com. - * - * @return string - */ + * Package types. Values are: + * 01 = UPS Letter + * 02 = Customer Supplied Package + * 03 = Tube + * 04 = PAK + * 21 = UPS Express Box + * 24 = UPS 25KG Box + * 25 = UPS 10KG Box + * 30 = Pallet + * 2a = Small Express Box + * 2b = Medium Express Box + * 2c = Large Express Box + * 56 = Flats + * 57 = Parcels + * 58 = BPM + * 59 = First Class + * 60 = Priority + * 61 = Machineables + * 62 = Irregulars + * 63 = Parcel Post + * 64 = BPM Parcel + * 65 = Media Mail + * 66 = BPM Flat + * 67 = Standard Flat. + * Note: Only packaging type code 02 is applicable to Ground Freight Pricing. + * Package type 24, or 25 is only allowed for shipment without return service. Packaging type must be valid for all the following: ShipTo country or territory, ShipFrom country or territory, a shipment going from ShipTo country or territory to ShipFrom country or territory, all Accessorials at both the shipment and package level, and the shipment service type. UPS will not accept raw wood pallets and please refer the UPS packaging guidelines for pallets on UPS.com. + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/PackagePackagingType.php b/src/Api/Model/PackagePackagingType.php index 9f2db10a..1978808c 100644 --- a/src/Api/Model/PackagePackagingType.php +++ b/src/Api/Model/PackagePackagingType.php @@ -13,25 +13,25 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The code for the UPS packaging type associated with the package. Valid values: - - 00 - UNKNOWN - - 01 - UPS Letter - - 02 - Package - - 03 - Tube - - 04 - Pak - - 21 - Express Box - - 24 - 25KG Box - - 25 - 10KG Box - - 30 - Pallet - - 2a - Small Express Box - - 2b - Medium Express Box - - 2c - Large Express Box. - - For FRS rating requests the only valid value is customer supplied packaging “02”. - - * - * @var string - */ + * The code for the UPS packaging type associated with the package. Valid values: + * - 00 - UNKNOWN + * - 01 - UPS Letter + * - 02 - Package + * - 03 - Tube + * - 04 - Pak + * - 21 - Express Box + * - 24 - 25KG Box + * - 25 - 10KG Box + * - 30 - Pallet + * - 2a - Small Express Box + * - 2b - Medium Express Box + * - 2c - Large Express Box. + * + * For FRS rating requests the only valid value is customer supplied packaging “02”. + * + * + * @var string + */ protected $code; /** * A text description of the code for the UPS packaging type associated with the shipment. Length is not validated. @@ -40,25 +40,25 @@ public function isInitialized($property): bool */ protected $description; /** - * The code for the UPS packaging type associated with the package. Valid values: - - 00 - UNKNOWN - - 01 - UPS Letter - - 02 - Package - - 03 - Tube - - 04 - Pak - - 21 - Express Box - - 24 - 25KG Box - - 25 - 10KG Box - - 30 - Pallet - - 2a - Small Express Box - - 2b - Medium Express Box - - 2c - Large Express Box. - - For FRS rating requests the only valid value is customer supplied packaging “02”. - - * - * @return string - */ + * The code for the UPS packaging type associated with the package. Valid values: + * - 00 - UNKNOWN + * - 01 - UPS Letter + * - 02 - Package + * - 03 - Tube + * - 04 - Pak + * - 21 - Express Box + * - 24 - 25KG Box + * - 25 - 10KG Box + * - 30 - Pallet + * - 2a - Small Express Box + * - 2b - Medium Express Box + * - 2c - Large Express Box. + * + * For FRS rating requests the only valid value is customer supplied packaging “02”. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/PackageReferenceNumber.php b/src/Api/Model/PackageReferenceNumber.php index 0c8cd6de..2af3faad 100644 --- a/src/Api/Model/PackageReferenceNumber.php +++ b/src/Api/Model/PackageReferenceNumber.php @@ -13,23 +13,23 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * If the indicator is present then the reference numbers value will be bar coded on the label. - - This is an empty tag, any value inside is ignored. - Only one shipment-level or package-level reference number can be bar coded per shipment. - - In order to barcode a reference number, its value must be no longer than 14 alphanumeric characters or 24 numeric characters and cannot contain spaces. - * - * @var string - */ + * If the indicator is present then the reference numbers value will be bar coded on the label. + * + * This is an empty tag, any value inside is ignored. + * Only one shipment-level or package-level reference number can be bar coded per shipment. + * + * In order to barcode a reference number, its value must be no longer than 14 alphanumeric characters or 24 numeric characters and cannot contain spaces. + * + * @var string + */ protected $barCodeIndicator; /** - * Reference number type code, for the entire shipment. The code specifies the Reference name. - - Refer to the Reference Number Code table. Valid if the origin/destination pair is US/US or PR/PR and character should be alpha-numeric. - * - * @var string - */ + * Reference number type code, for the entire shipment. The code specifies the Reference name. + * + * Refer to the Reference Number Code table. Valid if the origin/destination pair is US/US or PR/PR and character should be alpha-numeric. + * + * @var string + */ protected $code; /** * Customer supplied reference number. Valid if the origin/destination pair is US/US or PR/PR. @@ -38,15 +38,15 @@ public function isInitialized($property): bool */ protected $value; /** - * If the indicator is present then the reference numbers value will be bar coded on the label. - - This is an empty tag, any value inside is ignored. - Only one shipment-level or package-level reference number can be bar coded per shipment. - - In order to barcode a reference number, its value must be no longer than 14 alphanumeric characters or 24 numeric characters and cannot contain spaces. - * - * @return string - */ + * If the indicator is present then the reference numbers value will be bar coded on the label. + * + * This is an empty tag, any value inside is ignored. + * Only one shipment-level or package-level reference number can be bar coded per shipment. + * + * In order to barcode a reference number, its value must be no longer than 14 alphanumeric characters or 24 numeric characters and cannot contain spaces. + * + * @return string + */ public function getBarCodeIndicator(): string { return $this->barCodeIndicator; @@ -70,12 +70,12 @@ public function setBarCodeIndicator(string $barCodeIndicator): self return $this; } /** - * Reference number type code, for the entire shipment. The code specifies the Reference name. - - Refer to the Reference Number Code table. Valid if the origin/destination pair is US/US or PR/PR and character should be alpha-numeric. - * - * @return string - */ + * Reference number type code, for the entire shipment. The code specifies the Reference name. + * + * Refer to the Reference Number Code table. Valid if the origin/destination pair is US/US or PR/PR and character should be alpha-numeric. + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/PackageResultsChemicalRecordResults.php b/src/Api/Model/PackageResultsChemicalRecordResults.php index 42938218..c2f81b5b 100644 --- a/src/Api/Model/PackageResultsChemicalRecordResults.php +++ b/src/Api/Model/PackageResultsChemicalRecordResults.php @@ -37,11 +37,11 @@ public function isInitialized($property): bool */ protected $tunnelRestrictionCode; /** - * Number of ADR Units (Liters/Kg) - Format: 9999.99 - * - * @var string - */ + * Number of ADR Units (Liters/Kg) + * Format: 9999.99 + * + * @var string + */ protected $aDRUnits; /** * Identifies the Chemical Record. @@ -132,11 +132,11 @@ public function setTunnelRestrictionCode(string $tunnelRestrictionCode): self return $this; } /** - * Number of ADR Units (Liters/Kg) - Format: 9999.99 - * - * @return string - */ + * Number of ADR Units (Liters/Kg) + * Format: 9999.99 + * + * @return string + */ public function getADRUnits(): string { return $this->aDRUnits; diff --git a/src/Api/Model/PackageResultsForm.php b/src/Api/Model/PackageResultsForm.php index d9894cf9..5ca89c64 100644 --- a/src/Api/Model/PackageResultsForm.php +++ b/src/Api/Model/PackageResultsForm.php @@ -13,12 +13,12 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code that indicates the type of form. Valid values: - - 01 - All Requested International Forms. - - * - * @var string - */ + * Code that indicates the type of form. Valid values: + * - 01 - All Requested International Forms. + * + * + * @var string + */ protected $code; /** * Description that indicates the type of form. Possible Values: All Requested International Forms. @@ -45,12 +45,12 @@ public function isInitialized($property): bool */ protected $formGroupIdName; /** - * Code that indicates the type of form. Valid values: - - 01 - All Requested International Forms. - - * - * @return string - */ + * Code that indicates the type of form. Valid values: + * - 01 - All Requested International Forms. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/PackageResultsNegotiatedCharges.php b/src/Api/Model/PackageResultsNegotiatedCharges.php index 5e64e6e7..38f46c0a 100644 --- a/src/Api/Model/PackageResultsNegotiatedCharges.php +++ b/src/Api/Model/PackageResultsNegotiatedCharges.php @@ -13,30 +13,30 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Negotiated Itemized Accessorial and SurCharges. - - Negotiated itemized charges are only returned for certain contract-only shipments as well as Worldwide Express Freight, Ground Freight Pricing, and Hazmat movements. Negotiated Itemized Accessorial and Sur Charges are returned only when the subversion element is present and greater than or equal to 1607. - - Package level itemized charges are only returned for US domestic movements - - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @var list - */ + * Negotiated Itemized Accessorial and SurCharges. + * + * Negotiated itemized charges are only returned for certain contract-only shipments as well as Worldwide Express Freight, Ground Freight Pricing, and Hazmat movements. Negotiated Itemized Accessorial and Sur Charges are returned only when the subversion element is present and greater than or equal to 1607. + * + * Package level itemized charges are only returned for US domestic movements + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * + * @var list + */ protected $itemizedCharges; /** - * Negotiated Itemized Accessorial and SurCharges. - - Negotiated itemized charges are only returned for certain contract-only shipments as well as Worldwide Express Freight, Ground Freight Pricing, and Hazmat movements. Negotiated Itemized Accessorial and Sur Charges are returned only when the subversion element is present and greater than or equal to 1607. - - Package level itemized charges are only returned for US domestic movements - - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @return list - */ + * Negotiated Itemized Accessorial and SurCharges. + * + * Negotiated itemized charges are only returned for certain contract-only shipments as well as Worldwide Express Freight, Ground Freight Pricing, and Hazmat movements. Negotiated Itemized Accessorial and Sur Charges are returned only when the subversion element is present and greater than or equal to 1607. + * + * Package level itemized charges are only returned for US domestic movements + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * + * @return list + */ public function getItemizedCharges(): array { return $this->itemizedCharges; diff --git a/src/Api/Model/PackageResultsServiceOptionsCharges.php b/src/Api/Model/PackageResultsServiceOptionsCharges.php index e3024926..33b2e79d 100644 --- a/src/Api/Model/PackageResultsServiceOptionsCharges.php +++ b/src/Api/Model/PackageResultsServiceOptionsCharges.php @@ -19,12 +19,12 @@ public function isInitialized($property): bool */ protected $currencyCode; /** - * Package accessorial charges value amount. - - Valid values are from 0 to 99999999999999.99 - * - * @var string - */ + * Package accessorial charges value amount. + * + * Valid values are from 0 to 99999999999999.99 + * + * @var string + */ protected $monetaryValue; /** * Package accessorial charges currency code type. The currency code used in the Shipment request is returned. @@ -49,12 +49,12 @@ public function setCurrencyCode(string $currencyCode): self return $this; } /** - * Package accessorial charges value amount. - - Valid values are from 0 to 99999999999999.99 - * - * @return string - */ + * Package accessorial charges value amount. + * + * Valid values are from 0 to 99999999999999.99 + * + * @return string + */ public function getMonetaryValue(): string { return $this->monetaryValue; diff --git a/src/Api/Model/PackageResultsShippingLabel.php b/src/Api/Model/PackageResultsShippingLabel.php index fdcd7359..28e6c4b6 100644 --- a/src/Api/Model/PackageResultsShippingLabel.php +++ b/src/Api/Model/PackageResultsShippingLabel.php @@ -26,7 +26,9 @@ public function isInitialized($property): bool protected $graphicImage; /** * Base 64 encoded graphic image. Applicable only for Mail Innovations CN22 Combination Forward Label with more than 3 commodities. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -95,7 +97,9 @@ public function setGraphicImage(string $graphicImage): self } /** * Base 64 encoded graphic image. Applicable only for Mail Innovations CN22 Combination Forward Label with more than 3 commodities. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/PackageResultsShippingReceipt.php b/src/Api/Model/PackageResultsShippingReceipt.php index d5f208ee..eb1bc60d 100644 --- a/src/Api/Model/PackageResultsShippingReceipt.php +++ b/src/Api/Model/PackageResultsShippingReceipt.php @@ -19,12 +19,12 @@ public function isInitialized($property): bool */ protected $imageFormat; /** - * Base 64 encoded receipt in HTML format. - - The receipt image is only returned for the first 5 packages. - * - * @var string - */ + * Base 64 encoded receipt in HTML format. + * + * The receipt image is only returned for the first 5 packages. + * + * @var string + */ protected $graphicImage; /** * Container for a Image Format. @@ -49,12 +49,12 @@ public function setImageFormat(ShippingReceiptImageFormat $imageFormat): self return $this; } /** - * Base 64 encoded receipt in HTML format. - - The receipt image is only returned for the first 5 packages. - * - * @return string - */ + * Base 64 encoded receipt in HTML format. + * + * The receipt image is only returned for the first 5 packages. + * + * @return string + */ public function getGraphicImage(): string { return $this->graphicImage; diff --git a/src/Api/Model/PackageServiceOptionsDeliveryConfirmation.php b/src/Api/Model/PackageServiceOptionsDeliveryConfirmation.php index 506e6d43..67dddcf6 100644 --- a/src/Api/Model/PackageServiceOptionsDeliveryConfirmation.php +++ b/src/Api/Model/PackageServiceOptionsDeliveryConfirmation.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Type of delivery confirmation. Valid values: - - 1 - Unsupported - - 2 - Delivery Confirmation Signature Required - - 3 - Delivery Confirmation Adult Signature Required - * - * @var string - */ + * Type of delivery confirmation. Valid values: + * - 1 - Unsupported + * - 2 - Delivery Confirmation Signature Required + * - 3 - Delivery Confirmation Adult Signature Required + * + * @var string + */ protected $dCISType; /** * Delivery Confirmation Control number associated with the delivery confirmation for the package. Valid for forward shipments only. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $dCISNumber; /** - * Type of delivery confirmation. Valid values: - - 1 - Unsupported - - 2 - Delivery Confirmation Signature Required - - 3 - Delivery Confirmation Adult Signature Required - * - * @return string - */ + * Type of delivery confirmation. Valid values: + * - 1 - Unsupported + * - 2 - Delivery Confirmation Signature Required + * - 3 - Delivery Confirmation Adult Signature Required + * + * @return string + */ public function getDCISType(): string { return $this->dCISType; diff --git a/src/Api/Model/PackageServiceOptionsHazMat.php b/src/Api/Model/PackageServiceOptionsHazMat.php index 7f3785e7..3b616725 100644 --- a/src/Api/Model/PackageServiceOptionsHazMat.php +++ b/src/Api/Model/PackageServiceOptionsHazMat.php @@ -37,13 +37,13 @@ public function isInitialized($property): bool */ protected $recordIdentifier3; /** - * Recommended if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. - - Secondary hazardous characteristics of a package. (There can be more than one – separate each with a comma). - - * - * @var string - */ + * Recommended if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. + * + * Secondary hazardous characteristics of a package. (There can be more than one – separate each with a comma). + * + * + * @var string + */ protected $subRiskClass; /** * The type of regulated good for an ADR package where ADR is for Europe to Europe ground movement. @@ -52,15 +52,15 @@ public function isInitialized($property): bool */ protected $aDRItemNumber; /** - * Required if the field applies to the material by regulation. Field input is Arabic numerals, output is Roman numerals. Will be shown in Roman Numerals. Valid values: - - "1" = "I", - - "2" = "II", - - "3" = "III", - - and blank. - - * - * @var string - */ + * Required if the field applies to the material by regulation. Field input is Arabic numerals, output is Roman numerals. Will be shown in Roman Numerals. Valid values: + * - "1" = "I", + * - "2" = "II", + * - "3" = "III", + * - and blank. + * + * + * @var string + */ protected $aDRPackingGroupLetter; /** * The technical name (when required) for the specified commodity. Recommended if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. @@ -69,21 +69,21 @@ public function isInitialized($property): bool */ protected $technicalName; /** - * Defines the type of label that is required on the package for the commodity. - - Not applicable if CommodityRegulatedLevelCode = LR or EQ. - * - * @var string - */ + * Defines the type of label that is required on the package for the commodity. + * + * Not applicable if CommodityRegulatedLevelCode = LR or EQ. + * + * @var string + */ protected $hazardLabelRequired; /** - * This is the hazard class associated to the specified commodity. - - Required if CommodityRegulatedLevelCode is 'EQ', 'LQ' or 'FR' - - * - * @var string - */ + * This is the hazard class associated to the specified commodity. + * + * Required if CommodityRegulatedLevelCode is 'EQ', 'LQ' or 'FR' + * + * + * @var string + */ protected $classDivisionNumber; /** * Optional reference number. It will be displayed only on label. @@ -98,12 +98,12 @@ public function isInitialized($property): bool */ protected $quantity; /** - * Required if CommodityRegulatedLevelCode = LQ, EQ or FR. The unit of measure used for the mass capacity of the regulated good. - - For Example: ml, L, g, mg, kg, cylinder, pound, pint, quart, gallon, ounce etc. - * - * @var string - */ + * Required if CommodityRegulatedLevelCode = LQ, EQ or FR. The unit of measure used for the mass capacity of the regulated good. + * + * For Example: ml, L, g, mg, kg, cylinder, pound, pint, quart, gallon, ounce etc. + * + * @var string + */ protected $uOM; /** * The type of package used to contain the regulated good. (Ex: Fiberboard Box). Required if CommodityRegulatedLevelCode = LQ or FR. Ex. FIBERBOARD BOX, WOOD(EN) BOX, PLASTIC JERRICAN, METAL BOX, STEEL DRUM, OTHER, PLASTIC BOX, PLASTIC DRUM, STYROFOAM BOX, CYLINDERS, ENVIROTAINER, PLYWOOD BOX, ALUMINUM DRUM, ALUMINUM CYLINDERS, PLASTIC PAIL, PLYWOOD DRUM, FIBER DRUM, STEEL JERRICAN, ALUMINUM JERRICAN, STEEL BOX, CARTON, ALUMINUM BOX @@ -112,12 +112,12 @@ public function isInitialized($property): bool */ protected $packagingType; /** - * This is the ID number (UN/NA/ID) for the specified commodity. - Required if CommodityRegulatedLevelCode = LR, LQ or FR and if the field applies to the material by regulation. - UN/NA/ID Identification Number assigned to the specified regulated good. (Include the UN/NA/ID as part of the entry). - * - * @var string - */ + * This is the ID number (UN/NA/ID) for the specified commodity. + * Required if CommodityRegulatedLevelCode = LR, LQ or FR and if the field applies to the material by regulation. + * UN/NA/ID Identification Number assigned to the specified regulated good. (Include the UN/NA/ID as part of the entry). + * + * @var string + */ protected $iDNumber; /** * The Proper Shipping Name assigned by ADR, CFR or IATA. Required if CommodityRegulatedLevelCode = LR, LQ or FR. @@ -126,24 +126,24 @@ public function isInitialized($property): bool */ protected $properShippingName; /** - * Additional remarks or special provision information. Recommended if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. - - Additional information that may be required by regulation about a hazardous material, such as, "Limited Quantity", DOT-SP numbers, EX numbers. - - * - * @var string - */ + * Additional remarks or special provision information. Recommended if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. + * + * Additional information that may be required by regulation about a hazardous material, such as, "Limited Quantity", DOT-SP numbers, EX numbers. + * + * + * @var string + */ protected $additionalDescription; /** - * This is the packing group category associated to the specified commodity. Recommended if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. Must be shown in Roman Numerals. - Valid values: - I - II - III - blank - * - * @var string - */ + * This is the packing group category associated to the specified commodity. Recommended if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. Must be shown in Roman Numerals. + * Valid values: + * I + * II + * III + * blank + * + * @var string + */ protected $packagingGroupType; /** * The packing instructions related to the chemical record. Required if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. @@ -152,13 +152,13 @@ public function isInitialized($property): bool */ protected $packagingInstructionCode; /** - * 24 Hour Emergency Phone Number of the shipper. Valid values for this field are (0) through (9) with trailing blanks. For numbers within the U.S., the layout is 1, area code, 7-digit number. For all other countries or territories the layout is country or territory code, area code, number. - - The following are restricted in the phone number period ".", dash "-", plus sign "+" and conventional parentheses "(" and ")", "EXT" or "OPT" - - * - * @var string - */ + * 24 Hour Emergency Phone Number of the shipper. Valid values for this field are (0) through (9) with trailing blanks. For numbers within the U.S., the layout is 1, area code, 7-digit number. For all other countries or territories the layout is country or territory code, area code, number. + * + * The following are restricted in the phone number period ".", dash "-", plus sign "+" and conventional parentheses "(" and ")", "EXT" or "OPT" + * + * + * @var string + */ protected $emergencyPhone; /** * The emergency information, contact name and/or contract number, required to be communicated when a call is placed to the EmergencyPhoneNumber. The information is required if there is a value in the EmergencyPhoneNumber field above and the shipment is with a US50 or PR origin and/or destination and the RegulationSet is IATA. @@ -173,36 +173,36 @@ public function isInitialized($property): bool */ protected $reportableQuantity; /** - * The Regulatory set associated with every regulated shipment. It must be same across the shipment. - Valid values: - ADR = Europe to Europe Ground Movement - CFR = HazMat regulated by US Dept. of Transportation within the U.S. or ground shipments to Canada - IATA= Worldwide Air movement - TDG= Canada to Canada ground movement or Canada to U.S. standard movement. Valid values are ADR, CFR, IATA and TDG. - For multiple Chemical Records per package or multiple packages containing different RegulationSet, RegulationSet of first Chemical Record would be considered for validating and rating the entire shipment. - * - * @var string - */ + * The Regulatory set associated with every regulated shipment. It must be same across the shipment. + * Valid values: + * ADR = Europe to Europe Ground Movement + * CFR = HazMat regulated by US Dept. of Transportation within the U.S. or ground shipments to Canada + * IATA= Worldwide Air movement + * TDG= Canada to Canada ground movement or Canada to U.S. standard movement. Valid values are ADR, CFR, IATA and TDG. + * For multiple Chemical Records per package or multiple packages containing different RegulationSet, RegulationSet of first Chemical Record would be considered for validating and rating the entire shipment. + * + * @var string + */ protected $regulationSet; /** - * Not applicable for ADR regulation set. Required for any other regulation set. Declares that a package was prepared according to ground passenger aircraft or cargo aircraft only. - Valid values: - Highway=Highway - Ground=Ground - PAX=Passenger Aircraft - Passenger Aircraft=Passenger Aircraft - CAO=Cargo Aircraft Only - Cargo Aircraft Only=Cargo Aircraft Only Valid entries include: Highway, Ground, PAX, Passenger Aircraft, CAO and Cargo Aircraft Only. - * - * @var string - */ + * Not applicable for ADR regulation set. Required for any other regulation set. Declares that a package was prepared according to ground passenger aircraft or cargo aircraft only. + * Valid values: + * Highway=Highway + * Ground=Ground + * PAX=Passenger Aircraft + * Passenger Aircraft=Passenger Aircraft + * CAO=Cargo Aircraft Only + * Cargo Aircraft Only=Cargo Aircraft Only Valid entries include: Highway, Ground, PAX, Passenger Aircraft, CAO and Cargo Aircraft Only. + * + * @var string + */ protected $transportationMode; /** - * Indicates the type of commodity - Fully Regulated (FR), Limited Quantity (LQ), Excepted Quantity (EQ) or Lightly Regulated (LR). Valid values are LR, FR, LQ and EQ. - Required for subversion 1701 or greater. LR and EQ are validated if subversion is 1701 or greater. FR, LQ will be validated if subversion is 1807 or greater - * - * @var string - */ + * Indicates the type of commodity - Fully Regulated (FR), Limited Quantity (LQ), Excepted Quantity (EQ) or Lightly Regulated (LR). Valid values are LR, FR, LQ and EQ. + * Required for subversion 1701 or greater. LR and EQ are validated if subversion is 1701 or greater. FR, LQ will be validated if subversion is 1807 or greater + * + * @var string + */ protected $commodityRegulatedLevelCode; /** * Transport Category. Valid values are 0 to 4. @@ -323,13 +323,13 @@ public function setRecordIdentifier3(string $recordIdentifier3): self return $this; } /** - * Recommended if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. - - Secondary hazardous characteristics of a package. (There can be more than one – separate each with a comma). - - * - * @return string - */ + * Recommended if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. + * + * Secondary hazardous characteristics of a package. (There can be more than one – separate each with a comma). + * + * + * @return string + */ public function getSubRiskClass(): string { return $this->subRiskClass; @@ -373,15 +373,15 @@ public function setADRItemNumber(string $aDRItemNumber): self return $this; } /** - * Required if the field applies to the material by regulation. Field input is Arabic numerals, output is Roman numerals. Will be shown in Roman Numerals. Valid values: - - "1" = "I", - - "2" = "II", - - "3" = "III", - - and blank. - - * - * @return string - */ + * Required if the field applies to the material by regulation. Field input is Arabic numerals, output is Roman numerals. Will be shown in Roman Numerals. Valid values: + * - "1" = "I", + * - "2" = "II", + * - "3" = "III", + * - and blank. + * + * + * @return string + */ public function getADRPackingGroupLetter(): string { return $this->aDRPackingGroupLetter; @@ -427,12 +427,12 @@ public function setTechnicalName(string $technicalName): self return $this; } /** - * Defines the type of label that is required on the package for the commodity. - - Not applicable if CommodityRegulatedLevelCode = LR or EQ. - * - * @return string - */ + * Defines the type of label that is required on the package for the commodity. + * + * Not applicable if CommodityRegulatedLevelCode = LR or EQ. + * + * @return string + */ public function getHazardLabelRequired(): string { return $this->hazardLabelRequired; @@ -453,13 +453,13 @@ public function setHazardLabelRequired(string $hazardLabelRequired): self return $this; } /** - * This is the hazard class associated to the specified commodity. - - Required if CommodityRegulatedLevelCode is 'EQ', 'LQ' or 'FR' - - * - * @return string - */ + * This is the hazard class associated to the specified commodity. + * + * Required if CommodityRegulatedLevelCode is 'EQ', 'LQ' or 'FR' + * + * + * @return string + */ public function getClassDivisionNumber(): string { return $this->classDivisionNumber; @@ -525,12 +525,12 @@ public function setQuantity(string $quantity): self return $this; } /** - * Required if CommodityRegulatedLevelCode = LQ, EQ or FR. The unit of measure used for the mass capacity of the regulated good. - - For Example: ml, L, g, mg, kg, cylinder, pound, pint, quart, gallon, ounce etc. - * - * @return string - */ + * Required if CommodityRegulatedLevelCode = LQ, EQ or FR. The unit of measure used for the mass capacity of the regulated good. + * + * For Example: ml, L, g, mg, kg, cylinder, pound, pint, quart, gallon, ounce etc. + * + * @return string + */ public function getUOM(): string { return $this->uOM; @@ -573,12 +573,12 @@ public function setPackagingType(string $packagingType): self return $this; } /** - * This is the ID number (UN/NA/ID) for the specified commodity. - Required if CommodityRegulatedLevelCode = LR, LQ or FR and if the field applies to the material by regulation. - UN/NA/ID Identification Number assigned to the specified regulated good. (Include the UN/NA/ID as part of the entry). - * - * @return string - */ + * This is the ID number (UN/NA/ID) for the specified commodity. + * Required if CommodityRegulatedLevelCode = LR, LQ or FR and if the field applies to the material by regulation. + * UN/NA/ID Identification Number assigned to the specified regulated good. (Include the UN/NA/ID as part of the entry). + * + * @return string + */ public function getIDNumber(): string { return $this->iDNumber; @@ -621,13 +621,13 @@ public function setProperShippingName(string $properShippingName): self return $this; } /** - * Additional remarks or special provision information. Recommended if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. - - Additional information that may be required by regulation about a hazardous material, such as, "Limited Quantity", DOT-SP numbers, EX numbers. - - * - * @return string - */ + * Additional remarks or special provision information. Recommended if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. + * + * Additional information that may be required by regulation about a hazardous material, such as, "Limited Quantity", DOT-SP numbers, EX numbers. + * + * + * @return string + */ public function getAdditionalDescription(): string { return $this->additionalDescription; @@ -649,15 +649,15 @@ public function setAdditionalDescription(string $additionalDescription): self return $this; } /** - * This is the packing group category associated to the specified commodity. Recommended if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. Must be shown in Roman Numerals. - Valid values: - I - II - III - blank - * - * @return string - */ + * This is the packing group category associated to the specified commodity. Recommended if CommodityRegulatedLevelCode = LQ or FR and if the field applies to the material by regulation. Must be shown in Roman Numerals. + * Valid values: + * I + * II + * III + * blank + * + * @return string + */ public function getPackagingGroupType(): string { return $this->packagingGroupType; @@ -703,13 +703,13 @@ public function setPackagingInstructionCode(string $packagingInstructionCode): s return $this; } /** - * 24 Hour Emergency Phone Number of the shipper. Valid values for this field are (0) through (9) with trailing blanks. For numbers within the U.S., the layout is 1, area code, 7-digit number. For all other countries or territories the layout is country or territory code, area code, number. - - The following are restricted in the phone number period ".", dash "-", plus sign "+" and conventional parentheses "(" and ")", "EXT" or "OPT" - - * - * @return string - */ + * 24 Hour Emergency Phone Number of the shipper. Valid values for this field are (0) through (9) with trailing blanks. For numbers within the U.S., the layout is 1, area code, 7-digit number. For all other countries or territories the layout is country or territory code, area code, number. + * + * The following are restricted in the phone number period ".", dash "-", plus sign "+" and conventional parentheses "(" and ")", "EXT" or "OPT" + * + * + * @return string + */ public function getEmergencyPhone(): string { return $this->emergencyPhone; @@ -775,16 +775,16 @@ public function setReportableQuantity(string $reportableQuantity): self return $this; } /** - * The Regulatory set associated with every regulated shipment. It must be same across the shipment. - Valid values: - ADR = Europe to Europe Ground Movement - CFR = HazMat regulated by US Dept. of Transportation within the U.S. or ground shipments to Canada - IATA= Worldwide Air movement - TDG= Canada to Canada ground movement or Canada to U.S. standard movement. Valid values are ADR, CFR, IATA and TDG. - For multiple Chemical Records per package or multiple packages containing different RegulationSet, RegulationSet of first Chemical Record would be considered for validating and rating the entire shipment. - * - * @return string - */ + * The Regulatory set associated with every regulated shipment. It must be same across the shipment. + * Valid values: + * ADR = Europe to Europe Ground Movement + * CFR = HazMat regulated by US Dept. of Transportation within the U.S. or ground shipments to Canada + * IATA= Worldwide Air movement + * TDG= Canada to Canada ground movement or Canada to U.S. standard movement. Valid values are ADR, CFR, IATA and TDG. + * For multiple Chemical Records per package or multiple packages containing different RegulationSet, RegulationSet of first Chemical Record would be considered for validating and rating the entire shipment. + * + * @return string + */ public function getRegulationSet(): string { return $this->regulationSet; @@ -809,17 +809,17 @@ public function setRegulationSet(string $regulationSet): self return $this; } /** - * Not applicable for ADR regulation set. Required for any other regulation set. Declares that a package was prepared according to ground passenger aircraft or cargo aircraft only. - Valid values: - Highway=Highway - Ground=Ground - PAX=Passenger Aircraft - Passenger Aircraft=Passenger Aircraft - CAO=Cargo Aircraft Only - Cargo Aircraft Only=Cargo Aircraft Only Valid entries include: Highway, Ground, PAX, Passenger Aircraft, CAO and Cargo Aircraft Only. - * - * @return string - */ + * Not applicable for ADR regulation set. Required for any other regulation set. Declares that a package was prepared according to ground passenger aircraft or cargo aircraft only. + * Valid values: + * Highway=Highway + * Ground=Ground + * PAX=Passenger Aircraft + * Passenger Aircraft=Passenger Aircraft + * CAO=Cargo Aircraft Only + * Cargo Aircraft Only=Cargo Aircraft Only Valid entries include: Highway, Ground, PAX, Passenger Aircraft, CAO and Cargo Aircraft Only. + * + * @return string + */ public function getTransportationMode(): string { return $this->transportationMode; @@ -845,11 +845,11 @@ public function setTransportationMode(string $transportationMode): self return $this; } /** - * Indicates the type of commodity - Fully Regulated (FR), Limited Quantity (LQ), Excepted Quantity (EQ) or Lightly Regulated (LR). Valid values are LR, FR, LQ and EQ. - Required for subversion 1701 or greater. LR and EQ are validated if subversion is 1701 or greater. FR, LQ will be validated if subversion is 1807 or greater - * - * @return string - */ + * Indicates the type of commodity - Fully Regulated (FR), Limited Quantity (LQ), Excepted Quantity (EQ) or Lightly Regulated (LR). Valid values are LR, FR, LQ and EQ. + * Required for subversion 1701 or greater. LR and EQ are validated if subversion is 1701 or greater. FR, LQ will be validated if subversion is 1807 or greater + * + * @return string + */ public function getCommodityRegulatedLevelCode(): string { return $this->commodityRegulatedLevelCode; diff --git a/src/Api/Model/PackageServiceOptionsNotification.php b/src/Api/Model/PackageServiceOptionsNotification.php index 71fca61a..4b97e4a3 100644 --- a/src/Api/Model/PackageServiceOptionsNotification.php +++ b/src/Api/Model/PackageServiceOptionsNotification.php @@ -13,15 +13,15 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Notification Code. Valid values: - 3 - Receiver Return Notification - 6 - QV Email Notification - 7 - QV Exception Notification - 8 - QV Delivery Notification - For Mail Innovations forward shipments, QV Email Notifications are allowed for First Class, Priority Mail, and Expedited Mail Innovation services. - * - * @var string - */ + * Notification Code. Valid values: + * 3 - Receiver Return Notification + * 6 - QV Email Notification + * 7 - QV Exception Notification + * 8 - QV Delivery Notification + * For Mail Innovations forward shipments, QV Email Notifications are allowed for First Class, Priority Mail, and Expedited Mail Innovation services. + * + * @var string + */ protected $notificationCode; /** * Container for the e-mail message. @@ -30,15 +30,15 @@ public function isInitialized($property): bool */ protected $eMail; /** - * Notification Code. Valid values: - 3 - Receiver Return Notification - 6 - QV Email Notification - 7 - QV Exception Notification - 8 - QV Delivery Notification - For Mail Innovations forward shipments, QV Email Notifications are allowed for First Class, Priority Mail, and Expedited Mail Innovation services. - * - * @return string - */ + * Notification Code. Valid values: + * 3 - Receiver Return Notification + * 6 - QV Email Notification + * 7 - QV Exception Notification + * 8 - QV Delivery Notification + * For Mail Innovations forward shipments, QV Email Notifications are allowed for First Class, Priority Mail, and Expedited Mail Innovation services. + * + * @return string + */ public function getNotificationCode(): string { return $this->notificationCode; diff --git a/src/Api/Model/PackageServiceOptionsNotificationEMail.php b/src/Api/Model/PackageServiceOptionsNotificationEMail.php index 3ef00b33..4be363f4 100644 --- a/src/Api/Model/PackageServiceOptionsNotificationEMail.php +++ b/src/Api/Model/PackageServiceOptionsNotificationEMail.php @@ -19,31 +19,31 @@ public function isInitialized($property): bool */ protected $subject; /** - * Specifies a reference code and reference number to display in the subject of the Receiver Return Notification. - - When the subject code is provided, the subject will contain the following: UPS Receiver Return Notification. - - The reference code (the reference code will be mapped to the corresponding ANSI value) Plus the reference number. - - The valid subject codes are: - - 01 - Shipment Reference Number 1, - - 02 - Shipment Reference Number 2, - - 03 - package Reference Number 1, - - 04 - package Reference Number 2, - - 05 - package Reference Number 3, - - 06 - package Reference Number 4, - - 07 - package Reference Number 5, - - 08 - Subject Text (Return Notification only). - - If the subject code tag is not provided and the subject text is provided, the subject of the notification will be the subject text. - - If the subject text is provided, and subject code tag exists, then the subject code value must be 08. - - If the subject code is 08, the subject text must exist. If a subject code is provided that refers to a nonexistent reference number, the subject will default to the tracking number. Only allowed at the first package. - - * - * @var string - */ + * Specifies a reference code and reference number to display in the subject of the Receiver Return Notification. + * + * When the subject code is provided, the subject will contain the following: UPS Receiver Return Notification. + * + * The reference code (the reference code will be mapped to the corresponding ANSI value) Plus the reference number. + * + * The valid subject codes are: + * - 01 - Shipment Reference Number 1, + * - 02 - Shipment Reference Number 2, + * - 03 - package Reference Number 1, + * - 04 - package Reference Number 2, + * - 05 - package Reference Number 3, + * - 06 - package Reference Number 4, + * - 07 - package Reference Number 5, + * - 08 - Subject Text (Return Notification only). + * + * If the subject code tag is not provided and the subject text is provided, the subject of the notification will be the subject text. + * + * If the subject text is provided, and subject code tag exists, then the subject code value must be 08. + * + * If the subject code is 08, the subject text must exist. If a subject code is provided that refers to a nonexistent reference number, the subject will default to the tracking number. Only allowed at the first package. + * + * + * @var string + */ protected $subjectCode; /** * The destination email address of the receiver returns notification email. @@ -98,31 +98,31 @@ public function setSubject(string $subject): self return $this; } /** - * Specifies a reference code and reference number to display in the subject of the Receiver Return Notification. - - When the subject code is provided, the subject will contain the following: UPS Receiver Return Notification. - - The reference code (the reference code will be mapped to the corresponding ANSI value) Plus the reference number. - - The valid subject codes are: - - 01 - Shipment Reference Number 1, - - 02 - Shipment Reference Number 2, - - 03 - package Reference Number 1, - - 04 - package Reference Number 2, - - 05 - package Reference Number 3, - - 06 - package Reference Number 4, - - 07 - package Reference Number 5, - - 08 - Subject Text (Return Notification only). - - If the subject code tag is not provided and the subject text is provided, the subject of the notification will be the subject text. - - If the subject text is provided, and subject code tag exists, then the subject code value must be 08. - - If the subject code is 08, the subject text must exist. If a subject code is provided that refers to a nonexistent reference number, the subject will default to the tracking number. Only allowed at the first package. - - * - * @return string - */ + * Specifies a reference code and reference number to display in the subject of the Receiver Return Notification. + * + * When the subject code is provided, the subject will contain the following: UPS Receiver Return Notification. + * + * The reference code (the reference code will be mapped to the corresponding ANSI value) Plus the reference number. + * + * The valid subject codes are: + * - 01 - Shipment Reference Number 1, + * - 02 - Shipment Reference Number 2, + * - 03 - package Reference Number 1, + * - 04 - package Reference Number 2, + * - 05 - package Reference Number 3, + * - 06 - package Reference Number 4, + * - 07 - package Reference Number 5, + * - 08 - Subject Text (Return Notification only). + * + * If the subject code tag is not provided and the subject text is provided, the subject of the notification will be the subject text. + * + * If the subject text is provided, and subject code tag exists, then the subject code value must be 08. + * + * If the subject code is 08, the subject text must exist. If a subject code is provided that refers to a nonexistent reference number, the subject will default to the tracking number. Only allowed at the first package. + * + * + * @return string + */ public function getSubjectCode(): string { return $this->subjectCode; diff --git a/src/Api/Model/PackageSimpleRate.php b/src/Api/Model/PackageSimpleRate.php index d810984b..ee89545b 100644 --- a/src/Api/Model/PackageSimpleRate.php +++ b/src/Api/Model/PackageSimpleRate.php @@ -13,16 +13,16 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * SimpleRate code. Valid Values - - XS = Extra Small - - S = Small - - M = Medium - - L = Large - - XL = Extra Large - - * - * @var string - */ + * SimpleRate code. Valid Values + * - XS = Extra Small + * - S = Small + * - M = Medium + * - L = Large + * - XL = Extra Large + * + * + * @var string + */ protected $code; /** * Simple Rate description of the code above. Currently ignored if provided in the Request. Length is not validated. @@ -31,16 +31,16 @@ public function isInitialized($property): bool */ protected $description; /** - * SimpleRate code. Valid Values - - XS = Extra Small - - S = Small - - M = Medium - - L = Large - - XL = Extra Large - - * - * @return string - */ + * SimpleRate code. Valid Values + * - XS = Extra Small + * - S = Small + * - M = Medium + * - L = Large + * - XL = Extra Large + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/PackageUPSPremier.php b/src/Api/Model/PackageUPSPremier.php index 0488f3b3..879b362f 100644 --- a/src/Api/Model/PackageUPSPremier.php +++ b/src/Api/Model/PackageUPSPremier.php @@ -13,12 +13,12 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * UPS Premier Category. Valid values are 01,02,03 UPS Premier Silver -01 - UPS Premier Gold - 02 - UPS Premier Platinum - 03 - * - * @var string - */ + * UPS Premier Category. Valid values are 01,02,03 UPS Premier Silver -01 + * UPS Premier Gold - 02 + * UPS Premier Platinum - 03 + * + * @var string + */ protected $category; /** * SensorID is RFID for UPS Premier Silver. SensorID is MeshID for UPS Premier Gold or UPS Premier Platinum Package. @@ -33,12 +33,12 @@ public function isInitialized($property): bool */ protected $handlingInstructions; /** - * UPS Premier Category. Valid values are 01,02,03 UPS Premier Silver -01 - UPS Premier Gold - 02 - UPS Premier Platinum - 03 - * - * @return string - */ + * UPS Premier Category. Valid values are 01,02,03 UPS Premier Silver -01 + * UPS Premier Gold - 02 + * UPS Premier Platinum - 03 + * + * @return string + */ public function getCategory(): string { return $this->category; diff --git a/src/Api/Model/PackageWeightUnitOfMeasurement.php b/src/Api/Model/PackageWeightUnitOfMeasurement.php index 7ea5140b..5a0890f6 100644 --- a/src/Api/Model/PackageWeightUnitOfMeasurement.php +++ b/src/Api/Model/PackageWeightUnitOfMeasurement.php @@ -13,20 +13,20 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Package weight unit of measurement code. - - Valid values: - - LBS = Pounds - - KGS = Kilograms - - OZS = Ounces - - Unit of Measurement "OZS" is the only valid UOM for some of the Mail Innovations Forward and Worldwide Economy DDU Shipments. - - Please refer to Appendix for more details regarding the valid combination of Mail Innovation Forward Shipment services, Package Type and Unit of Measurement. - - * - * @var string - */ + * Package weight unit of measurement code. + * + * Valid values: + * - LBS = Pounds + * - KGS = Kilograms + * - OZS = Ounces + * + * Unit of Measurement "OZS" is the only valid UOM for some of the Mail Innovations Forward and Worldwide Economy DDU Shipments. + * + * Please refer to Appendix for more details regarding the valid combination of Mail Innovation Forward Shipment services, Package Type and Unit of Measurement. + * + * + * @var string + */ protected $code; /** * Description of the unit of measurement for package weight. @@ -35,20 +35,20 @@ public function isInitialized($property): bool */ protected $description; /** - * Package weight unit of measurement code. - - Valid values: - - LBS = Pounds - - KGS = Kilograms - - OZS = Ounces - - Unit of Measurement "OZS" is the only valid UOM for some of the Mail Innovations Forward and Worldwide Economy DDU Shipments. - - Please refer to Appendix for more details regarding the valid combination of Mail Innovation Forward Shipment services, Package Type and Unit of Measurement. - - * - * @return string - */ + * Package weight unit of measurement code. + * + * Valid values: + * - LBS = Pounds + * - KGS = Kilograms + * - OZS = Ounces + * + * Unit of Measurement "OZS" is the only valid UOM for some of the Mail Innovations Forward and Worldwide Economy DDU Shipments. + * + * Please refer to Appendix for more details regarding the valid combination of Mail Innovation Forward Shipment services, Package Type and Unit of Measurement. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/PackingListHandlingUnit.php b/src/Api/Model/PackingListHandlingUnit.php index 7eee3288..990c3e46 100644 --- a/src/Api/Model/PackingListHandlingUnit.php +++ b/src/Api/Model/PackingListHandlingUnit.php @@ -13,8 +13,6 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $commodity; @@ -49,8 +47,6 @@ public function isInitialized($property): bool */ protected $currencyCode; /** - * - * * @return list */ public function getCommodity(): array @@ -58,8 +54,6 @@ public function getCommodity(): array return $this->commodity; } /** - * - * * @param list $commodity * * @return self diff --git a/src/Api/Model/PaymentInformationPayer.php b/src/Api/Model/PaymentInformationPayer.php index 8122c833..4c0db15d 100644 --- a/src/Api/Model/PaymentInformationPayer.php +++ b/src/Api/Model/PaymentInformationPayer.php @@ -25,11 +25,11 @@ public function isInitialized($property): bool */ protected $address; /** - * Payer�s account number. - User�s 6 digit UPS account number or 9 digit SCS account number. - * - * @var string - */ + * Payer�s account number. + * User�s 6 digit UPS account number or 9 digit SCS account number. + * + * @var string + */ protected $shipperNumber; /** * Contact name at the payer�s location. @@ -100,11 +100,11 @@ public function setAddress(FreightShipPayerAddress $address): self return $this; } /** - * Payer�s account number. - User�s 6 digit UPS account number or 9 digit SCS account number. - * - * @return string - */ + * Payer�s account number. + * User�s 6 digit UPS account number or 9 digit SCS account number. + * + * @return string + */ public function getShipperNumber(): string { return $this->shipperNumber; diff --git a/src/Api/Model/PaymentInformationShipmentBillingOption.php b/src/Api/Model/PaymentInformationShipmentBillingOption.php index df786547..2679a14b 100644 --- a/src/Api/Model/PaymentInformationShipmentBillingOption.php +++ b/src/Api/Model/PaymentInformationShipmentBillingOption.php @@ -13,14 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Billing Option Code. - Valid values: - 10 - Prepaid - 30 - Bill to Third Party - 40 - Freight Collect - * - * @var string - */ + * Billing Option Code. + * Valid values: + * 10 - Prepaid + * 30 - Bill to Third Party + * 40 - Freight Collect + * + * @var string + */ protected $code; /** * Billing Option Description. @@ -29,14 +29,14 @@ public function isInitialized($property): bool */ protected $description; /** - * Billing Option Code. - Valid values: - 10 - Prepaid - 30 - Bill to Third Party - 40 - Freight Collect - * - * @return string - */ + * Billing Option Code. + * Valid values: + * 10 - Prepaid + * 30 - Bill to Third Party + * 40 - Freight Collect + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/PaymentInformationShipmentCharge.php b/src/Api/Model/PaymentInformationShipmentCharge.php index 8c5a79ad..6748ffa5 100644 --- a/src/Api/Model/PaymentInformationShipmentCharge.php +++ b/src/Api/Model/PaymentInformationShipmentCharge.php @@ -13,26 +13,26 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Valid values: - 01 = Transportation - 02 = Duties and Taxes 03 = Broker of Choice A shipment charge type of 01 = Transportation is required. - - A shipment charge type of 02 = Duties and Taxes is not required; however, this charge type is invalid for Qualified Domestic Shipments. - - A Qualified Domestic Shipment is any shipment in which one of the following applies: - - 1) The origin and destination country or territory is the same. - - 2) US to PR shipment. - - 3) PR to US shipment. - - 4) The origin and destination country or territory are both European Union countries or territories and the GoodsNotInFreeCirculation indicator is not present. - - 5) The origin and destination IATA code is the same. 03 = Broker of Choice - * - * @var string - */ + * Valid values: + * 01 = Transportation + * 02 = Duties and Taxes 03 = Broker of Choice A shipment charge type of 01 = Transportation is required. + * + * A shipment charge type of 02 = Duties and Taxes is not required; however, this charge type is invalid for Qualified Domestic Shipments. + * + * A Qualified Domestic Shipment is any shipment in which one of the following applies: + * + * 1) The origin and destination country or territory is the same. + * + * 2) US to PR shipment. + * + * 3) PR to US shipment. + * + * 4) The origin and destination country or territory are both European Union countries or territories and the GoodsNotInFreeCirculation indicator is not present. + * + * 5) The origin and destination IATA code is the same. 03 = Broker of Choice + * + * @var string + */ protected $type; /** * Container for the BillShipper billing option. The three payment methods that are available for the Bill Shipper billing option are alternate payment method, account number or credit card. This element or its sibling element, BillReceiver, BillThirdParty or ConsigneeBilledIndicator, must be present but no more than one can be present. @@ -53,36 +53,36 @@ public function isInitialized($property): bool */ protected $billThirdParty; /** - * Consignee Billing payment option indicator. The presence indicates consignee billing option is selected. The absence indicates one of the other payment options is selected. This is an empty tag, any value inside is ignored. This element or its sibling element, BillShipper, BillReceiver or BillThirdParty, must be present but no more than one can be present. This billing option is valid for a shipment charge type of Transportation only. Only applies to US/PR and PR/US shipment origins and destination. - - This payment method allows you to bill the charges for a specified shipment to a consignee who has agreed to pay the charges. All shipping charges are billed to the consignees UPS account number including the following accessorials: Additional Handling, Delivery Area Surcharges, Delivery Change Requests, Early AM Premium, Early AM Out of Territory, Fuel Surcharge, Hazardous Material Surcharges, Large Package Surcharge, Over Max Limits, and Saturday Delivery. - - Declared Value, Delivery Confirmation, On Call Pickup, Remote Area Surcharge, Saturday Pickup of Delivery fees are not passed to the consignee. These charges are billed to the shippers UPS account number. - * - * @var string - */ + * Consignee Billing payment option indicator. The presence indicates consignee billing option is selected. The absence indicates one of the other payment options is selected. This is an empty tag, any value inside is ignored. This element or its sibling element, BillShipper, BillReceiver or BillThirdParty, must be present but no more than one can be present. This billing option is valid for a shipment charge type of Transportation only. Only applies to US/PR and PR/US shipment origins and destination. + * + * This payment method allows you to bill the charges for a specified shipment to a consignee who has agreed to pay the charges. All shipping charges are billed to the consignees UPS account number including the following accessorials: Additional Handling, Delivery Area Surcharges, Delivery Change Requests, Early AM Premium, Early AM Out of Territory, Fuel Surcharge, Hazardous Material Surcharges, Large Package Surcharge, Over Max Limits, and Saturday Delivery. + * + * Declared Value, Delivery Confirmation, On Call Pickup, Remote Area Surcharge, Saturday Pickup of Delivery fees are not passed to the consignee. These charges are billed to the shippers UPS account number. + * + * @var string + */ protected $consigneeBilledIndicator; /** - * Valid values: - 01 = Transportation - 02 = Duties and Taxes 03 = Broker of Choice A shipment charge type of 01 = Transportation is required. - - A shipment charge type of 02 = Duties and Taxes is not required; however, this charge type is invalid for Qualified Domestic Shipments. - - A Qualified Domestic Shipment is any shipment in which one of the following applies: - - 1) The origin and destination country or territory is the same. - - 2) US to PR shipment. - - 3) PR to US shipment. - - 4) The origin and destination country or territory are both European Union countries or territories and the GoodsNotInFreeCirculation indicator is not present. - - 5) The origin and destination IATA code is the same. 03 = Broker of Choice - * - * @return string - */ + * Valid values: + * 01 = Transportation + * 02 = Duties and Taxes 03 = Broker of Choice A shipment charge type of 01 = Transportation is required. + * + * A shipment charge type of 02 = Duties and Taxes is not required; however, this charge type is invalid for Qualified Domestic Shipments. + * + * A Qualified Domestic Shipment is any shipment in which one of the following applies: + * + * 1) The origin and destination country or territory is the same. + * + * 2) US to PR shipment. + * + * 3) PR to US shipment. + * + * 4) The origin and destination country or territory are both European Union countries or territories and the GoodsNotInFreeCirculation indicator is not present. + * + * 5) The origin and destination IATA code is the same. 03 = Broker of Choice + * + * @return string + */ public function getType(): string { return $this->type; @@ -183,14 +183,14 @@ public function setBillThirdParty(ShipmentChargeBillThirdParty $billThirdParty): return $this; } /** - * Consignee Billing payment option indicator. The presence indicates consignee billing option is selected. The absence indicates one of the other payment options is selected. This is an empty tag, any value inside is ignored. This element or its sibling element, BillShipper, BillReceiver or BillThirdParty, must be present but no more than one can be present. This billing option is valid for a shipment charge type of Transportation only. Only applies to US/PR and PR/US shipment origins and destination. - - This payment method allows you to bill the charges for a specified shipment to a consignee who has agreed to pay the charges. All shipping charges are billed to the consignees UPS account number including the following accessorials: Additional Handling, Delivery Area Surcharges, Delivery Change Requests, Early AM Premium, Early AM Out of Territory, Fuel Surcharge, Hazardous Material Surcharges, Large Package Surcharge, Over Max Limits, and Saturday Delivery. - - Declared Value, Delivery Confirmation, On Call Pickup, Remote Area Surcharge, Saturday Pickup of Delivery fees are not passed to the consignee. These charges are billed to the shippers UPS account number. - * - * @return string - */ + * Consignee Billing payment option indicator. The presence indicates consignee billing option is selected. The absence indicates one of the other payment options is selected. This is an empty tag, any value inside is ignored. This element or its sibling element, BillShipper, BillReceiver or BillThirdParty, must be present but no more than one can be present. This billing option is valid for a shipment charge type of Transportation only. Only applies to US/PR and PR/US shipment origins and destination. + * + * This payment method allows you to bill the charges for a specified shipment to a consignee who has agreed to pay the charges. All shipping charges are billed to the consignees UPS account number including the following accessorials: Additional Handling, Delivery Area Surcharges, Delivery Change Requests, Early AM Premium, Early AM Out of Territory, Fuel Surcharge, Hazardous Material Surcharges, Large Package Surcharge, Over Max Limits, and Saturday Delivery. + * + * Declared Value, Delivery Confirmation, On Call Pickup, Remote Area Surcharge, Saturday Pickup of Delivery fees are not passed to the consignee. These charges are billed to the shippers UPS account number. + * + * @return string + */ public function getConsigneeBilledIndicator(): string { return $this->consigneeBilledIndicator; diff --git a/src/Api/Model/PickupCancelRequest.php b/src/Api/Model/PickupCancelRequest.php index 43881e2f..188731e1 100644 --- a/src/Api/Model/PickupCancelRequest.php +++ b/src/Api/Model/PickupCancelRequest.php @@ -19,19 +19,19 @@ public function isInitialized($property): bool */ protected $request; /** - * Cancel pickup by Pickup Request Number (PRN). - - 01= Account Number - - 02 = PRN - * - * @var string - */ + * Cancel pickup by Pickup Request Number (PRN). + * - 01= Account Number + * - 02 = PRN + * + * @var string + */ protected $cancelBy; /** - * The pickup request number (PRN) generated by UPS pickup system. - Required if CancelBy = 02 - * - * @var string - */ + * The pickup request number (PRN) generated by UPS pickup system. + * Required if CancelBy = 02 + * + * @var string + */ protected $pRN; /** * Request Container. @@ -56,12 +56,12 @@ public function setRequest(PickupCancelRequestRequest $request): self return $this; } /** - * Cancel pickup by Pickup Request Number (PRN). - - 01= Account Number - - 02 = PRN - * - * @return string - */ + * Cancel pickup by Pickup Request Number (PRN). + * - 01= Account Number + * - 02 = PRN + * + * @return string + */ public function getCancelBy(): string { return $this->cancelBy; @@ -82,11 +82,11 @@ public function setCancelBy(string $cancelBy): self return $this; } /** - * The pickup request number (PRN) generated by UPS pickup system. - Required if CancelBy = 02 - * - * @return string - */ + * The pickup request number (PRN) generated by UPS pickup system. + * Required if CancelBy = 02 + * + * @return string + */ public function getPRN(): string { return $this->pRN; diff --git a/src/Api/Model/PickupCancelResponse.php b/src/Api/Model/PickupCancelResponse.php index ce2cabcf..303a5308 100644 --- a/src/Api/Model/PickupCancelResponse.php +++ b/src/Api/Model/PickupCancelResponse.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $response; /** - * The type of pickup that has been cancelled. - - 01 = On-Call Pickup - * - * @var string - */ + * The type of pickup that has been cancelled. + * - 01 = On-Call Pickup + * + * @var string + */ protected $pickupType; /** * The status of Smart Pickup that has been cancelled. @@ -54,11 +54,11 @@ public function setResponse(PickupCancelResponseResponse $response): self return $this; } /** - * The type of pickup that has been cancelled. - - 01 = On-Call Pickup - * - * @return string - */ + * The type of pickup that has been cancelled. + * - 01 = On-Call Pickup + * + * @return string + */ public function getPickupType(): string { return $this->pickupType; diff --git a/src/Api/Model/PickupCancelResponseGWNStatus.php b/src/Api/Model/PickupCancelResponseGWNStatus.php index e84c72b6..c965a75a 100644 --- a/src/Api/Model/PickupCancelResponseGWNStatus.php +++ b/src/Api/Model/PickupCancelResponseGWNStatus.php @@ -13,19 +13,19 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The status code defined by operation system. - - 001 = User Triggered - - 002 = User Cancelled - - 003 = Completed - - 004 = Missed - - 005 = Not In - - 006 = Not Ready - - 007 = Closed - - 008 = Cancelled By Driver - - 999 = Unknown - * - * @var string - */ + * The status code defined by operation system. + * - 001 = User Triggered + * - 002 = User Cancelled + * - 003 = Completed + * - 004 = Missed + * - 005 = Not In + * - 006 = Not Ready + * - 007 = Closed + * - 008 = Cancelled By Driver + * - 999 = Unknown + * + * @var string + */ protected $code; /** * Please refer to /PickupPendingStatusResponse/PendingStatus/PickupStatusMessage @@ -34,19 +34,19 @@ public function isInitialized($property): bool */ protected $description; /** - * The status code defined by operation system. - - 001 = User Triggered - - 002 = User Cancelled - - 003 = Completed - - 004 = Missed - - 005 = Not In - - 006 = Not Ready - - 007 = Closed - - 008 = Cancelled By Driver - - 999 = Unknown - * - * @return string - */ + * The status code defined by operation system. + * - 001 = User Triggered + * - 002 = User Cancelled + * - 003 = Completed + * - 004 = Missed + * - 005 = Not In + * - 006 = Not Ready + * - 007 = Closed + * - 008 = Cancelled By Driver + * - 999 = Unknown + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/PickupCreationRequest.php b/src/Api/Model/PickupCreationRequest.php index bfd6f014..e4a2b428 100644 --- a/src/Api/Model/PickupCreationRequest.php +++ b/src/Api/Model/PickupCreationRequest.php @@ -19,62 +19,62 @@ public function isInitialized($property): bool */ protected $request; /** - * Indicates whether to rate the on-callpickup or not. - Valid values: - Y = Rate this pickup - N = Do not rate this pickup (default) - * - * @var string - */ + * Indicates whether to rate the on-callpickup or not. + * Valid values: + * Y = Rate this pickup + * N = Do not rate this pickup (default) + * + * @var string + */ protected $ratePickupIndicator; /** - * Rate Type with which pickup is rated. Possible RateChart values for different regions will be: - - US 48 origin: - - 1 – Daily Rates - - 3 – Standard List Rates - - 4 – Retail Rates. - - Alaska/Hawaii origin: - - 1 – Daily Rates - - 3 – Standard List Rates - - 4 – Retail Rates. - - All Other origins: - - 1 – Rates - - 5 - Regional Rates - - 6 - General List Rates. - - 3 and 4 do not apply - - * - * @var string - */ + * Rate Type with which pickup is rated. Possible RateChart values for different regions will be: + * + * US 48 origin: + * - 1 – Daily Rates + * - 3 – Standard List Rates + * - 4 – Retail Rates. + * + * Alaska/Hawaii origin: + * - 1 – Daily Rates + * - 3 – Standard List Rates + * - 4 – Retail Rates. + * + * All Other origins: + * - 1 – Rates + * - 5 - Regional Rates + * - 6 - General List Rates. + * + * 3 and 4 do not apply + * + * + * @var string + */ protected $rateChartType; /** - * Indicates whether to return detailed taxes for the on-callpickups. - Valid values: - Y = Rate this pickup with taxes - N = Do not rate this pickup with taxes (default) - * - * @var string - */ + * Indicates whether to return detailed taxes for the on-callpickups. + * Valid values: + * Y = Rate this pickup with taxes + * N = Do not rate this pickup with taxes (default) + * + * @var string + */ protected $taxInformationIndicator; /** - * Indicates whether to return user level promo discount for the on-callpickups. - Valid values: - Y = Rate this pickup with user level promo discount - N = Do not rate this pickup with user level promo discount(default) - * - * @var string - */ + * Indicates whether to return user level promo discount for the on-callpickups. + * Valid values: + * Y = Rate this pickup with user level promo discount + * N = Do not rate this pickup with user level promo discount(default) + * + * @var string + */ protected $userLevelDiscountIndicator; /** - * On-call pickup shipper or requestor information. Must provide when choose to pay the pickup by shipper account number, BillThirdParty account number, or BillReceiver account number. - It is optional if the shipper chooses any other payment method. However, it is highly recommended to provide if available. - * - * @var PickupCreationRequestShipper - */ + * On-call pickup shipper or requestor information. Must provide when choose to pay the pickup by shipper account number, BillThirdParty account number, or BillReceiver account number. + * It is optional if the shipper chooses any other payment method. However, it is highly recommended to provide if available. + * + * @var PickupCreationRequestShipper + */ protected $shipper; /** * The container of desired pickup date @@ -89,17 +89,15 @@ public function isInitialized($property): bool */ protected $pickupAddress; /** - * Indicates if pickup address is a different address than that specified in a customer's profile. - Valid values: - Y = Alternate address - N = Original pickup address (default) - * - * @var string - */ + * Indicates if pickup address is a different address than that specified in a customer's profile. + * Valid values: + * Y = Alternate address + * N = Original pickup address (default) + * + * @var string + */ protected $alternateAddressIndicator; /** - * - * * @var list */ protected $pickupPiece; @@ -110,17 +108,15 @@ public function isInitialized($property): bool */ protected $totalWeight; /** - * Indicates if at least any package is over 70 lbs or 32 kgs. - Valid values: - Y = Over weight - N = Not over weight (default) Not required for WWEF service. - * - * @var string - */ + * Indicates if at least any package is over 70 lbs or 32 kgs. + * Valid values: + * Y = Over weight + * N = Not over weight (default) Not required for WWEF service. + * + * @var string + */ protected $overweightIndicator; /** - * - * * @var list */ protected $trackingData; @@ -131,23 +127,23 @@ public function isInitialized($property): bool */ protected $trackingDataWithReferenceNumber; /** - * The payment method to pay for this on call pickup. - 00 = No payment needed - 01 = Pay by shipper account - 03 = Pay by charge card - 04 = Pay by 1Z tracking number - 05 = Pay by check or money order - 06 = Cash(applicable only for these countries - BE,FR,DE,IT,MX,NL,PL,ES,GB,CZ,HU,FI,NO) - 07=Pay by PayPal - Refer to Appendix # for valid payment methods for CZ, HU, FI and NO - For countries and (or) zip codes where pickup is free of charge, please submit 00, means no payment needed as payment method. - - If 01 is the payment method, then ShipperAccountNumber and ShipperAccount CountryCode must be provided. - - If 03 is selected, then CreditCard information should be provided. - - If 04 is selected, then the shipper agreed to pay for the pickup packages. - - If 05 is selected, then the shipper will pay for the pickup packages with a check or money order. - * - * @var string - */ + * The payment method to pay for this on call pickup. + * 00 = No payment needed + * 01 = Pay by shipper account + * 03 = Pay by charge card + * 04 = Pay by 1Z tracking number + * 05 = Pay by check or money order + * 06 = Cash(applicable only for these countries - BE,FR,DE,IT,MX,NL,PL,ES,GB,CZ,HU,FI,NO) + * 07=Pay by PayPal + * Refer to Appendix # for valid payment methods for CZ, HU, FI and NO + * For countries and (or) zip codes where pickup is free of charge, please submit 00, means no payment needed as payment method. + * - If 01 is the payment method, then ShipperAccountNumber and ShipperAccount CountryCode must be provided. + * - If 03 is selected, then CreditCard information should be provided. + * - If 04 is selected, then the shipper agreed to pay for the pickup packages. + * - If 05 is selected, then the shipper will pay for the pickup packages with a check or money order. + * + * @var string + */ protected $paymentMethod; /** * Special handling instruction from the customer @@ -168,28 +164,28 @@ public function isInitialized($property): bool */ protected $freightOptions; /** - * Service Category. - Applicable to the following countries: - BE, FR, DE, IT, MX, NL, PL, ES, GB - Valid values: - 01 - domestic (default) - 02 - international - 03 - transborder - * - * @var string - */ + * Service Category. + * Applicable to the following countries: + * BE, FR, DE, IT, MX, NL, PL, ES, GB + * Valid values: + * 01 - domestic (default) + * 02 - international + * 03 - transborder + * + * @var string + */ protected $serviceCategory; /** - * Describes the type of cash funds that the driver will collect. - Applicable to the following countries: - BE,FR,DE,IT,MX,NL,PL,ES,GB - Valid values: - 01 - Pickup only (default) - 02 - Transportation only - 03 - Pickup and Transportation - * - * @var string - */ + * Describes the type of cash funds that the driver will collect. + * Applicable to the following countries: + * BE,FR,DE,IT,MX,NL,PL,ES,GB + * Valid values: + * 01 - Pickup only (default) + * 02 - Transportation only + * 03 - Pickup and Transportation + * + * @var string + */ protected $cashType; /** * This element should be set to "Y" in the request to indicate that user has pre-printed shipping labels for all the packages, otherwise this will be treated as false. @@ -220,13 +216,13 @@ public function setRequest(PickupCreationRequestRequest $request): self return $this; } /** - * Indicates whether to rate the on-callpickup or not. - Valid values: - Y = Rate this pickup - N = Do not rate this pickup (default) - * - * @return string - */ + * Indicates whether to rate the on-callpickup or not. + * Valid values: + * Y = Rate this pickup + * N = Do not rate this pickup (default) + * + * @return string + */ public function getRatePickupIndicator(): string { return $this->ratePickupIndicator; @@ -248,28 +244,28 @@ public function setRatePickupIndicator(string $ratePickupIndicator): self return $this; } /** - * Rate Type with which pickup is rated. Possible RateChart values for different regions will be: - - US 48 origin: - - 1 – Daily Rates - - 3 – Standard List Rates - - 4 – Retail Rates. - - Alaska/Hawaii origin: - - 1 – Daily Rates - - 3 – Standard List Rates - - 4 – Retail Rates. - - All Other origins: - - 1 – Rates - - 5 - Regional Rates - - 6 - General List Rates. - - 3 and 4 do not apply - - * - * @return string - */ + * Rate Type with which pickup is rated. Possible RateChart values for different regions will be: + * + * US 48 origin: + * - 1 – Daily Rates + * - 3 – Standard List Rates + * - 4 – Retail Rates. + * + * Alaska/Hawaii origin: + * - 1 – Daily Rates + * - 3 – Standard List Rates + * - 4 – Retail Rates. + * + * All Other origins: + * - 1 – Rates + * - 5 - Regional Rates + * - 6 - General List Rates. + * + * 3 and 4 do not apply + * + * + * @return string + */ public function getRateChartType(): string { return $this->rateChartType; @@ -306,13 +302,13 @@ public function setRateChartType(string $rateChartType): self return $this; } /** - * Indicates whether to return detailed taxes for the on-callpickups. - Valid values: - Y = Rate this pickup with taxes - N = Do not rate this pickup with taxes (default) - * - * @return string - */ + * Indicates whether to return detailed taxes for the on-callpickups. + * Valid values: + * Y = Rate this pickup with taxes + * N = Do not rate this pickup with taxes (default) + * + * @return string + */ public function getTaxInformationIndicator(): string { return $this->taxInformationIndicator; @@ -334,13 +330,13 @@ public function setTaxInformationIndicator(string $taxInformationIndicator): sel return $this; } /** - * Indicates whether to return user level promo discount for the on-callpickups. - Valid values: - Y = Rate this pickup with user level promo discount - N = Do not rate this pickup with user level promo discount(default) - * - * @return string - */ + * Indicates whether to return user level promo discount for the on-callpickups. + * Valid values: + * Y = Rate this pickup with user level promo discount + * N = Do not rate this pickup with user level promo discount(default) + * + * @return string + */ public function getUserLevelDiscountIndicator(): string { return $this->userLevelDiscountIndicator; @@ -362,11 +358,11 @@ public function setUserLevelDiscountIndicator(string $userLevelDiscountIndicator return $this; } /** - * On-call pickup shipper or requestor information. Must provide when choose to pay the pickup by shipper account number, BillThirdParty account number, or BillReceiver account number. - It is optional if the shipper chooses any other payment method. However, it is highly recommended to provide if available. - * - * @return PickupCreationRequestShipper - */ + * On-call pickup shipper or requestor information. Must provide when choose to pay the pickup by shipper account number, BillThirdParty account number, or BillReceiver account number. + * It is optional if the shipper chooses any other payment method. However, it is highly recommended to provide if available. + * + * @return PickupCreationRequestShipper + */ public function getShipper(): PickupCreationRequestShipper { return $this->shipper; @@ -430,13 +426,13 @@ public function setPickupAddress(PickupCreationRequestPickupAddress $pickupAddre return $this; } /** - * Indicates if pickup address is a different address than that specified in a customer's profile. - Valid values: - Y = Alternate address - N = Original pickup address (default) - * - * @return string - */ + * Indicates if pickup address is a different address than that specified in a customer's profile. + * Valid values: + * Y = Alternate address + * N = Original pickup address (default) + * + * @return string + */ public function getAlternateAddressIndicator(): string { return $this->alternateAddressIndicator; @@ -458,8 +454,6 @@ public function setAlternateAddressIndicator(string $alternateAddressIndicator): return $this; } /** - * - * * @return list */ public function getPickupPiece(): array @@ -467,8 +461,6 @@ public function getPickupPiece(): array return $this->pickupPiece; } /** - * - * * @param list $pickupPiece * * @return self @@ -502,13 +494,13 @@ public function setTotalWeight(PickupCreationRequestTotalWeight $totalWeight): s return $this; } /** - * Indicates if at least any package is over 70 lbs or 32 kgs. - Valid values: - Y = Over weight - N = Not over weight (default) Not required for WWEF service. - * - * @return string - */ + * Indicates if at least any package is over 70 lbs or 32 kgs. + * Valid values: + * Y = Over weight + * N = Not over weight (default) Not required for WWEF service. + * + * @return string + */ public function getOverweightIndicator(): string { return $this->overweightIndicator; @@ -530,8 +522,6 @@ public function setOverweightIndicator(string $overweightIndicator): self return $this; } /** - * - * * @return list */ public function getTrackingData(): array @@ -539,8 +529,6 @@ public function getTrackingData(): array return $this->trackingData; } /** - * - * * @param list $trackingData * * @return self @@ -574,23 +562,23 @@ public function setTrackingDataWithReferenceNumber(PickupCreationRequestTracking return $this; } /** - * The payment method to pay for this on call pickup. - 00 = No payment needed - 01 = Pay by shipper account - 03 = Pay by charge card - 04 = Pay by 1Z tracking number - 05 = Pay by check or money order - 06 = Cash(applicable only for these countries - BE,FR,DE,IT,MX,NL,PL,ES,GB,CZ,HU,FI,NO) - 07=Pay by PayPal - Refer to Appendix # for valid payment methods for CZ, HU, FI and NO - For countries and (or) zip codes where pickup is free of charge, please submit 00, means no payment needed as payment method. - - If 01 is the payment method, then ShipperAccountNumber and ShipperAccount CountryCode must be provided. - - If 03 is selected, then CreditCard information should be provided. - - If 04 is selected, then the shipper agreed to pay for the pickup packages. - - If 05 is selected, then the shipper will pay for the pickup packages with a check or money order. - * - * @return string - */ + * The payment method to pay for this on call pickup. + * 00 = No payment needed + * 01 = Pay by shipper account + * 03 = Pay by charge card + * 04 = Pay by 1Z tracking number + * 05 = Pay by check or money order + * 06 = Cash(applicable only for these countries - BE,FR,DE,IT,MX,NL,PL,ES,GB,CZ,HU,FI,NO) + * 07=Pay by PayPal + * Refer to Appendix # for valid payment methods for CZ, HU, FI and NO + * For countries and (or) zip codes where pickup is free of charge, please submit 00, means no payment needed as payment method. + * - If 01 is the payment method, then ShipperAccountNumber and ShipperAccount CountryCode must be provided. + * - If 03 is selected, then CreditCard information should be provided. + * - If 04 is selected, then the shipper agreed to pay for the pickup packages. + * - If 05 is selected, then the shipper will pay for the pickup packages with a check or money order. + * + * @return string + */ public function getPaymentMethod(): string { return $this->paymentMethod; @@ -688,16 +676,16 @@ public function setFreightOptions(PickupCreationRequestFreightOptions $freightOp return $this; } /** - * Service Category. - Applicable to the following countries: - BE, FR, DE, IT, MX, NL, PL, ES, GB - Valid values: - 01 - domestic (default) - 02 - international - 03 - transborder - * - * @return string - */ + * Service Category. + * Applicable to the following countries: + * BE, FR, DE, IT, MX, NL, PL, ES, GB + * Valid values: + * 01 - domestic (default) + * 02 - international + * 03 - transborder + * + * @return string + */ public function getServiceCategory(): string { return $this->serviceCategory; @@ -722,16 +710,16 @@ public function setServiceCategory(string $serviceCategory): self return $this; } /** - * Describes the type of cash funds that the driver will collect. - Applicable to the following countries: - BE,FR,DE,IT,MX,NL,PL,ES,GB - Valid values: - 01 - Pickup only (default) - 02 - Transportation only - 03 - Pickup and Transportation - * - * @return string - */ + * Describes the type of cash funds that the driver will collect. + * Applicable to the following countries: + * BE,FR,DE,IT,MX,NL,PL,ES,GB + * Valid values: + * 01 - Pickup only (default) + * 02 - Transportation only + * 03 - Pickup and Transportation + * + * @return string + */ public function getCashType(): string { return $this->cashType; diff --git a/src/Api/Model/PickupCreationRequestPickupAddress.php b/src/Api/Model/PickupCreationRequestPickupAddress.php index 71fa307f..a23a2db7 100644 --- a/src/Api/Model/PickupCreationRequestPickupAddress.php +++ b/src/Api/Model/PickupCreationRequestPickupAddress.php @@ -55,12 +55,12 @@ public function isInitialized($property): bool */ protected $stateProvince; /** - * - Barrio for Mexico (MX) - - Urbanization for Puerto Rico (PR) - - Shire for United Kingdom (UK) - * - * @var string - */ + * - Barrio for Mexico (MX) + * - Urbanization for Puerto Rico (PR) + * - Shire for United Kingdom (UK) + * + * @var string + */ protected $urbanization; /** * Postal code or equivalent for postal countries @@ -69,20 +69,20 @@ public function isInitialized($property): bool */ protected $postalCode; /** - * The pickup country or territory code as defined by ISO-3166. - Refer to Country or Territory Codes in the Appendix for valid values. - * - * @var string - */ + * The pickup country or territory code as defined by ISO-3166. + * Refer to Country or Territory Codes in the Appendix for valid values. + * + * @var string + */ protected $countryCode; /** - * Indicates if the pickup address is commercial or residential. - Valid values: - Y = Residential address - N = Non-residential (Commercial) address (default) - * - * @var string - */ + * Indicates if the pickup address is commercial or residential. + * Valid values: + * Y = Residential address + * N = Non-residential (Commercial) address (default) + * + * @var string + */ protected $residentialIndicator; /** * The specific spot to pickup at the address. @@ -251,12 +251,12 @@ public function setStateProvince(string $stateProvince): self return $this; } /** - * - Barrio for Mexico (MX) - - Urbanization for Puerto Rico (PR) - - Shire for United Kingdom (UK) - * - * @return string - */ + * - Barrio for Mexico (MX) + * - Urbanization for Puerto Rico (PR) + * - Shire for United Kingdom (UK) + * + * @return string + */ public function getUrbanization(): string { return $this->urbanization; @@ -299,11 +299,11 @@ public function setPostalCode(string $postalCode): self return $this; } /** - * The pickup country or territory code as defined by ISO-3166. - Refer to Country or Territory Codes in the Appendix for valid values. - * - * @return string - */ + * The pickup country or territory code as defined by ISO-3166. + * Refer to Country or Territory Codes in the Appendix for valid values. + * + * @return string + */ public function getCountryCode(): string { return $this->countryCode; @@ -323,13 +323,13 @@ public function setCountryCode(string $countryCode): self return $this; } /** - * Indicates if the pickup address is commercial or residential. - Valid values: - Y = Residential address - N = Non-residential (Commercial) address (default) - * - * @return string - */ + * Indicates if the pickup address is commercial or residential. + * Valid values: + * Y = Residential address + * N = Non-residential (Commercial) address (default) + * + * @return string + */ public function getResidentialIndicator(): string { return $this->residentialIndicator; diff --git a/src/Api/Model/PickupCreationRequestPickupDateInfo.php b/src/Api/Model/PickupCreationRequestPickupDateInfo.php index ce2df2b0..35eb4e51 100644 --- a/src/Api/Model/PickupCreationRequestPickupDateInfo.php +++ b/src/Api/Model/PickupCreationRequestPickupDateInfo.php @@ -13,56 +13,56 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Pickup location's local close time. - - User provided Close Time must be later than the Earliest Allowed Customer Close Time. - - Earliest Allowed Customer Close Time is defined by UPS pickup operation system. - - CloseTime minus ReadyTime must be greater than the LeadTime. - - LeadTime is determined by UPS pickup operation system. LeadTime is the minimum amount of time UPS requires between customer's request for a pickup and driver arriving at the location for the pickup. - - Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - - * - * @var string - */ + * Pickup location's local close time. + * - User provided Close Time must be later than the Earliest Allowed Customer Close Time. + * - Earliest Allowed Customer Close Time is defined by UPS pickup operation system. + * - CloseTime minus ReadyTime must be greater than the LeadTime. + * - LeadTime is determined by UPS pickup operation system. LeadTime is the minimum amount of time UPS requires between customer's request for a pickup and driver arriving at the location for the pickup. + * + * Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * + * @var string + */ protected $closeTime; /** - * Pickup location's local ready time. - ReadyTime means the time when your shipment(s) can be ready for UPS to pick up. - - User provided ReadyTime must be earlier than CallByTime. - - CallByTime is determined by UPS pickup operation system. CallByTime is the Latest time a Customer can call UPS or self-serve on UPS.com and complete a Pickup Request and UPS can still make the Pickup service request. - - If ReadyTime is earlier than current local time, UPS uses the current local time as the ReadyTime. Format: HHmm - Hour: 0-23 - Minute: 0-59 - * - * @var string - */ + * Pickup location's local ready time. + * ReadyTime means the time when your shipment(s) can be ready for UPS to pick up. + * - User provided ReadyTime must be earlier than CallByTime. + * - CallByTime is determined by UPS pickup operation system. CallByTime is the Latest time a Customer can call UPS or self-serve on UPS.com and complete a Pickup Request and UPS can still make the Pickup service request. + * - If ReadyTime is earlier than current local time, UPS uses the current local time as the ReadyTime. Format: HHmm + * Hour: 0-23 + * Minute: 0-59 + * + * @var string + */ protected $readyTime; /** - * Local pickup date of the location. Format: yyyyMMdd - - yyyy = Year Appliable - - MM = 01–12 - - dd = 01–31 - - * - * @var string - */ + * Local pickup date of the location. Format: yyyyMMdd + * - yyyy = Year Appliable + * - MM = 01–12 + * - dd = 01–31 + * + * + * @var string + */ protected $pickupDate; /** - * Pickup location's local close time. - - User provided Close Time must be later than the Earliest Allowed Customer Close Time. - - Earliest Allowed Customer Close Time is defined by UPS pickup operation system. - - CloseTime minus ReadyTime must be greater than the LeadTime. - - LeadTime is determined by UPS pickup operation system. LeadTime is the minimum amount of time UPS requires between customer's request for a pickup and driver arriving at the location for the pickup. - - Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - - * - * @return string - */ + * Pickup location's local close time. + * - User provided Close Time must be later than the Earliest Allowed Customer Close Time. + * - Earliest Allowed Customer Close Time is defined by UPS pickup operation system. + * - CloseTime minus ReadyTime must be greater than the LeadTime. + * - LeadTime is determined by UPS pickup operation system. LeadTime is the minimum amount of time UPS requires between customer's request for a pickup and driver arriving at the location for the pickup. + * + * Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * + * @return string + */ public function getCloseTime(): string { return $this->closeTime; @@ -90,16 +90,16 @@ public function setCloseTime(string $closeTime): self return $this; } /** - * Pickup location's local ready time. - ReadyTime means the time when your shipment(s) can be ready for UPS to pick up. - - User provided ReadyTime must be earlier than CallByTime. - - CallByTime is determined by UPS pickup operation system. CallByTime is the Latest time a Customer can call UPS or self-serve on UPS.com and complete a Pickup Request and UPS can still make the Pickup service request. - - If ReadyTime is earlier than current local time, UPS uses the current local time as the ReadyTime. Format: HHmm - Hour: 0-23 - Minute: 0-59 - * - * @return string - */ + * Pickup location's local ready time. + * ReadyTime means the time when your shipment(s) can be ready for UPS to pick up. + * - User provided ReadyTime must be earlier than CallByTime. + * - CallByTime is determined by UPS pickup operation system. CallByTime is the Latest time a Customer can call UPS or self-serve on UPS.com and complete a Pickup Request and UPS can still make the Pickup service request. + * - If ReadyTime is earlier than current local time, UPS uses the current local time as the ReadyTime. Format: HHmm + * Hour: 0-23 + * Minute: 0-59 + * + * @return string + */ public function getReadyTime(): string { return $this->readyTime; @@ -124,14 +124,14 @@ public function setReadyTime(string $readyTime): self return $this; } /** - * Local pickup date of the location. Format: yyyyMMdd - - yyyy = Year Appliable - - MM = 01–12 - - dd = 01–31 - - * - * @return string - */ + * Local pickup date of the location. Format: yyyyMMdd + * - yyyy = Year Appliable + * - MM = 01–12 + * - dd = 01–31 + * + * + * @return string + */ public function getPickupDate(): string { return $this->pickupDate; diff --git a/src/Api/Model/PickupCreationRequestPickupPiece.php b/src/Api/Model/PickupCreationRequestPickupPiece.php index a81b0834..339214a2 100644 --- a/src/Api/Model/PickupCreationRequestPickupPiece.php +++ b/src/Api/Model/PickupCreationRequestPickupPiece.php @@ -19,30 +19,30 @@ public function isInitialized($property): bool */ protected $serviceCode; /** - * Number of pieces to be picked up. - Max per service: 999 - * - * @var string - */ + * Number of pieces to be picked up. + * Max per service: 999 + * + * @var string + */ protected $quantity; /** - * The destination country code as defined by ISO-3166. - Refer to Country or Territory Codes in the Appendix for valid values. - * - * @var string - */ + * The destination country code as defined by ISO-3166. + * Refer to Country or Territory Codes in the Appendix for valid values. + * + * @var string + */ protected $destinationCountryCode; /** - * Container type. Valid values: - - 01 = PACKAGE - - 02 = UPS LETTER - - 03 = PALLET - - Note: 03 is used for only WWEF services - - * - * @var string - */ + * Container type. Valid values: + * - 01 = PACKAGE + * - 02 = UPS LETTER + * - 03 = PALLET + * + * Note: 03 is used for only WWEF services + * + * + * @var string + */ protected $containerCode; /** * Refer to Service Codes in the Appendix for valid values. @@ -67,11 +67,11 @@ public function setServiceCode(string $serviceCode): self return $this; } /** - * Number of pieces to be picked up. - Max per service: 999 - * - * @return string - */ + * Number of pieces to be picked up. + * Max per service: 999 + * + * @return string + */ public function getQuantity(): string { return $this->quantity; @@ -91,11 +91,11 @@ public function setQuantity(string $quantity): self return $this; } /** - * The destination country code as defined by ISO-3166. - Refer to Country or Territory Codes in the Appendix for valid values. - * - * @return string - */ + * The destination country code as defined by ISO-3166. + * Refer to Country or Territory Codes in the Appendix for valid values. + * + * @return string + */ public function getDestinationCountryCode(): string { return $this->destinationCountryCode; @@ -115,16 +115,16 @@ public function setDestinationCountryCode(string $destinationCountryCode): self return $this; } /** - * Container type. Valid values: - - 01 = PACKAGE - - 02 = UPS LETTER - - 03 = PALLET - - Note: 03 is used for only WWEF services - - * - * @return string - */ + * Container type. Valid values: + * - 01 = PACKAGE + * - 02 = UPS LETTER + * - 03 = PALLET + * + * Note: 03 is used for only WWEF services + * + * + * @return string + */ public function getContainerCode(): string { return $this->containerCode; diff --git a/src/Api/Model/PickupCreationRequestRequest.php b/src/Api/Model/PickupCreationRequestRequest.php index 308c4500..f189e501 100644 --- a/src/Api/Model/PickupCreationRequestRequest.php +++ b/src/Api/Model/PickupCreationRequestRequest.php @@ -13,17 +13,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. Supported values: 1607, 1707,2007 - - Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. - - Format: YYMM = Year and month of the release. - Example: 1601 = 2016 January - * - * @var string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. Supported values: 1607, 1707,2007 + * + * Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. + * + * Format: YYMM = Year and month of the release. + * Example: 1601 = 2016 January + * + * @var string + */ protected $subVersion; /** * TransactionReference identifies transactions between client and server. @@ -32,17 +32,17 @@ public function isInitialized($property): bool */ protected $transactionReference; /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. Supported values: 1607, 1707,2007 - - Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. - - Format: YYMM = Year and month of the release. - Example: 1601 = 2016 January - * - * @return string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. Supported values: 1607, 1707,2007 + * + * Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. + * + * Format: YYMM = Year and month of the release. + * Example: 1601 = 2016 January + * + * @return string + */ public function getSubVersion(): string { return $this->subVersion; diff --git a/src/Api/Model/PickupCreationRequestShipper.php b/src/Api/Model/PickupCreationRequestShipper.php index 5d06bdec..3219452e 100644 --- a/src/Api/Model/PickupCreationRequestShipper.php +++ b/src/Api/Model/PickupCreationRequestShipper.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Shipper account information. - Must provide when choose to pay the pickup by shipper account number - * - * @var ShipperAccount - */ + * Shipper account information. + * Must provide when choose to pay the pickup by shipper account number + * + * @var ShipperAccount + */ protected $account; /** * Container for Charge Card payment method Required if Payment method is 03. Credit/Charge card payment is valid for US, CA, PR and GB origin pickups. @@ -26,11 +26,11 @@ public function isInitialized($property): bool */ protected $chargeCard; /** - * Shipper account information. - Must provide when choose to pay the pickup by shipper account number - * - * @return ShipperAccount - */ + * Shipper account information. + * Must provide when choose to pay the pickup by shipper account number + * + * @return ShipperAccount + */ public function getAccount(): ShipperAccount { return $this->account; diff --git a/src/Api/Model/PickupCreationRequestTotalWeight.php b/src/Api/Model/PickupCreationRequestTotalWeight.php index 06549944..83653920 100644 --- a/src/Api/Model/PickupCreationRequestTotalWeight.php +++ b/src/Api/Model/PickupCreationRequestTotalWeight.php @@ -13,26 +13,26 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The weight of the package. - One decimal digit is allowed. Example: 10.9 - * - * @var string - */ + * The weight of the package. + * One decimal digit is allowed. Example: 10.9 + * + * @var string + */ protected $weight; /** - * The code representing the unit of measurement associated with the package. - LBS = Pounds - KGS = Kilograms - * - * @var string - */ + * The code representing the unit of measurement associated with the package. + * LBS = Pounds + * KGS = Kilograms + * + * @var string + */ protected $unitOfMeasurement; /** - * The weight of the package. - One decimal digit is allowed. Example: 10.9 - * - * @return string - */ + * The weight of the package. + * One decimal digit is allowed. Example: 10.9 + * + * @return string + */ public function getWeight(): string { return $this->weight; @@ -52,12 +52,12 @@ public function setWeight(string $weight): self return $this; } /** - * The code representing the unit of measurement associated with the package. - LBS = Pounds - KGS = Kilograms - * - * @return string - */ + * The code representing the unit of measurement associated with the package. + * LBS = Pounds + * KGS = Kilograms + * + * @return string + */ public function getUnitOfMeasurement(): string { return $this->unitOfMeasurement; diff --git a/src/Api/Model/PickupCreationResponse.php b/src/Api/Model/PickupCreationResponse.php index c548661e..c610d8bf 100644 --- a/src/Api/Model/PickupCreationResponse.php +++ b/src/Api/Model/PickupCreationResponse.php @@ -31,12 +31,12 @@ public function isInitialized($property): bool */ protected $weekendServiceTerritory; /** - * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 1607. Valid Values: - - Y = WST - - N = Non-WST - * - * @var string - */ + * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 1607. Valid Values: + * - Y = WST + * - N = Non-WST + * + * @var string + */ protected $weekendServiceTerritoryIndicator; /** * The rating result of on-callpickup @@ -117,12 +117,12 @@ public function setWeekendServiceTerritory(PickupCreationResponseWeekendServiceT return $this; } /** - * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 1607. Valid Values: - - Y = WST - - N = Non-WST - * - * @return string - */ + * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 1607. Valid Values: + * - Y = WST + * - N = Non-WST + * + * @return string + */ public function getWeekendServiceTerritoryIndicator(): string { return $this->weekendServiceTerritoryIndicator; diff --git a/src/Api/Model/PickupCreationResponseRateResult.php b/src/Api/Model/PickupCreationResponseRateResult.php index f5b05791..46588796 100644 --- a/src/Api/Model/PickupCreationResponseRateResult.php +++ b/src/Api/Model/PickupCreationResponseRateResult.php @@ -19,12 +19,12 @@ public function isInitialized($property): bool */ protected $disclaimer; /** - * Indicates this pickup is rated as same-day or future-day pickup. - - SD = Same-day Pickup - - FD = Future-day Pickup - * - * @var string - */ + * Indicates this pickup is rated as same-day or future-day pickup. + * - SD = Same-day Pickup + * - FD = Future-day Pickup + * + * @var string + */ protected $rateType; /** * IATA currency codes for the pickup charge. Such as USD @@ -34,14 +34,18 @@ public function isInitialized($property): bool protected $currencyCode; /** * Container to hold taxes when, detailed taxes are request via RateTaxIndicator. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $chargeDetail; /** * Container to hold taxes when, detailed taxes are request via RateTaxIndicator. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -99,12 +103,12 @@ public function setDisclaimer(RateResultDisclaimer $disclaimer): self return $this; } /** - * Indicates this pickup is rated as same-day or future-day pickup. - - SD = Same-day Pickup - - FD = Future-day Pickup - * - * @return string - */ + * Indicates this pickup is rated as same-day or future-day pickup. + * - SD = Same-day Pickup + * - FD = Future-day Pickup + * + * @return string + */ public function getRateType(): string { return $this->rateType; @@ -148,7 +152,9 @@ public function setCurrencyCode(string $currencyCode): self } /** * Container to hold taxes when, detailed taxes are request via RateTaxIndicator. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -172,7 +178,9 @@ public function setChargeDetail(array $chargeDetail): self } /** * Container to hold taxes when, detailed taxes are request via RateTaxIndicator. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/PickupCreationResponseRateStatus.php b/src/Api/Model/PickupCreationResponseRateStatus.php index 12030788..439779a6 100644 --- a/src/Api/Model/PickupCreationResponseRateStatus.php +++ b/src/Api/Model/PickupCreationResponseRateStatus.php @@ -13,19 +13,19 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The rating status. - - 01 = Rate available - - 02 = Rate not available - - 03 = Rate not apply - - 04 = Rate not requested - - - If 01 is returned, then OnCallPickupRateResult will also be returned with rate details. - - If 02 is returned, then OnCallPickupRateResult will not be returned. - - If 03 is returned, then OnCallPickupRateResult will not be returned. The rate option is not appliable to this return pickup. The requester will not be charged. - - If 04 is returned, then OnCallPickupRateResult will not be returned. The requester did not ask for rating this on-callpickup. - * - * @var string - */ + * The rating status. + * - 01 = Rate available + * - 02 = Rate not available + * - 03 = Rate not apply + * - 04 = Rate not requested + * + * - If 01 is returned, then OnCallPickupRateResult will also be returned with rate details. + * - If 02 is returned, then OnCallPickupRateResult will not be returned. + * - If 03 is returned, then OnCallPickupRateResult will not be returned. The rate option is not appliable to this return pickup. The requester will not be charged. + * - If 04 is returned, then OnCallPickupRateResult will not be returned. The requester did not ask for rating this on-callpickup. + * + * @var string + */ protected $code; /** * The matching description of rating status code (see above). @@ -34,19 +34,19 @@ public function isInitialized($property): bool */ protected $description; /** - * The rating status. - - 01 = Rate available - - 02 = Rate not available - - 03 = Rate not apply - - 04 = Rate not requested - - - If 01 is returned, then OnCallPickupRateResult will also be returned with rate details. - - If 02 is returned, then OnCallPickupRateResult will not be returned. - - If 03 is returned, then OnCallPickupRateResult will not be returned. The rate option is not appliable to this return pickup. The requester will not be charged. - - If 04 is returned, then OnCallPickupRateResult will not be returned. The requester did not ask for rating this on-callpickup. - * - * @return string - */ + * The rating status. + * - 01 = Rate available + * - 02 = Rate not available + * - 03 = Rate not apply + * - 04 = Rate not requested + * + * - If 01 is returned, then OnCallPickupRateResult will also be returned with rate details. + * - If 02 is returned, then OnCallPickupRateResult will not be returned. + * - If 03 is returned, then OnCallPickupRateResult will not be returned. The rate option is not appliable to this return pickup. The requester will not be charged. + * - If 04 is returned, then OnCallPickupRateResult will not be returned. The requester did not ask for rating this on-callpickup. + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/PickupCreationResponseWeekendServiceTerritory.php b/src/Api/Model/PickupCreationResponseWeekendServiceTerritory.php index c766b076..bfbd81c8 100644 --- a/src/Api/Model/PickupCreationResponseWeekendServiceTerritory.php +++ b/src/Api/Model/PickupCreationResponseWeekendServiceTerritory.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 2007. Valid Values: - - Y = Saturday WST - - N = Non-Saturday WST - - * - * @var string - */ + * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 2007. Valid Values: + * - Y = Saturday WST + * - N = Non-Saturday WST + * + * + * @var string + */ protected $satWST; /** * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Sunday and subversion greater or equal to 2007. Valid Values: - Y = Sunday WST - N = Non-Sunday WST @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $sunWST; /** - * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 2007. Valid Values: - - Y = Saturday WST - - N = Non-Saturday WST - - * - * @return string - */ + * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 2007. Valid Values: + * - Y = Saturday WST + * - N = Non-Saturday WST + * + * + * @return string + */ public function getSatWST(): string { return $this->satWST; diff --git a/src/Api/Model/PickupFacilitiesAddress.php b/src/Api/Model/PickupFacilitiesAddress.php index 832ec831..2554f93d 100644 --- a/src/Api/Model/PickupFacilitiesAddress.php +++ b/src/Api/Model/PickupFacilitiesAddress.php @@ -43,13 +43,13 @@ public function isInitialized($property): bool */ protected $countryCode; /** - * Indicates if the pickup location is commerical or residential. - Valid values: - Y = Residential address - N = Non-residential (Commercial) address (default) - * - * @var string - */ + * Indicates if the pickup location is commerical or residential. + * Valid values: + * Y = Residential address + * N = Non-residential (Commercial) address (default) + * + * @var string + */ protected $residentialIndicator; /** * Address Line of the Facility. @@ -162,13 +162,13 @@ public function setCountryCode(string $countryCode): self return $this; } /** - * Indicates if the pickup location is commerical or residential. - Valid values: - Y = Residential address - N = Non-residential (Commercial) address (default) - * - * @return string - */ + * Indicates if the pickup location is commerical or residential. + * Valid values: + * Y = Residential address + * N = Non-residential (Commercial) address (default) + * + * @return string + */ public function getResidentialIndicator(): string { return $this->residentialIndicator; diff --git a/src/Api/Model/PickupFacilitiesFacilityTimeDayOfWeek.php b/src/Api/Model/PickupFacilitiesFacilityTimeDayOfWeek.php index 4d88e24c..6639e5fa 100644 --- a/src/Api/Model/PickupFacilitiesFacilityTimeDayOfWeek.php +++ b/src/Api/Model/PickupFacilitiesFacilityTimeDayOfWeek.php @@ -31,20 +31,20 @@ public function isInitialized($property): bool */ protected $latestDropOfforPickup; /** - * Facility Open Hours. The latest local open time. Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - * - * @var string - */ + * Facility Open Hours. The latest local open time. Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * @var string + */ protected $openHours; /** - * Facility Close Hours. The latest local close time. Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - * - * @var string - */ + * Facility Close Hours. The latest local close time. Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * @var string + */ protected $closeHours; /** * Preparation time for hold for pickup Conditionally required if request is for hold for pickup. @@ -125,12 +125,12 @@ public function setLatestDropOfforPickup(string $latestDropOfforPickup): self return $this; } /** - * Facility Open Hours. The latest local open time. Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - * - * @return string - */ + * Facility Open Hours. The latest local open time. Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * @return string + */ public function getOpenHours(): string { return $this->openHours; @@ -151,12 +151,12 @@ public function setOpenHours(string $openHours): self return $this; } /** - * Facility Close Hours. The latest local close time. Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - * - * @return string - */ + * Facility Close Hours. The latest local close time. Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * @return string + */ public function getCloseHours(): string { return $this->closeHours; diff --git a/src/Api/Model/PickupGetServiceCenterFacilitiesRequest.php b/src/Api/Model/PickupGetServiceCenterFacilitiesRequest.php index 35b8284e..a0ecedbc 100644 --- a/src/Api/Model/PickupGetServiceCenterFacilitiesRequest.php +++ b/src/Api/Model/PickupGetServiceCenterFacilitiesRequest.php @@ -19,8 +19,6 @@ public function isInitialized($property): bool */ protected $request; /** - * - * * @var list */ protected $pickupPiece; @@ -37,11 +35,11 @@ public function isInitialized($property): bool */ protected $destinationAddress; /** - * Origin Country or Territory Locale. Locale should be Origin Country. Example: en_US. - The Last 50 instruction will be send based on this locale. Locale is required if PoximityIndicator is present for Drop Off facilities. - * - * @var string - */ + * Origin Country or Territory Locale. Locale should be Origin Country. Example: en_US. + * The Last 50 instruction will be send based on this locale. Locale is required if PoximityIndicator is present for Drop Off facilities. + * + * @var string + */ protected $locale; /** * Proximity Indicator. Indicates the user requested the proximity search for UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday locations for the origin address and/or the airport code, and the sort code for destination address. @@ -72,8 +70,6 @@ public function setRequest(PickupGetServiceCenterFacilitiesRequestRequest $reque return $this; } /** - * - * * @return list */ public function getPickupPiece(): array @@ -81,8 +77,6 @@ public function getPickupPiece(): array return $this->pickupPiece; } /** - * - * * @param list $pickupPiece * * @return self @@ -138,11 +132,11 @@ public function setDestinationAddress(PickupGetServiceCenterFacilitiesRequestDes return $this; } /** - * Origin Country or Territory Locale. Locale should be Origin Country. Example: en_US. - The Last 50 instruction will be send based on this locale. Locale is required if PoximityIndicator is present for Drop Off facilities. - * - * @return string - */ + * Origin Country or Territory Locale. Locale should be Origin Country. Example: en_US. + * The Last 50 instruction will be send based on this locale. Locale is required if PoximityIndicator is present for Drop Off facilities. + * + * @return string + */ public function getLocale(): string { return $this->locale; diff --git a/src/Api/Model/PickupGetServiceCenterFacilitiesRequestDestinationAddress.php b/src/Api/Model/PickupGetServiceCenterFacilitiesRequestDestinationAddress.php index 9cd2138f..61988e60 100644 --- a/src/Api/Model/PickupGetServiceCenterFacilitiesRequestDestinationAddress.php +++ b/src/Api/Model/PickupGetServiceCenterFacilitiesRequestDestinationAddress.php @@ -19,13 +19,13 @@ public function isInitialized($property): bool */ protected $city; /** - * Indicates the address of the consignee to allow for the nearest Pickup facility Search. - 1 = District code for Hong Kong (HK) - 2 = County for Ireland (IE) - 3 = State or province for all the postal countries Required for non-postal countries including HK and IE. - * - * @var string - */ + * Indicates the address of the consignee to allow for the nearest Pickup facility Search. + * 1 = District code for Hong Kong (HK) + * 2 = County for Ireland (IE) + * 3 = State or province for all the postal countries Required for non-postal countries including HK and IE. + * + * @var string + */ protected $stateProvince; /** * Indicates the address of the consignee to allow for the nearest Pickup facility Search It does not apply to non-postal countries. Example: IE and HK. @@ -62,13 +62,13 @@ public function setCity(string $city): self return $this; } /** - * Indicates the address of the consignee to allow for the nearest Pickup facility Search. - 1 = District code for Hong Kong (HK) - 2 = County for Ireland (IE) - 3 = State or province for all the postal countries Required for non-postal countries including HK and IE. - * - * @return string - */ + * Indicates the address of the consignee to allow for the nearest Pickup facility Search. + * 1 = District code for Hong Kong (HK) + * 2 = County for Ireland (IE) + * 3 = State or province for all the postal countries Required for non-postal countries including HK and IE. + * + * @return string + */ public function getStateProvince(): string { return $this->stateProvince; diff --git a/src/Api/Model/PickupGetServiceCenterFacilitiesRequestPickupPiece.php b/src/Api/Model/PickupGetServiceCenterFacilitiesRequestPickupPiece.php index 3cea3d78..2a6458a2 100644 --- a/src/Api/Model/PickupGetServiceCenterFacilitiesRequestPickupPiece.php +++ b/src/Api/Model/PickupGetServiceCenterFacilitiesRequestPickupPiece.php @@ -13,25 +13,25 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The service code. - 96 = WWEF Required for WWEF shipments. - * - * @var string - */ + * The service code. + * 96 = WWEF Required for WWEF shipments. + * + * @var string + */ protected $serviceCode; /** - * The container type - 03 = PALLET Required for WWEF shipments. - * - * @var string - */ + * The container type + * 03 = PALLET Required for WWEF shipments. + * + * @var string + */ protected $containerCode; /** - * The service code. - 96 = WWEF Required for WWEF shipments. - * - * @return string - */ + * The service code. + * 96 = WWEF Required for WWEF shipments. + * + * @return string + */ public function getServiceCode(): string { return $this->serviceCode; @@ -51,11 +51,11 @@ public function setServiceCode(string $serviceCode): self return $this; } /** - * The container type - 03 = PALLET Required for WWEF shipments. - * - * @return string - */ + * The container type + * 03 = PALLET Required for WWEF shipments. + * + * @return string + */ public function getContainerCode(): string { return $this->containerCode; diff --git a/src/Api/Model/PickupGetServiceCenterFacilitiesResponseServiceCenterLocation.php b/src/Api/Model/PickupGetServiceCenterFacilitiesResponseServiceCenterLocation.php index f9080dfe..d64b0f95 100644 --- a/src/Api/Model/PickupGetServiceCenterFacilitiesResponseServiceCenterLocation.php +++ b/src/Api/Model/PickupGetServiceCenterFacilitiesResponseServiceCenterLocation.php @@ -13,8 +13,6 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $dropOffFacilities; @@ -25,8 +23,6 @@ public function isInitialized($property): bool */ protected $pickupFacilities; /** - * - * * @return list */ public function getDropOffFacilities(): array @@ -34,8 +30,6 @@ public function getDropOffFacilities(): array return $this->dropOffFacilities; } /** - * - * * @param list $dropOffFacilities * * @return self diff --git a/src/Api/Model/PickupNotificationsEMailNotification.php b/src/Api/Model/PickupNotificationsEMailNotification.php index 9cee9cca..83299378 100644 --- a/src/Api/Model/PickupNotificationsEMailNotification.php +++ b/src/Api/Model/PickupNotificationsEMailNotification.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $eMailAddress; /** - * Type of event for Pickup Notifications for LTL. Allows up to four events. - For valid values, see LTL Event Types in the Appendix. The values must match a type defined, case sensitive. - * - * @var list - */ + * Type of event for Pickup Notifications for LTL. Allows up to four events. + * For valid values, see LTL Event Types in the Appendix. The values must match a type defined, case sensitive. + * + * @var list + */ protected $eventType; /** * Email address which should receive pre-pickup notification @@ -48,11 +48,11 @@ public function setEMailAddress(string $eMailAddress): self return $this; } /** - * Type of event for Pickup Notifications for LTL. Allows up to four events. - For valid values, see LTL Event Types in the Appendix. The values must match a type defined, case sensitive. - * - * @return list - */ + * Type of event for Pickup Notifications for LTL. Allows up to four events. + * For valid values, see LTL Event Types in the Appendix. The values must match a type defined, case sensitive. + * + * @return list + */ public function getEventType(): array { return $this->eventType; diff --git a/src/Api/Model/PickupPendingStatusRequest.php b/src/Api/Model/PickupPendingStatusRequest.php index 6591b373..70780fa0 100644 --- a/src/Api/Model/PickupPendingStatusRequest.php +++ b/src/Api/Model/PickupPendingStatusRequest.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $request; /** - * Specify the type of pending pickup. - 01 = On-Call Pickup - * - * @var string - */ + * Specify the type of pending pickup. + * 01 = On-Call Pickup + * + * @var string + */ protected $pickupType; /** * The specific account number belongs to the shipper @@ -54,11 +54,11 @@ public function setRequest(PickupPendingStatusRequestRequest $request): self return $this; } /** - * Specify the type of pending pickup. - 01 = On-Call Pickup - * - * @return string - */ + * Specify the type of pending pickup. + * 01 = On-Call Pickup + * + * @return string + */ public function getPickupType(): string { return $this->pickupType; diff --git a/src/Api/Model/PickupPendingStatusResponse.php b/src/Api/Model/PickupPendingStatusResponse.php index b48d8b98..67336172 100644 --- a/src/Api/Model/PickupPendingStatusResponse.php +++ b/src/Api/Model/PickupPendingStatusResponse.php @@ -19,8 +19,6 @@ public function isInitialized($property): bool */ protected $response; /** - * - * * @var list */ protected $pendingStatus; @@ -47,8 +45,6 @@ public function setResponse(PickupPendingStatusResponseResponse $response): self return $this; } /** - * - * * @return list */ public function getPendingStatus(): array @@ -56,8 +52,6 @@ public function getPendingStatus(): array return $this->pendingStatus; } /** - * - * * @param list $pendingStatus * * @return self diff --git a/src/Api/Model/PickupPendingStatusResponsePendingStatus.php b/src/Api/Model/PickupPendingStatusResponsePendingStatus.php index 465c0ec4..0b8e618c 100644 --- a/src/Api/Model/PickupPendingStatusResponsePendingStatus.php +++ b/src/Api/Model/PickupPendingStatusResponsePendingStatus.php @@ -13,20 +13,20 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Specify the type of pending pickup. - - 01 = on-callPickup - * - * @var string - */ + * Specify the type of pending pickup. + * - 01 = on-callPickup + * + * @var string + */ protected $pickupType; /** - * Local service date. Format: yyyyMMdd - - yyyy = Year applicable - - MM = 01-12 - - dd = 01-31 - * - * @var string - */ + * Local service date. Format: yyyyMMdd + * - yyyy = Year applicable + * - MM = 01-12 + * - dd = 01-31 + * + * @var string + */ protected $serviceDate; /** * Returned PRN @@ -47,31 +47,31 @@ public function isInitialized($property): bool */ protected $onCallStatusCode; /** - * The status for on-callpickup. - - PickupPendingStatusResponse will only display incomplete status for today and tomorrow only. - - 002 and 012 are the most common responses. - - 001 = Received at dispatch - - 002 = Dispatched to driver - - 003 = Order successfully completed - - 004 = Order unsuccessfully completed - - 005 = Missed commit – Updated ETA supplied by driver - - 007 = Cancelled - - 008 = Order has invalid order status - - 012 = Your pickup request is being processed - - * - * @var string - */ + * The status for on-callpickup. + * + * PickupPendingStatusResponse will only display incomplete status for today and tomorrow only. + * - 002 and 012 are the most common responses. + * - 001 = Received at dispatch + * - 002 = Dispatched to driver + * - 003 = Order successfully completed + * - 004 = Order unsuccessfully completed + * - 005 = Missed commit – Updated ETA supplied by driver + * - 007 = Cancelled + * - 008 = Order has invalid order status + * - 012 = Your pickup request is being processed + * + * + * @var string + */ protected $pickupStatusMessage; /** - * Pickup billing classification for on call - - 01 = Regular - - 02 = Return - - 03 = Alternate Address (Not supported for now) - * - * @var string - */ + * Pickup billing classification for on call + * - 01 = Regular + * - 02 = Return + * - 03 = Alternate Address (Not supported for now) + * + * @var string + */ protected $billingCode; /** * on-callpickup contact name @@ -86,11 +86,11 @@ public function isInitialized($property): bool */ protected $referenceNumber; /** - * Specify the type of pending pickup. - - 01 = on-callPickup - * - * @return string - */ + * Specify the type of pending pickup. + * - 01 = on-callPickup + * + * @return string + */ public function getPickupType(): string { return $this->pickupType; @@ -110,13 +110,13 @@ public function setPickupType(string $pickupType): self return $this; } /** - * Local service date. Format: yyyyMMdd - - yyyy = Year applicable - - MM = 01-12 - - dd = 01-31 - * - * @return string - */ + * Local service date. Format: yyyyMMdd + * - yyyy = Year applicable + * - MM = 01-12 + * - dd = 01-31 + * + * @return string + */ public function getServiceDate(): string { return $this->serviceDate; @@ -204,22 +204,22 @@ public function setOnCallStatusCode(string $onCallStatusCode): self return $this; } /** - * The status for on-callpickup. - - PickupPendingStatusResponse will only display incomplete status for today and tomorrow only. - - 002 and 012 are the most common responses. - - 001 = Received at dispatch - - 002 = Dispatched to driver - - 003 = Order successfully completed - - 004 = Order unsuccessfully completed - - 005 = Missed commit – Updated ETA supplied by driver - - 007 = Cancelled - - 008 = Order has invalid order status - - 012 = Your pickup request is being processed - - * - * @return string - */ + * The status for on-callpickup. + * + * PickupPendingStatusResponse will only display incomplete status for today and tomorrow only. + * - 002 and 012 are the most common responses. + * - 001 = Received at dispatch + * - 002 = Dispatched to driver + * - 003 = Order successfully completed + * - 004 = Order unsuccessfully completed + * - 005 = Missed commit – Updated ETA supplied by driver + * - 007 = Cancelled + * - 008 = Order has invalid order status + * - 012 = Your pickup request is being processed + * + * + * @return string + */ public function getPickupStatusMessage(): string { return $this->pickupStatusMessage; @@ -250,13 +250,13 @@ public function setPickupStatusMessage(string $pickupStatusMessage): self return $this; } /** - * Pickup billing classification for on call - - 01 = Regular - - 02 = Return - - 03 = Alternate Address (Not supported for now) - * - * @return string - */ + * Pickup billing classification for on call + * - 01 = Regular + * - 02 = Return + * - 03 = Alternate Address (Not supported for now) + * + * @return string + */ public function getBillingCode(): string { return $this->billingCode; diff --git a/src/Api/Model/PickupRateRequest.php b/src/Api/Model/PickupRateRequest.php index c3a43a5a..e70a705c 100644 --- a/src/Api/Model/PickupRateRequest.php +++ b/src/Api/Model/PickupRateRequest.php @@ -31,73 +31,73 @@ public function isInitialized($property): bool */ protected $pickupAddress; /** - * Indicates if the pickup address is different than the address specified in the customer's profile. - Valid values: - Y = Alternate address - N = Original pickup address (default) - * - * @var string - */ + * Indicates if the pickup address is different than the address specified in the customer's profile. + * Valid values: + * Y = Alternate address + * N = Original pickup address (default) + * + * @var string + */ protected $alternateAddressIndicator; /** - * Indicates the pickup timeframe. - - 01 = Same-Day Pickup - - 02 = Future-Day Pickup - - 03 = A Specific-Day Pickup - - If 03 is selected, then PickupDate, EarliestReadyTime, and LatestClosetime must be specified. - * - * @var string - */ + * Indicates the pickup timeframe. + * - 01 = Same-Day Pickup + * - 02 = Future-Day Pickup + * - 03 = A Specific-Day Pickup + * + * If 03 is selected, then PickupDate, EarliestReadyTime, and LatestClosetime must be specified. + * + * @var string + */ protected $serviceDateOption; /** - * Required if the ServiceDateOption is: - 03 A Specific-Day Pickup - * - * @var PickupRateRequestPickupDateInfo - */ + * Required if the ServiceDateOption is: + * 03 A Specific-Day Pickup + * + * @var PickupRateRequestPickupDateInfo + */ protected $pickupDateInfo; /** - * Rate Type with which pickup is rated. Possible RateChart values for different regions will be: - - US 48 origin: - 1 – Daily Rates - 3 – Standard List Rates - 4 – Retail Rates. - - Alaska/Hawaii origin: - 1 – Daily Rates - 3 – Standard List Rates - 4 – Retail Rates. - - All Other origins: - 1 – Rates - 5 - Regional Rates - 6 - General List Rates. - - 3 and 4 do not apply - - * - * @var string - */ + * Rate Type with which pickup is rated. Possible RateChart values for different regions will be: + * + * US 48 origin: + * 1 – Daily Rates + * 3 – Standard List Rates + * 4 – Retail Rates. + * + * Alaska/Hawaii origin: + * 1 – Daily Rates + * 3 – Standard List Rates + * 4 – Retail Rates. + * + * All Other origins: + * 1 – Rates + * 5 - Regional Rates + * 6 - General List Rates. + * + * 3 and 4 do not apply + * + * + * @var string + */ protected $rateChartType; /** - * Indicates whether to return detailed taxes for on-callpickups. - Valid values: - - Y = Rate this pickup with taxes - - N = Do not rate this pickup with taxes (default) - * - * @var string - */ + * Indicates whether to return detailed taxes for on-callpickups. + * Valid values: + * - Y = Rate this pickup with taxes + * - N = Do not rate this pickup with taxes (default) + * + * @var string + */ protected $taxInformationIndicator; /** - * Indicates whether to return user level promo discount for the on-callpickups. - Valid values: - Y = Rate this pickup with user level promo discount - N = Do not rate this pickup with user level promo discount(default) - * - * @var string - */ + * Indicates whether to return user level promo discount for the on-callpickups. + * Valid values: + * Y = Rate this pickup with user level promo discount + * N = Do not rate this pickup with user level promo discount(default) + * + * @var string + */ protected $userLevelDiscountIndicator; /** * Common element for all services @@ -166,13 +166,13 @@ public function setPickupAddress(PickupRateRequestPickupAddress $pickupAddress): return $this; } /** - * Indicates if the pickup address is different than the address specified in the customer's profile. - Valid values: - Y = Alternate address - N = Original pickup address (default) - * - * @return string - */ + * Indicates if the pickup address is different than the address specified in the customer's profile. + * Valid values: + * Y = Alternate address + * N = Original pickup address (default) + * + * @return string + */ public function getAlternateAddressIndicator(): string { return $this->alternateAddressIndicator; @@ -194,15 +194,15 @@ public function setAlternateAddressIndicator(string $alternateAddressIndicator): return $this; } /** - * Indicates the pickup timeframe. - - 01 = Same-Day Pickup - - 02 = Future-Day Pickup - - 03 = A Specific-Day Pickup - - If 03 is selected, then PickupDate, EarliestReadyTime, and LatestClosetime must be specified. - * - * @return string - */ + * Indicates the pickup timeframe. + * - 01 = Same-Day Pickup + * - 02 = Future-Day Pickup + * - 03 = A Specific-Day Pickup + * + * If 03 is selected, then PickupDate, EarliestReadyTime, and LatestClosetime must be specified. + * + * @return string + */ public function getServiceDateOption(): string { return $this->serviceDateOption; @@ -226,11 +226,11 @@ public function setServiceDateOption(string $serviceDateOption): self return $this; } /** - * Required if the ServiceDateOption is: - 03 A Specific-Day Pickup - * - * @return PickupRateRequestPickupDateInfo - */ + * Required if the ServiceDateOption is: + * 03 A Specific-Day Pickup + * + * @return PickupRateRequestPickupDateInfo + */ public function getPickupDateInfo(): PickupRateRequestPickupDateInfo { return $this->pickupDateInfo; @@ -250,28 +250,28 @@ public function setPickupDateInfo(PickupRateRequestPickupDateInfo $pickupDateInf return $this; } /** - * Rate Type with which pickup is rated. Possible RateChart values for different regions will be: - - US 48 origin: - 1 – Daily Rates - 3 – Standard List Rates - 4 – Retail Rates. - - Alaska/Hawaii origin: - 1 – Daily Rates - 3 – Standard List Rates - 4 – Retail Rates. - - All Other origins: - 1 – Rates - 5 - Regional Rates - 6 - General List Rates. - - 3 and 4 do not apply - - * - * @return string - */ + * Rate Type with which pickup is rated. Possible RateChart values for different regions will be: + * + * US 48 origin: + * 1 – Daily Rates + * 3 – Standard List Rates + * 4 – Retail Rates. + * + * Alaska/Hawaii origin: + * 1 – Daily Rates + * 3 – Standard List Rates + * 4 – Retail Rates. + * + * All Other origins: + * 1 – Rates + * 5 - Regional Rates + * 6 - General List Rates. + * + * 3 and 4 do not apply + * + * + * @return string + */ public function getRateChartType(): string { return $this->rateChartType; @@ -308,13 +308,13 @@ public function setRateChartType(string $rateChartType): self return $this; } /** - * Indicates whether to return detailed taxes for on-callpickups. - Valid values: - - Y = Rate this pickup with taxes - - N = Do not rate this pickup with taxes (default) - * - * @return string - */ + * Indicates whether to return detailed taxes for on-callpickups. + * Valid values: + * - Y = Rate this pickup with taxes + * - N = Do not rate this pickup with taxes (default) + * + * @return string + */ public function getTaxInformationIndicator(): string { return $this->taxInformationIndicator; @@ -336,13 +336,13 @@ public function setTaxInformationIndicator(string $taxInformationIndicator): sel return $this; } /** - * Indicates whether to return user level promo discount for the on-callpickups. - Valid values: - Y = Rate this pickup with user level promo discount - N = Do not rate this pickup with user level promo discount(default) - * - * @return string - */ + * Indicates whether to return user level promo discount for the on-callpickups. + * Valid values: + * Y = Rate this pickup with user level promo discount + * N = Do not rate this pickup with user level promo discount(default) + * + * @return string + */ public function getUserLevelDiscountIndicator(): string { return $this->userLevelDiscountIndicator; diff --git a/src/Api/Model/PickupRateRequestPickupAddress.php b/src/Api/Model/PickupRateRequestPickupAddress.php index 447a74a2..7ea6f80f 100644 --- a/src/Api/Model/PickupRateRequestPickupAddress.php +++ b/src/Api/Model/PickupRateRequestPickupAddress.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Detailed street address. - For Jan. 2010 release, only one AddressLine is allowed. - * - * @var string - */ + * Detailed street address. + * For Jan. 2010 release, only one AddressLine is allowed. + * + * @var string + */ protected $addressLine; /** * City or equivalent @@ -38,27 +38,27 @@ public function isInitialized($property): bool */ protected $postalCode; /** - * Upper-case two-char long country code as defined by ISO-3166. - Refer to Country or Territory Codes in the Appendix for valid values. - * - * @var string - */ + * Upper-case two-char long country code as defined by ISO-3166. + * Refer to Country or Territory Codes in the Appendix for valid values. + * + * @var string + */ protected $countryCode; /** - * Indicates if the pickup address is commerical or residential. - Valid values: - Y = Residential address - N = Non-residential (Commercial) address (default) - * - * @var string - */ + * Indicates if the pickup address is commerical or residential. + * Valid values: + * Y = Residential address + * N = Non-residential (Commercial) address (default) + * + * @var string + */ protected $residentialIndicator; /** - * Detailed street address. - For Jan. 2010 release, only one AddressLine is allowed. - * - * @return string - */ + * Detailed street address. + * For Jan. 2010 release, only one AddressLine is allowed. + * + * @return string + */ public function getAddressLine(): string { return $this->addressLine; @@ -144,11 +144,11 @@ public function setPostalCode(string $postalCode): self return $this; } /** - * Upper-case two-char long country code as defined by ISO-3166. - Refer to Country or Territory Codes in the Appendix for valid values. - * - * @return string - */ + * Upper-case two-char long country code as defined by ISO-3166. + * Refer to Country or Territory Codes in the Appendix for valid values. + * + * @return string + */ public function getCountryCode(): string { return $this->countryCode; @@ -168,13 +168,13 @@ public function setCountryCode(string $countryCode): self return $this; } /** - * Indicates if the pickup address is commerical or residential. - Valid values: - Y = Residential address - N = Non-residential (Commercial) address (default) - * - * @return string - */ + * Indicates if the pickup address is commerical or residential. + * Valid values: + * Y = Residential address + * N = Non-residential (Commercial) address (default) + * + * @return string + */ public function getResidentialIndicator(): string { return $this->residentialIndicator; diff --git a/src/Api/Model/PickupRateRequestPickupDateInfo.php b/src/Api/Model/PickupRateRequestPickupDateInfo.php index 353b1a92..8a6efade 100644 --- a/src/Api/Model/PickupRateRequestPickupDateInfo.php +++ b/src/Api/Model/PickupRateRequestPickupDateInfo.php @@ -13,37 +13,37 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The latest local close time. Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - * - * @var string - */ + * The latest local close time. Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * @var string + */ protected $closeTime; /** - * The earliest local ready Time. Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - * - * @var string - */ + * The earliest local ready Time. Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * @var string + */ protected $readyTime; /** - * The specific local pickup date. Format: yyyyMMdd - - yyyy = Year Applicable - - MM = 01-12 - - dd = 01-31 - * - * @var string - */ + * The specific local pickup date. Format: yyyyMMdd + * - yyyy = Year Applicable + * - MM = 01-12 + * - dd = 01-31 + * + * @var string + */ protected $pickupDate; /** - * The latest local close time. Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - * - * @return string - */ + * The latest local close time. Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * @return string + */ public function getCloseTime(): string { return $this->closeTime; @@ -64,12 +64,12 @@ public function setCloseTime(string $closeTime): self return $this; } /** - * The earliest local ready Time. Format: HHmm - - Hour: 0-23 - - Minute: 0-59 - * - * @return string - */ + * The earliest local ready Time. Format: HHmm + * - Hour: 0-23 + * - Minute: 0-59 + * + * @return string + */ public function getReadyTime(): string { return $this->readyTime; @@ -90,13 +90,13 @@ public function setReadyTime(string $readyTime): self return $this; } /** - * The specific local pickup date. Format: yyyyMMdd - - yyyy = Year Applicable - - MM = 01-12 - - dd = 01-31 - * - * @return string - */ + * The specific local pickup date. Format: yyyyMMdd + * - yyyy = Year Applicable + * - MM = 01-12 + * - dd = 01-31 + * + * @return string + */ public function getPickupDate(): string { return $this->pickupDate; diff --git a/src/Api/Model/PickupRateRequestRequest.php b/src/Api/Model/PickupRateRequestRequest.php index 941143b8..9777f89e 100644 --- a/src/Api/Model/PickupRateRequestRequest.php +++ b/src/Api/Model/PickupRateRequestRequest.php @@ -19,17 +19,17 @@ public function isInitialized($property): bool */ protected $requestOption; /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. Supported values: 1607, 1707,2007 - - Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. - - Format: YYMM = Year and month of the release. - Example: 1601 = 2016 January - * - * @var string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. Supported values: 1607, 1707,2007 + * + * Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. + * + * Format: YYMM = Year and month of the release. + * Example: 1601 = 2016 January + * + * @var string + */ protected $subVersion; /** * TransactionReference identifies transactions between client and server. @@ -60,17 +60,17 @@ public function setRequestOption(string $requestOption): self return $this; } /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. Supported values: 1607, 1707,2007 - - Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. - - Format: YYMM = Year and month of the release. - Example: 1601 = 2016 January - * - * @return string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. Supported values: 1607, 1707,2007 + * + * Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to '1601'. + * + * Format: YYMM = Year and month of the release. + * Example: 1601 = 2016 January + * + * @return string + */ public function getSubVersion(): string { return $this->subVersion; diff --git a/src/Api/Model/PickupRateRequestShipperAccount.php b/src/Api/Model/PickupRateRequestShipperAccount.php index 90ec4683..a8b2ad49 100644 --- a/src/Api/Model/PickupRateRequestShipperAccount.php +++ b/src/Api/Model/PickupRateRequestShipperAccount.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $accountNumber; /** - * Country code as defined by ISO-3166. - Refer to Country or Territory Codes in the Appendix for valid values. - * - * @var string - */ + * Country code as defined by ISO-3166. + * Refer to Country or Territory Codes in the Appendix for valid values. + * + * @var string + */ protected $accountCountryCode; /** * UPS account number. Shipper's (requester of the pickup) UPS account number @@ -48,11 +48,11 @@ public function setAccountNumber(string $accountNumber): self return $this; } /** - * Country code as defined by ISO-3166. - Refer to Country or Territory Codes in the Appendix for valid values. - * - * @return string - */ + * Country code as defined by ISO-3166. + * Refer to Country or Territory Codes in the Appendix for valid values. + * + * @return string + */ public function getAccountCountryCode(): string { return $this->accountCountryCode; diff --git a/src/Api/Model/PickupRateResponse.php b/src/Api/Model/PickupRateResponse.php index a7ebbe98..6d40f9de 100644 --- a/src/Api/Model/PickupRateResponse.php +++ b/src/Api/Model/PickupRateResponse.php @@ -25,12 +25,12 @@ public function isInitialized($property): bool */ protected $rateResult; /** - * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 1607. Valid Values: - - Y = WST - - N = Non-WST - * - * @var string - */ + * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 1607. Valid Values: + * - Y = WST + * - N = Non-WST + * + * @var string + */ protected $weekendServiceTerritoryIndicator; /** * WeekendServiceTerritory Container.Returned if the subversion greater or equal to 2007. @@ -83,12 +83,12 @@ public function setRateResult(PickupRateResponseRateResult $rateResult): self return $this; } /** - * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 1607. Valid Values: - - Y = WST - - N = Non-WST - * - * @return string - */ + * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 1607. Valid Values: + * - Y = WST + * - N = Non-WST + * + * @return string + */ public function getWeekendServiceTerritoryIndicator(): string { return $this->weekendServiceTerritoryIndicator; diff --git a/src/Api/Model/PickupRateResponseRateResult.php b/src/Api/Model/PickupRateResponseRateResult.php index 7edda0a1..0a95a745 100644 --- a/src/Api/Model/PickupRateResponseRateResult.php +++ b/src/Api/Model/PickupRateResponseRateResult.php @@ -19,12 +19,12 @@ public function isInitialized($property): bool */ protected $disclaimer; /** - * Indicates the pickup is rated as same-day or future-day pickup. - - SD = Same-day Pickup - - FD = Future-day Pickup - * - * @var string - */ + * Indicates the pickup is rated as same-day or future-day pickup. + * - SD = Same-day Pickup + * - FD = Future-day Pickup + * + * @var string + */ protected $rateType; /** * IATA currency codes for the pickup charge. Such as USD @@ -97,12 +97,12 @@ public function setDisclaimer(RateResultDisclaimer $disclaimer): self return $this; } /** - * Indicates the pickup is rated as same-day or future-day pickup. - - SD = Same-day Pickup - - FD = Future-day Pickup - * - * @return string - */ + * Indicates the pickup is rated as same-day or future-day pickup. + * - SD = Same-day Pickup + * - FD = Future-day Pickup + * + * @return string + */ public function getRateType(): string { return $this->rateType; diff --git a/src/Api/Model/PickupRateResponseResponse.php b/src/Api/Model/PickupRateResponseResponse.php index 3242c92e..d6d20d35 100644 --- a/src/Api/Model/PickupRateResponseResponse.php +++ b/src/Api/Model/PickupRateResponseResponse.php @@ -19,8 +19,6 @@ public function isInitialized($property): bool */ protected $responseStatus; /** - * - * * @var list */ protected $alert; @@ -53,8 +51,6 @@ public function setResponseStatus(ResponseResponseStatus $responseStatus): self return $this; } /** - * - * * @return list */ public function getAlert(): array @@ -62,8 +58,6 @@ public function getAlert(): array return $this->alert; } /** - * - * * @param list $alert * * @return self diff --git a/src/Api/Model/PickupRateResponseWeekendServiceTerritory.php b/src/Api/Model/PickupRateResponseWeekendServiceTerritory.php index 08a811e6..88056566 100644 --- a/src/Api/Model/PickupRateResponseWeekendServiceTerritory.php +++ b/src/Api/Model/PickupRateResponseWeekendServiceTerritory.php @@ -13,31 +13,31 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 2007. Valid Values: - - Y = Saturday WST - - N = Non-Saturday WST - - * - * @var string - */ + * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 2007. Valid Values: + * - Y = Saturday WST + * - N = Non-Saturday WST + * + * + * @var string + */ protected $satWST; /** - * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Sunday and subversion greater or equal to 2007. Valid Values: - - Y = Sunday WST - - N = Non-Sunday WST - - * - * @var string - */ + * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Sunday and subversion greater or equal to 2007. Valid Values: + * - Y = Sunday WST + * - N = Non-Sunday WST + * + * + * @var string + */ protected $sunWST; /** - * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 2007. Valid Values: - - Y = Saturday WST - - N = Non-Saturday WST - - * - * @return string - */ + * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Saturday and subversion greater or equal to 2007. Valid Values: + * - Y = Saturday WST + * - N = Non-Saturday WST + * + * + * @return string + */ public function getSatWST(): string { return $this->satWST; @@ -59,13 +59,13 @@ public function setSatWST(string $satWST): self return $this; } /** - * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Sunday and subversion greater or equal to 2007. Valid Values: - - Y = Sunday WST - - N = Non-Sunday WST - - * - * @return string - */ + * Indicates if the pickup address qualifies for WST (Weekend Service Territory). Returned if the pickup date is Sunday and subversion greater or equal to 2007. Valid Values: + * - Y = Sunday WST + * - N = Non-Sunday WST + * + * + * @return string + */ public function getSunWST(): string { return $this->sunWST; diff --git a/src/Api/Model/PickupRequestPOM.php b/src/Api/Model/PickupRequestPOM.php index b4a6c232..a98832d8 100644 --- a/src/Api/Model/PickupRequestPOM.php +++ b/src/Api/Model/PickupRequestPOM.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $pOMNumber; /** - * Identifies the kind of number used to identify the POM shipment. - For valid values, see POMNumberType Values in the Appendix. - * - * @var string - */ + * Identifies the kind of number used to identify the POM shipment. + * For valid values, see POMNumberType Values in the Appendix. + * + * @var string + */ protected $pOMNumberType; /** * Container for pre-pickup notifications events @@ -54,11 +54,11 @@ public function setPOMNumber(string $pOMNumber): self return $this; } /** - * Identifies the kind of number used to identify the POM shipment. - For valid values, see POMNumberType Values in the Appendix. - * - * @return string - */ + * Identifies the kind of number used to identify the POM shipment. + * For valid values, see POMNumberType Values in the Appendix. + * + * @return string + */ public function getPOMNumberType(): string { return $this->pOMNumberType; diff --git a/src/Api/Model/PreAlertNotificationTextMessage.php b/src/Api/Model/PreAlertNotificationTextMessage.php index 1b2ea9c1..67f1b6fb 100644 --- a/src/Api/Model/PreAlertNotificationTextMessage.php +++ b/src/Api/Model/PreAlertNotificationTextMessage.php @@ -13,34 +13,34 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Phone number for receiving Voice PreAlertNotification. Valid values are 0 – 9. - - If the country or territory of the message recipient is US, PR, CA, and VI, the layout is: - - 1, area code, 7 digit phone number or - - 1, area code, 7 digit phone number, 4 digit extension number. - - For other countries or territories, the layout is country or territory code, area code, 7 digit number. - - * - * @var string - */ + * Phone number for receiving Voice PreAlertNotification. Valid values are 0 – 9. + * + * If the country or territory of the message recipient is US, PR, CA, and VI, the layout is: + * + * 1, area code, 7 digit phone number or + * + * 1, area code, 7 digit phone number, 4 digit extension number. + * + * For other countries or territories, the layout is country or territory code, area code, 7 digit number. + * + * + * @var string + */ protected $phoneNumber; /** - * Phone number for receiving Voice PreAlertNotification. Valid values are 0 – 9. - - If the country or territory of the message recipient is US, PR, CA, and VI, the layout is: - - 1, area code, 7 digit phone number or - - 1, area code, 7 digit phone number, 4 digit extension number. - - For other countries or territories, the layout is country or territory code, area code, 7 digit number. - - * - * @return string - */ + * Phone number for receiving Voice PreAlertNotification. Valid values are 0 – 9. + * + * If the country or territory of the message recipient is US, PR, CA, and VI, the layout is: + * + * 1, area code, 7 digit phone number or + * + * 1, area code, 7 digit phone number, 4 digit extension number. + * + * For other countries or territories, the layout is country or territory code, area code, 7 digit number. + * + * + * @return string + */ public function getPhoneNumber(): string { return $this->phoneNumber; diff --git a/src/Api/Model/PreAlertNotificationVoiceMessage.php b/src/Api/Model/PreAlertNotificationVoiceMessage.php index 590aa9b6..33802070 100644 --- a/src/Api/Model/PreAlertNotificationVoiceMessage.php +++ b/src/Api/Model/PreAlertNotificationVoiceMessage.php @@ -13,34 +13,34 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Phone number for receiving Voice PreAlertNotification. Valid values are 0 – 9. - - If the country or territory of the message recipient is US, PR, CA, and VI, the layout is: - - 1, area code, 7 digit phone number or - - 1, area code, 7 digit phone number, 4 digit extension number. - - For other countries or territories, the layout is country or territory code, area code, 7 digit number. - - * - * @var string - */ + * Phone number for receiving Voice PreAlertNotification. Valid values are 0 – 9. + * + * If the country or territory of the message recipient is US, PR, CA, and VI, the layout is: + * + * 1, area code, 7 digit phone number or + * + * 1, area code, 7 digit phone number, 4 digit extension number. + * + * For other countries or territories, the layout is country or territory code, area code, 7 digit number. + * + * + * @var string + */ protected $phoneNumber; /** - * Phone number for receiving Voice PreAlertNotification. Valid values are 0 – 9. - - If the country or territory of the message recipient is US, PR, CA, and VI, the layout is: - - 1, area code, 7 digit phone number or - - 1, area code, 7 digit phone number, 4 digit extension number. - - For other countries or territories, the layout is country or territory code, area code, 7 digit number. - - * - * @return string - */ + * Phone number for receiving Voice PreAlertNotification. Valid values are 0 – 9. + * + * If the country or territory of the message recipient is US, PR, CA, and VI, the layout is: + * + * 1, area code, 7 digit phone number or + * + * 1, area code, 7 digit phone number, 4 digit extension number. + * + * For other countries or territories, the layout is country or territory code, area code, 7 digit number. + * + * + * @return string + */ public function getPhoneNumber(): string { return $this->phoneNumber; diff --git a/src/Api/Model/PreNotificationPackageChemicalRecord.php b/src/Api/Model/PreNotificationPackageChemicalRecord.php index 6ebe83eb..d72daeb5 100644 --- a/src/Api/Model/PreNotificationPackageChemicalRecord.php +++ b/src/Api/Model/PreNotificationPackageChemicalRecord.php @@ -37,15 +37,15 @@ public function isInitialized($property): bool */ protected $iDNumber; /** - * This is the packing group category associated to the specified commodity. Must be shown in Roman Numerals. Valid values are: - - I - - II - - III - - blank - - * - * @var string - */ + * This is the packing group category associated to the specified commodity. Must be shown in Roman Numerals. Valid values are: + * - I + * - II + * - III + * - blank + * + * + * @var string + */ protected $packagingGroupType; /** * Required if CommodityRegulatedLevelCode = LQ or FR. The numerical value of the mass capacity of the regulated good. @@ -66,17 +66,17 @@ public function isInitialized($property): bool */ protected $packagingInstructionCode; /** - * 24 Hour Emergency Phone Number of the shipper. - - Valid values for this field are (0) through (9) with trailing blanks. - - For numbers within the U.S., the layout is 1, area code, 7-digit number. For all other countries the layout is country code, area code, number. The following are restricted in the phone number - period ".", dash "-", plus sign "+" and conventional parentheses "(" and ")", "EXT" or "OPT" The following are restricted in the phone number - period ".", dash "-", plus sign "+" and conventional parentheses "(" and ")", "EXT" or "OPT" - - * - * @var string - */ + * 24 Hour Emergency Phone Number of the shipper. + * + * Valid values for this field are (0) through (9) with trailing blanks. + * + * For numbers within the U.S., the layout is 1, area code, 7-digit number. For all other countries the layout is country code, area code, number. The following are restricted in the phone number + * period ".", dash "-", plus sign "+" and conventional parentheses "(" and ")", "EXT" or "OPT" The following are restricted in the phone number + * period ".", dash "-", plus sign "+" and conventional parentheses "(" and ")", "EXT" or "OPT" + * + * + * @var string + */ protected $emergencyPhone; /** * The emergency information, contact name and/or contract number, required to be communicated when a call is placed to the EmergencyPhoneNumber. @@ -245,15 +245,15 @@ public function setIDNumber(string $iDNumber): self return $this; } /** - * This is the packing group category associated to the specified commodity. Must be shown in Roman Numerals. Valid values are: - - I - - II - - III - - blank - - * - * @return string - */ + * This is the packing group category associated to the specified commodity. Must be shown in Roman Numerals. Valid values are: + * - I + * - II + * - III + * - blank + * + * + * @return string + */ public function getPackagingGroupType(): string { return $this->packagingGroupType; @@ -343,17 +343,17 @@ public function setPackagingInstructionCode(string $packagingInstructionCode): s return $this; } /** - * 24 Hour Emergency Phone Number of the shipper. - - Valid values for this field are (0) through (9) with trailing blanks. - - For numbers within the U.S., the layout is 1, area code, 7-digit number. For all other countries the layout is country code, area code, number. The following are restricted in the phone number - period ".", dash "-", plus sign "+" and conventional parentheses "(" and ")", "EXT" or "OPT" The following are restricted in the phone number - period ".", dash "-", plus sign "+" and conventional parentheses "(" and ")", "EXT" or "OPT" - - * - * @return string - */ + * 24 Hour Emergency Phone Number of the shipper. + * + * Valid values for this field are (0) through (9) with trailing blanks. + * + * For numbers within the U.S., the layout is 1, area code, 7-digit number. For all other countries the layout is country code, area code, number. The following are restricted in the phone number + * period ".", dash "-", plus sign "+" and conventional parentheses "(" and ")", "EXT" or "OPT" The following are restricted in the phone number + * period ".", dash "-", plus sign "+" and conventional parentheses "(" and ")", "EXT" or "OPT" + * + * + * @return string + */ public function getEmergencyPhone(): string { return $this->emergencyPhone; diff --git a/src/Api/Model/PreNotificationRequestShipment.php b/src/Api/Model/PreNotificationRequestShipment.php index 6c1a3a4c..30099238 100644 --- a/src/Api/Model/PreNotificationRequestShipment.php +++ b/src/Api/Model/PreNotificationRequestShipment.php @@ -49,18 +49,16 @@ public function isInitialized($property): bool */ protected $service; /** - * The Regulatory set associated with every regulated shipment. It must be same across the shipment. Valid values are: - - ADR – European Agreement concerning the International Carriage of Dangerous Goods by Road. - - 49CFR – Title 49 of the United States Code of Federal Regulations. - - IATA – International Air Transport Association (IATA) Dangerous Goods Regulations. - - * - * @var string - */ - protected $regulationSet; - /** + * The Regulatory set associated with every regulated shipment. It must be same across the shipment. Valid values are: + * - ADR – European Agreement concerning the International Carriage of Dangerous Goods by Road. + * - 49CFR – Title 49 of the United States Code of Federal Regulations. + * - IATA – International Air Transport Association (IATA) Dangerous Goods Regulations. * * + * @var string + */ + protected $regulationSet; + /** * @var list */ protected $package; @@ -197,14 +195,14 @@ public function setService(ShipmentService $service): self return $this; } /** - * The Regulatory set associated with every regulated shipment. It must be same across the shipment. Valid values are: - - ADR – European Agreement concerning the International Carriage of Dangerous Goods by Road. - - 49CFR – Title 49 of the United States Code of Federal Regulations. - - IATA – International Air Transport Association (IATA) Dangerous Goods Regulations. - - * - * @return string - */ + * The Regulatory set associated with every regulated shipment. It must be same across the shipment. Valid values are: + * - ADR – European Agreement concerning the International Carriage of Dangerous Goods by Road. + * - 49CFR – Title 49 of the United States Code of Federal Regulations. + * - IATA – International Air Transport Association (IATA) Dangerous Goods Regulations. + * + * + * @return string + */ public function getRegulationSet(): string { return $this->regulationSet; @@ -227,8 +225,6 @@ public function setRegulationSet(string $regulationSet): self return $this; } /** - * - * * @return list */ public function getPackage(): array @@ -236,8 +232,6 @@ public function getPackage(): array return $this->package; } /** - * - * * @param list $package * * @return self diff --git a/src/Api/Model/PreNotificationResponseResponse.php b/src/Api/Model/PreNotificationResponseResponse.php index 169fc65c..0469fad3 100644 --- a/src/Api/Model/PreNotificationResponseResponse.php +++ b/src/Api/Model/PreNotificationResponseResponse.php @@ -20,7 +20,9 @@ public function isInitialized($property): bool protected $responseStatus; /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -55,7 +57,9 @@ public function setResponseStatus(ResponseResponseStatus $responseStatus): self } /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/PreNotificationShipmentPackage.php b/src/Api/Model/PreNotificationShipmentPackage.php index 85d3cae5..c867503f 100644 --- a/src/Api/Model/PreNotificationShipmentPackage.php +++ b/src/Api/Model/PreNotificationShipmentPackage.php @@ -43,8 +43,6 @@ public function isInitialized($property): bool */ protected $packagePoints; /** - * - * * @var list */ protected $chemicalRecord; @@ -159,8 +157,6 @@ public function setPackagePoints(string $packagePoints): self return $this; } /** - * - * * @return list */ public function getChemicalRecord(): array @@ -168,8 +164,6 @@ public function getChemicalRecord(): array return $this->chemicalRecord; } /** - * - * * @param list $chemicalRecord * * @return self diff --git a/src/Api/Model/ProductPackingListInfo.php b/src/Api/Model/ProductPackingListInfo.php index f51a67f5..c1dcb8f0 100644 --- a/src/Api/Model/ProductPackingListInfo.php +++ b/src/Api/Model/ProductPackingListInfo.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $packageAssociated; /** - * - * * @return list */ public function getPackageAssociated(): array @@ -28,8 +24,6 @@ public function getPackageAssociated(): array return $this->packageAssociated; } /** - * - * * @param list $packageAssociated * * @return self diff --git a/src/Api/Model/ProductScheduleB.php b/src/Api/Model/ProductScheduleB.php index f8b733a1..95acd7da 100644 --- a/src/Api/Model/ProductScheduleB.php +++ b/src/Api/Model/ProductScheduleB.php @@ -25,8 +25,6 @@ public function isInitialized($property): bool */ protected $quantity; /** - * - * * @var list */ protected $unitOfMeasurement; @@ -75,8 +73,6 @@ public function setQuantity(array $quantity): self return $this; } /** - * - * * @return list */ public function getUnitOfMeasurement(): array @@ -84,8 +80,6 @@ public function getUnitOfMeasurement(): array return $this->unitOfMeasurement; } /** - * - * * @param list $unitOfMeasurement * * @return self diff --git a/src/Api/Model/ProductWeightUnitOfMeasurement.php b/src/Api/Model/ProductWeightUnitOfMeasurement.php index 46502b03..419d0665 100644 --- a/src/Api/Model/ProductWeightUnitOfMeasurement.php +++ b/src/Api/Model/ProductWeightUnitOfMeasurement.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code for unit of Measurement of weight. Applies to CO and EEI forms only. Valid values: - - KGS - - LBS - - * - * @var string - */ + * Code for unit of Measurement of weight. Applies to CO and EEI forms only. Valid values: + * - KGS + * - LBS + * + * + * @var string + */ protected $code; /** * Description of the Unit of Measure. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $description; /** - * Code for unit of Measurement of weight. Applies to CO and EEI forms only. Valid values: - - KGS - - LBS - - * - * @return string - */ + * Code for unit of Measurement of weight. Applies to CO and EEI forms only. Valid values: + * - KGS + * - LBS + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/PushToImageRepositoryRequest.php b/src/Api/Model/PushToImageRepositoryRequest.php index 24965302..ee7cc011 100644 --- a/src/Api/Model/PushToImageRepositoryRequest.php +++ b/src/Api/Model/PushToImageRepositoryRequest.php @@ -49,7 +49,7 @@ public function isInitialized($property): bool */ protected $shipmentDateAndTime; /** - * Valid values are: 1 = small package, 2 = freight. + * Valid values are: 1 = small package, 2 = freight. * * @var string */ @@ -199,7 +199,7 @@ public function setShipmentDateAndTime(string $shipmentDateAndTime): self return $this; } /** - * Valid values are: 1 = small package, 2 = freight. + * Valid values are: 1 = small package, 2 = freight. * * @return string */ diff --git a/src/Api/Model/PushToImageRepositoryResponseResponse.php b/src/Api/Model/PushToImageRepositoryResponseResponse.php index 2ea6ddb0..a514f731 100644 --- a/src/Api/Model/PushToImageRepositoryResponseResponse.php +++ b/src/Api/Model/PushToImageRepositoryResponseResponse.php @@ -20,7 +20,9 @@ public function isInitialized($property): bool protected $responseStatus; /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -55,7 +57,9 @@ public function setResponseStatus(ResponseResponseStatus $responseStatus): self } /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/QuantumViewEventsSubscriptionEvents.php b/src/Api/Model/QuantumViewEventsSubscriptionEvents.php index e4d15a07..dc8ba59e 100644 --- a/src/Api/Model/QuantumViewEventsSubscriptionEvents.php +++ b/src/Api/Model/QuantumViewEventsSubscriptionEvents.php @@ -38,7 +38,9 @@ public function isInitialized($property): bool protected $dateRange; /** * Container holds all of the unread files associated with the subscription. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -133,7 +135,9 @@ public function setDateRange(SubscriptionEventsDateRange $dateRange): self } /** * Container holds all of the unread files associated with the subscription. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/QuantumViewRequest.php b/src/Api/Model/QuantumViewRequest.php index ed91ed13..ca69a90e 100644 --- a/src/Api/Model/QuantumViewRequest.php +++ b/src/Api/Model/QuantumViewRequest.php @@ -19,18 +19,16 @@ public function isInitialized($property): bool */ protected $request; /** - * - * * @var list */ protected $subscriptionRequest; /** - * Bookmarks the file for next retrieval. It is a base64Encoded String. - It contains the combination of SubscriberID + SubscriptionName + File Name if the request is for all data. - It contains SubscriberID if the request is for unread data. When a response comes back with a bookmark it indicates that there is more data. To fetch the remaining data, the requester should come back with the bookmark added to the original request. - * - * @var string - */ + * Bookmarks the file for next retrieval. It is a base64Encoded String. + * It contains the combination of SubscriberID + SubscriptionName + File Name if the request is for all data. + * It contains SubscriberID if the request is for unread data. When a response comes back with a bookmark it indicates that there is more data. To fetch the remaining data, the requester should come back with the bookmark added to the original request. + * + * @var string + */ protected $bookmark; /** * Contains QuantumView request criteria components. @@ -55,8 +53,6 @@ public function setRequest(QuantumViewRequestRequest $request): self return $this; } /** - * - * * @return list */ public function getSubscriptionRequest(): array @@ -64,8 +60,6 @@ public function getSubscriptionRequest(): array return $this->subscriptionRequest; } /** - * - * * @param list $subscriptionRequest * * @return self @@ -77,12 +71,12 @@ public function setSubscriptionRequest(array $subscriptionRequest): self return $this; } /** - * Bookmarks the file for next retrieval. It is a base64Encoded String. - It contains the combination of SubscriberID + SubscriptionName + File Name if the request is for all data. - It contains SubscriberID if the request is for unread data. When a response comes back with a bookmark it indicates that there is more data. To fetch the remaining data, the requester should come back with the bookmark added to the original request. - * - * @return string - */ + * Bookmarks the file for next retrieval. It is a base64Encoded String. + * It contains the combination of SubscriberID + SubscriptionName + File Name if the request is for all data. + * It contains SubscriberID if the request is for unread data. When a response comes back with a bookmark it indicates that there is more data. To fetch the remaining data, the requester should come back with the bookmark added to the original request. + * + * @return string + */ public function getBookmark(): string { return $this->bookmark; diff --git a/src/Api/Model/QuantumViewResponseQuantumViewEvents.php b/src/Api/Model/QuantumViewResponseQuantumViewEvents.php index c0d54117..4ed3a64f 100644 --- a/src/Api/Model/QuantumViewResponseQuantumViewEvents.php +++ b/src/Api/Model/QuantumViewResponseQuantumViewEvents.php @@ -20,7 +20,9 @@ public function isInitialized($property): bool protected $subscriberID; /** * The event that a user receives a subset of Tracking information specific to either packages coming or packages going, after subscription request is made. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -49,7 +51,9 @@ public function setSubscriberID(string $subscriberID): self } /** * The event that a user receives a subset of Tracking information specific to either packages coming or packages going, after subscription request is made. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/QuantumViewResponseResponse.php b/src/Api/Model/QuantumViewResponseResponse.php index c4096914..1f2f48cd 100644 --- a/src/Api/Model/QuantumViewResponseResponse.php +++ b/src/Api/Model/QuantumViewResponseResponse.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $transactionReference; /** - * Identifies the success or failure of the interchange. - 1 = Success, 0 = Failure - * - * @var string - */ + * Identifies the success or failure of the interchange. + * 1 = Success, 0 = Failure + * + * @var string + */ protected $responseStatusCode; /** * 'Success' or 'Failure' @@ -33,7 +33,9 @@ public function isInitialized($property): bool protected $responseStatusDescription; /** * If an error is encountered during the interchange, the Response contains an error. If the error is present, then the ErrorSeverity and ErrorCodes are required. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -61,11 +63,11 @@ public function setTransactionReference(ResponseTransactionReference $transactio return $this; } /** - * Identifies the success or failure of the interchange. - 1 = Success, 0 = Failure - * - * @return string - */ + * Identifies the success or failure of the interchange. + * 1 = Success, 0 = Failure + * + * @return string + */ public function getResponseStatusCode(): string { return $this->responseStatusCode; @@ -108,7 +110,9 @@ public function setResponseStatusDescription(string $responseStatusDescription): } /** * If an error is encountered during the interchange, the Response contains an error. If the error is present, then the ErrorSeverity and ErrorCodes are required. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/RateAlternateDeliveryAddressAddress.php b/src/Api/Model/RateAlternateDeliveryAddressAddress.php index b48bb679..6c7dea8c 100644 --- a/src/Api/Model/RateAlternateDeliveryAddressAddress.php +++ b/src/Api/Model/RateAlternateDeliveryAddressAddress.php @@ -49,17 +49,17 @@ public function isInitialized($property): bool */ protected $residentialAddressIndicator; /** - * Presence/Absence Indicator. Any value inside is ignored. - - This field is a flag to indicate if the Alternate Delivery location is a PO box location. - - True if POBoxIndicator tag exists; false otherwise. Not valid with Shipment Indication Types: - - 01 - Hold for Pickup at UPS Access Point - - 02 - UPS Access Point™ Delivery - - * - * @var string - */ + * Presence/Absence Indicator. Any value inside is ignored. + * + * This field is a flag to indicate if the Alternate Delivery location is a PO box location. + * + * True if POBoxIndicator tag exists; false otherwise. Not valid with Shipment Indication Types: + * - 01 - Hold for Pickup at UPS Access Point + * - 02 - UPS Access Point™ Delivery + * + * + * @var string + */ protected $pOBoxIndicator; /** * The UPS Access Point's street address, including name and number (when applicable). Length is not validated. @@ -194,17 +194,17 @@ public function setResidentialAddressIndicator(string $residentialAddressIndicat return $this; } /** - * Presence/Absence Indicator. Any value inside is ignored. - - This field is a flag to indicate if the Alternate Delivery location is a PO box location. - - True if POBoxIndicator tag exists; false otherwise. Not valid with Shipment Indication Types: - - 01 - Hold for Pickup at UPS Access Point - - 02 - UPS Access Point™ Delivery - - * - * @return string - */ + * Presence/Absence Indicator. Any value inside is ignored. + * + * This field is a flag to indicate if the Alternate Delivery location is a PO box location. + * + * True if POBoxIndicator tag exists; false otherwise. Not valid with Shipment Indication Types: + * - 01 - Hold for Pickup at UPS Access Point + * - 02 - UPS Access Point™ Delivery + * + * + * @return string + */ public function getPOBoxIndicator(): string { return $this->pOBoxIndicator; diff --git a/src/Api/Model/RatePackagePackageServiceOptions.php b/src/Api/Model/RatePackagePackageServiceOptions.php index c91d5ae6..d20e8ac8 100644 --- a/src/Api/Model/RatePackagePackageServiceOptions.php +++ b/src/Api/Model/RatePackagePackageServiceOptions.php @@ -67,30 +67,30 @@ public function isInitialized($property): bool */ protected $insurance; /** - * The UPSPremiumCareIndicator indicates special handling is required for shipment having controlled substances. Empty Tag means indicator is present. - - Valid only for Canada to Canada movements. - - Available for the following Return Services: - - Returns Exchange (available with a contract) - - Print Return Label - - Print and Mail - - Electronic Return Label - - Return Service Three Attempt - - May be requested with following UPS services: - - UPS Express® Early - - UPS Express - - UPS Express Saver - - UPS Standard. - - Not available for packages with the following: - - Delivery Confirmation - Signature Required - - Delivery Confirmation - Adult Signature Required. - - * - * @var string - */ + * The UPSPremiumCareIndicator indicates special handling is required for shipment having controlled substances. Empty Tag means indicator is present. + * + * Valid only for Canada to Canada movements. + * + * Available for the following Return Services: + * - Returns Exchange (available with a contract) + * - Print Return Label + * - Print and Mail + * - Electronic Return Label + * - Return Service Three Attempt + * + * May be requested with following UPS services: + * - UPS Express® Early + * - UPS Express + * - UPS Express Saver + * - UPS Standard. + * + * Not available for packages with the following: + * - Delivery Confirmation - Signature Required + * - Delivery Confirmation - Adult Signature Required. + * + * + * @var string + */ protected $uPSPremiumCareIndicator; /** * Container to hold HazMat information. Applies only if SubVersion is greater than or equal to 1701. @@ -303,30 +303,30 @@ public function setInsurance(PackageServiceOptionsInsurance $insurance): self return $this; } /** - * The UPSPremiumCareIndicator indicates special handling is required for shipment having controlled substances. Empty Tag means indicator is present. - - Valid only for Canada to Canada movements. - - Available for the following Return Services: - - Returns Exchange (available with a contract) - - Print Return Label - - Print and Mail - - Electronic Return Label - - Return Service Three Attempt - - May be requested with following UPS services: - - UPS Express® Early - - UPS Express - - UPS Express Saver - - UPS Standard. - - Not available for packages with the following: - - Delivery Confirmation - Signature Required - - Delivery Confirmation - Adult Signature Required. - - * - * @return string - */ + * The UPSPremiumCareIndicator indicates special handling is required for shipment having controlled substances. Empty Tag means indicator is present. + * + * Valid only for Canada to Canada movements. + * + * Available for the following Return Services: + * - Returns Exchange (available with a contract) + * - Print Return Label + * - Print and Mail + * - Electronic Return Label + * - Return Service Three Attempt + * + * May be requested with following UPS services: + * - UPS Express® Early + * - UPS Express + * - UPS Express Saver + * - UPS Standard. + * + * Not available for packages with the following: + * - Delivery Confirmation - Signature Required + * - Delivery Confirmation - Adult Signature Required. + * + * + * @return string + */ public function getUPSPremiumCareIndicator(): string { return $this->uPSPremiumCareIndicator; diff --git a/src/Api/Model/RatePackageServiceOptionsHazMat.php b/src/Api/Model/RatePackageServiceOptionsHazMat.php index 3b9c7c9f..b6af9744 100644 --- a/src/Api/Model/RatePackageServiceOptionsHazMat.php +++ b/src/Api/Model/RatePackageServiceOptionsHazMat.php @@ -37,8 +37,6 @@ public function isInitialized($property): bool */ protected $allPackedInOneIndicator; /** - * - * * @var list */ protected $hazMatChemicalRecord; @@ -131,8 +129,6 @@ public function setAllPackedInOneIndicator(string $allPackedInOneIndicator): sel return $this; } /** - * - * * @return list */ public function getHazMatChemicalRecord(): array @@ -140,8 +136,6 @@ public function getHazMatChemicalRecord(): array return $this->hazMatChemicalRecord; } /** - * - * * @param list $hazMatChemicalRecord * * @return self diff --git a/src/Api/Model/RateRequestRequest.php b/src/Api/Model/RateRequestRequest.php index c649058d..d2d9c487 100644 --- a/src/Api/Model/RateRequestRequest.php +++ b/src/Api/Model/RateRequestRequest.php @@ -13,17 +13,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Used to define the request type. Valid Values: - - Rate = The server rates (The default Request option is Rate if a Request Option is not provided). - - Shop = The server validates the shipment, and returns rates for all UPS products from the ShipFrom to the ShipTo addresses. - - Ratetimeintransit = The server rates with transit time information - - Shoptimeintransit = The server validates the shipment, and returns rates and transit times for all UPS products from the ShipFrom to the ShipTo addresses. - - Rate is the only valid request option for UPS Ground Freight Pricing requests. - - * - * @var string - */ + * Used to define the request type. Valid Values: + * - Rate = The server rates (The default Request option is Rate if a Request Option is not provided). + * - Shop = The server validates the shipment, and returns rates for all UPS products from the ShipFrom to the ShipTo addresses. + * - Ratetimeintransit = The server rates with transit time information + * - Shoptimeintransit = The server validates the shipment, and returns rates and transit times for all UPS products from the ShipFrom to the ShipTo addresses. + * + * Rate is the only valid request option for UPS Ground Freight Pricing requests. + * + * + * @var string + */ protected $requestOption; /** * Indicates Rate API to display the new release features in Rate API response based on Rate release. See the What's New section for the latest Rate release. Supported values: 1601, 1607, 1701, 1707, 2108, 2205 @@ -38,17 +38,17 @@ public function isInitialized($property): bool */ protected $transactionReference; /** - * Used to define the request type. Valid Values: - - Rate = The server rates (The default Request option is Rate if a Request Option is not provided). - - Shop = The server validates the shipment, and returns rates for all UPS products from the ShipFrom to the ShipTo addresses. - - Ratetimeintransit = The server rates with transit time information - - Shoptimeintransit = The server validates the shipment, and returns rates and transit times for all UPS products from the ShipFrom to the ShipTo addresses. - - Rate is the only valid request option for UPS Ground Freight Pricing requests. - - * - * @return string - */ + * Used to define the request type. Valid Values: + * - Rate = The server rates (The default Request option is Rate if a Request Option is not provided). + * - Shop = The server validates the shipment, and returns rates for all UPS products from the ShipFrom to the ShipTo addresses. + * - Ratetimeintransit = The server rates with transit time information + * - Shoptimeintransit = The server validates the shipment, and returns rates and transit times for all UPS products from the ShipFrom to the ShipTo addresses. + * + * Rate is the only valid request option for UPS Ground Freight Pricing requests. + * + * + * @return string + */ public function getRequestOption(): string { return $this->requestOption; diff --git a/src/Api/Model/RateRequestShipment.php b/src/Api/Model/RateRequestShipment.php index 1598ad55..1ae6762c 100644 --- a/src/Api/Model/RateRequestShipment.php +++ b/src/Api/Model/RateRequestShipment.php @@ -37,19 +37,17 @@ public function isInitialized($property): bool */ protected $shipFrom; /** - * Alternate Delivery Address container. Applies for deliveries to UPS Access Point™ locations. - - Required for the following ShipmentIndicationType values: - - 01 - Hold for Pickup at UPS Access Point™ - - 02 - UPS Access Point™ Delivery - - * - * @var RateShipmentAlternateDeliveryAddress - */ - protected $alternateDeliveryAddress; - /** + * Alternate Delivery Address container. Applies for deliveries to UPS Access Point™ locations. + * + * Required for the following ShipmentIndicationType values: + * - 01 - Hold for Pickup at UPS Access Point™ + * - 02 - UPS Access Point™ Delivery * * + * @var RateShipmentAlternateDeliveryAddress + */ + protected $alternateDeliveryAddress; + /** * @var list */ protected $shipmentIndicationType; @@ -102,8 +100,6 @@ public function isInitialized($property): bool */ protected $documentsOnlyIndicator; /** - * - * * @var list */ protected $package; @@ -250,15 +246,15 @@ public function setShipFrom(RateShipmentShipFrom $shipFrom): self return $this; } /** - * Alternate Delivery Address container. Applies for deliveries to UPS Access Point™ locations. - - Required for the following ShipmentIndicationType values: - - 01 - Hold for Pickup at UPS Access Point™ - - 02 - UPS Access Point™ Delivery - - * - * @return RateShipmentAlternateDeliveryAddress - */ + * Alternate Delivery Address container. Applies for deliveries to UPS Access Point™ locations. + * + * Required for the following ShipmentIndicationType values: + * - 01 - Hold for Pickup at UPS Access Point™ + * - 02 - UPS Access Point™ Delivery + * + * + * @return RateShipmentAlternateDeliveryAddress + */ public function getAlternateDeliveryAddress(): RateShipmentAlternateDeliveryAddress { return $this->alternateDeliveryAddress; @@ -282,8 +278,6 @@ public function setAlternateDeliveryAddress(RateShipmentAlternateDeliveryAddress return $this; } /** - * - * * @return list */ public function getShipmentIndicationType(): array @@ -291,8 +285,6 @@ public function getShipmentIndicationType(): array return $this->shipmentIndicationType; } /** - * - * * @param list $shipmentIndicationType * * @return self @@ -480,8 +472,6 @@ public function setDocumentsOnlyIndicator(string $documentsOnlyIndicator): self return $this; } /** - * - * * @return list */ public function getPackage(): array @@ -489,8 +479,6 @@ public function getPackage(): array return $this->package; } /** - * - * * @param list $package * * @return self diff --git a/src/Api/Model/RateResponse.php b/src/Api/Model/RateResponse.php index 2a425263..c36db6a8 100644 --- a/src/Api/Model/RateResponse.php +++ b/src/Api/Model/RateResponse.php @@ -20,7 +20,9 @@ public function isInitialized($property): bool protected $response; /** * RatedShipment Container. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -49,7 +51,9 @@ public function setResponse(RateResponseResponse $response): self } /** * RatedShipment Container. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/RateResponseRatedShipment.php b/src/Api/Model/RateResponseRatedShipment.php index cfdbc56d..4d043cea 100644 --- a/src/Api/Model/RateResponseRatedShipment.php +++ b/src/Api/Model/RateResponseRatedShipment.php @@ -14,7 +14,9 @@ public function isInitialized($property): bool } /** * Disclaimer is used to provide more information to the shipper regarding the processed shipment. It is used to notify the shipper about possible taxes and duties that might have been added or might apply to the shipment. Refer to the Appendix for various disclaimers. This field may be returned only if TaxInformationIndicator is present in the request. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -26,31 +28,33 @@ public function isInitialized($property): bool */ protected $service; /** - * Rate Type with which Shipment is rated. Possible RateChart values for different regions will be: - - US 48 origin: - - 1 – Daily Rates - - 3 – Standard List Rates - - 4 – Retail Rates. - - Alaska/Hawaii origin: - - 1 – Daily Rates - - 3 – Standard List Rates - - 4 – Retail Rates. - - All Other origins: - - 1 – Rates - - 5 - Regional Rates - - 6 - General List Rates. - - 3 and 4 do not apply - - * - * @var string - */ + * Rate Type with which Shipment is rated. Possible RateChart values for different regions will be: + * + * US 48 origin: + * - 1 – Daily Rates + * - 3 – Standard List Rates + * - 4 – Retail Rates. + * + * Alaska/Hawaii origin: + * - 1 – Daily Rates + * - 3 – Standard List Rates + * - 4 – Retail Rates. + * + * All Other origins: + * - 1 – Rates + * - 5 - Regional Rates + * - 6 - General List Rates. + * - 3 and 4 do not apply + * + * + * @var string + */ protected $rateChart; /** * Rated Shipment Alert container. There can be zero to many RatedShipmentAlert containers with code and description. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -87,7 +91,9 @@ public function isInitialized($property): bool protected $baseServiceCharge; /** * Itemized Charges are returned only when the subversion element is present and greater than or equal to '1601'. These charges would be returned only when subversion is greater than or equal to 1601. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -106,7 +112,9 @@ public function isInitialized($property): bool protected $serviceOptionsCharges; /** * TaxCharges container are returned only when TaxInformationIndicator is present in request and when Negotiated Rates are not applicable. TaxCharges container contains Tax information for a given shipment. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -131,7 +139,9 @@ public function isInitialized($property): bool protected $negotiatedRateCharges; /** * Rated Package Container. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -156,7 +166,9 @@ public function isInitialized($property): bool protected $roarRatedIndicator; /** * Disclaimer is used to provide more information to the shipper regarding the processed shipment. It is used to notify the shipper about possible taxes and duties that might have been added or might apply to the shipment. Refer to the Appendix for various disclaimers. This field may be returned only if TaxInformationIndicator is present in the request. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -201,27 +213,27 @@ public function setService(RatedShipmentService $service): self return $this; } /** - * Rate Type with which Shipment is rated. Possible RateChart values for different regions will be: - - US 48 origin: - - 1 – Daily Rates - - 3 – Standard List Rates - - 4 – Retail Rates. - - Alaska/Hawaii origin: - - 1 – Daily Rates - - 3 – Standard List Rates - - 4 – Retail Rates. - - All Other origins: - - 1 – Rates - - 5 - Regional Rates - - 6 - General List Rates. - - 3 and 4 do not apply - - * - * @return string - */ + * Rate Type with which Shipment is rated. Possible RateChart values for different regions will be: + * + * US 48 origin: + * - 1 – Daily Rates + * - 3 – Standard List Rates + * - 4 – Retail Rates. + * + * Alaska/Hawaii origin: + * - 1 – Daily Rates + * - 3 – Standard List Rates + * - 4 – Retail Rates. + * + * All Other origins: + * - 1 – Rates + * - 5 - Regional Rates + * - 6 - General List Rates. + * - 3 and 4 do not apply + * + * + * @return string + */ public function getRateChart(): string { return $this->rateChart; @@ -258,7 +270,9 @@ public function setRateChart(string $rateChart): self } /** * Rated Shipment Alert container. There can be zero to many RatedShipmentAlert containers with code and description. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -392,7 +406,9 @@ public function setBaseServiceCharge(RatedShipmentBaseServiceCharge $baseService } /** * Itemized Charges are returned only when the subversion element is present and greater than or equal to '1601'. These charges would be returned only when subversion is greater than or equal to 1601. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -460,7 +476,9 @@ public function setServiceOptionsCharges(RatedShipmentServiceOptionsCharges $ser } /** * TaxCharges container are returned only when TaxInformationIndicator is present in request and when Negotiated Rates are not applicable. TaxCharges container contains Tax information for a given shipment. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -550,7 +568,9 @@ public function setNegotiatedRateCharges(?RatedShipmentNegotiatedRateCharges $ne } /** * Rated Package Container. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/RateResponseResponse.php b/src/Api/Model/RateResponseResponse.php index 654db4bf..7d5fcb54 100644 --- a/src/Api/Model/RateResponseResponse.php +++ b/src/Api/Model/RateResponseResponse.php @@ -20,14 +20,18 @@ public function isInitialized($property): bool protected $responseStatus; /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $alert; /** * Alert Detail Container. Currently applies to and returned only for request containing HazMat and SubVersion greater than or equal to 1701. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -62,7 +66,9 @@ public function setResponseStatus(ResponseResponseStatus $responseStatus): self } /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -86,7 +92,9 @@ public function setAlert(array $alert): self } /** * Alert Detail Container. Currently applies to and returned only for request containing HazMat and SubVersion greater than or equal to 1701. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/RateResultChargeDetail.php b/src/Api/Model/RateResultChargeDetail.php index bcbd7438..7ff11160 100644 --- a/src/Api/Model/RateResultChargeDetail.php +++ b/src/Api/Model/RateResultChargeDetail.php @@ -13,25 +13,25 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Indicates the general charge type - - A = ACCESSORIAL TYPE - - B = BASE CHARGE TYPE - - S = SURCHARGE TYPE - * - * @var string - */ + * Indicates the general charge type + * - A = ACCESSORIAL TYPE + * - B = BASE CHARGE TYPE + * - S = SURCHARGE TYPE + * + * @var string + */ protected $chargeCode; /** - * Description of each charge.The possible descriptions are: - - BASE CHARGE - - EXTENDED AREA SURCHARGE - - FUEL SURCHARGE - - REMOTE AREA SURCHARGE - - RESIDENTIAL SURCHARGE - - SATURDAY ON-CALL STOP CHARGE - * - * @var string - */ + * Description of each charge.The possible descriptions are: + * - BASE CHARGE + * - EXTENDED AREA SURCHARGE + * - FUEL SURCHARGE + * - REMOTE AREA SURCHARGE + * - RESIDENTIAL SURCHARGE + * - SATURDAY ON-CALL STOP CHARGE + * + * @var string + */ protected $chargeDescription; /** * Monetary value of the charge. @@ -52,13 +52,13 @@ public function isInitialized($property): bool */ protected $taxAmount; /** - * Indicates the general charge type - - A = ACCESSORIAL TYPE - - B = BASE CHARGE TYPE - - S = SURCHARGE TYPE - * - * @return string - */ + * Indicates the general charge type + * - A = ACCESSORIAL TYPE + * - B = BASE CHARGE TYPE + * - S = SURCHARGE TYPE + * + * @return string + */ public function getChargeCode(): string { return $this->chargeCode; @@ -80,16 +80,16 @@ public function setChargeCode(string $chargeCode): self return $this; } /** - * Description of each charge.The possible descriptions are: - - BASE CHARGE - - EXTENDED AREA SURCHARGE - - FUEL SURCHARGE - - REMOTE AREA SURCHARGE - - RESIDENTIAL SURCHARGE - - SATURDAY ON-CALL STOP CHARGE - * - * @return string - */ + * Description of each charge.The possible descriptions are: + * - BASE CHARGE + * - EXTENDED AREA SURCHARGE + * - FUEL SURCHARGE + * - REMOTE AREA SURCHARGE + * - RESIDENTIAL SURCHARGE + * - SATURDAY ON-CALL STOP CHARGE + * + * @return string + */ public function getChargeDescription(): string { return $this->chargeDescription; diff --git a/src/Api/Model/RateResultDisclaimer.php b/src/Api/Model/RateResultDisclaimer.php index 4813b41d..756b8879 100644 --- a/src/Api/Model/RateResultDisclaimer.php +++ b/src/Api/Model/RateResultDisclaimer.php @@ -13,16 +13,16 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Disclaimer code. Valid values: - - 01 = Taxes are included in the shipping cost and apply to the transportation charges but additional duties/taxes may apply and are not reflected in the total amount due. - - 02 = Additional duties/taxes may apply and are not reflected in the total amount due. - - 03 = Additional duties/taxes may apply and are not reflected in the total amount due. - - 04 = Taxes were unable to be determined and may apply to the shipment. - - 05 = Rate excludes VAT. Rate includes a fuel surcharge, but excludes taxes, duties and other charges that may apply to the shipment. - - * - * @var string - */ + * Disclaimer code. Valid values: + * - 01 = Taxes are included in the shipping cost and apply to the transportation charges but additional duties/taxes may apply and are not reflected in the total amount due. + * - 02 = Additional duties/taxes may apply and are not reflected in the total amount due. + * - 03 = Additional duties/taxes may apply and are not reflected in the total amount due. + * - 04 = Taxes were unable to be determined and may apply to the shipment. + * - 05 = Rate excludes VAT. Rate includes a fuel surcharge, but excludes taxes, duties and other charges that may apply to the shipment. + * + * + * @var string + */ protected $code; /** * Description of Disclaimer. @@ -31,16 +31,16 @@ public function isInitialized($property): bool */ protected $description; /** - * Disclaimer code. Valid values: - - 01 = Taxes are included in the shipping cost and apply to the transportation charges but additional duties/taxes may apply and are not reflected in the total amount due. - - 02 = Additional duties/taxes may apply and are not reflected in the total amount due. - - 03 = Additional duties/taxes may apply and are not reflected in the total amount due. - - 04 = Taxes were unable to be determined and may apply to the shipment. - - 05 = Rate excludes VAT. Rate includes a fuel surcharge, but excludes taxes, duties and other charges that may apply to the shipment. - - * - * @return string - */ + * Disclaimer code. Valid values: + * - 01 = Taxes are included in the shipping cost and apply to the transportation charges but additional duties/taxes may apply and are not reflected in the total amount due. + * - 02 = Additional duties/taxes may apply and are not reflected in the total amount due. + * - 03 = Additional duties/taxes may apply and are not reflected in the total amount due. + * - 04 = Taxes were unable to be determined and may apply to the shipment. + * - 05 = Rate excludes VAT. Rate includes a fuel surcharge, but excludes taxes, duties and other charges that may apply to the shipment. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/RateResultTaxCharges.php b/src/Api/Model/RateResultTaxCharges.php index fca66d23..a53c0a2c 100644 --- a/src/Api/Model/RateResultTaxCharges.php +++ b/src/Api/Model/RateResultTaxCharges.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Type of Tax code. - Valid values: ALV, BTW, DDS, DDV, DPH, FPA, GST, IVA, IVA1, IVA2, IVA3, KM, MOMS, MWST, PDV, PST, PVM, PVN, QST, TVA, VAT, VSK. - * - * @var string - */ + * Type of Tax code. + * Valid values: ALV, BTW, DDS, DDV, DPH, FPA, GST, IVA, IVA1, IVA2, IVA3, KM, MOMS, MWST, PDV, PST, PVM, PVN, QST, TVA, VAT, VSK. + * + * @var string + */ protected $type; /** * Monetary value of the tax. @@ -26,11 +26,11 @@ public function isInitialized($property): bool */ protected $monetaryValue; /** - * Type of Tax code. - Valid values: ALV, BTW, DDS, DDV, DPH, FPA, GST, IVA, IVA1, IVA2, IVA3, KM, MOMS, MWST, PDV, PST, PVM, PVN, QST, TVA, VAT, VSK. - * - * @return string - */ + * Type of Tax code. + * Valid values: ALV, BTW, DDS, DDV, DPH, FPA, GST, IVA, IVA1, IVA2, IVA3, KM, MOMS, MWST, PDV, PST, PVM, PVN, QST, TVA, VAT, VSK. + * + * @return string + */ public function getType(): string { return $this->type; diff --git a/src/Api/Model/RateShipmentShipmentServiceOptions.php b/src/Api/Model/RateShipmentShipmentServiceOptions.php index d691dbca..fb87bf35 100644 --- a/src/Api/Model/RateShipmentShipmentServiceOptions.php +++ b/src/Api/Model/RateShipmentShipmentServiceOptions.php @@ -37,32 +37,32 @@ public function isInitialized($property): bool */ protected $availableServicesOption; /** - * Access Point COD indicates COD is requested for a shipment. Valid only for "01 - Hold For Pickup At UPS Access Point" Shipment Indication type. Shipment Access Point COD is valid only for countries or territories within E.U. - Not valid with (Shipment) COD. - Not available to shipment with return service. - * - * @var ShipmentServiceOptionsAccessPointCOD - */ + * Access Point COD indicates COD is requested for a shipment. Valid only for "01 - Hold For Pickup At UPS Access Point" Shipment Indication type. Shipment Access Point COD is valid only for countries or territories within E.U. + * Not valid with (Shipment) COD. + * Not available to shipment with return service. + * + * @var ShipmentServiceOptionsAccessPointCOD + */ protected $accessPointCOD; /** - * Presence/Absence Indicator. Any value inside is ignored. - - DeliverToAddresseeOnlyIndicator is shipper specified restriction that requires the addressee to be the one who takes final delivery of the "Hold For PickUp at UPS Access Point" package. - - Presence of indicator means shipper restriction will apply to the shipment. Only valid for Shipment Indication type "01 - Hold For PickUp at UPS Access Point". - - * - * @var string - */ + * Presence/Absence Indicator. Any value inside is ignored. + * + * DeliverToAddresseeOnlyIndicator is shipper specified restriction that requires the addressee to be the one who takes final delivery of the "Hold For PickUp at UPS Access Point" package. + * + * Presence of indicator means shipper restriction will apply to the shipment. Only valid for Shipment Indication type "01 - Hold For PickUp at UPS Access Point". + * + * + * @var string + */ protected $deliverToAddresseeOnlyIndicator; /** - * Presence/Absence Indicator. Any value inside is ignored. Direct Delivery Only (DDO) accessorial in a request would ensure that delivery is made only to the Ship To address on the shipping label. This accessorial is not valid with Shipment Indication Types: - - 01 - Hold For Pickup At UPS Access Point - - 02 - UPS Access Point™ Delivery - - * - * @var string - */ + * Presence/Absence Indicator. Any value inside is ignored. Direct Delivery Only (DDO) accessorial in a request would ensure that delivery is made only to the Ship To address on the shipping label. This accessorial is not valid with Shipment Indication Types: + * - 01 - Hold For Pickup At UPS Access Point + * - 02 - UPS Access Point™ Delivery + * + * + * @var string + */ protected $directDeliveryOnlyIndicator; /** * COD container Indicates COD is requested. Shipment COD is only available for EU origin countries or territories and for shippers account type Daily Pickup and Drop Shipping. Not available to shipment with return service. @@ -143,23 +143,23 @@ public function isInitialized($property): bool */ protected $sDLShipmentIndicator; /** - * For valid values, refer to Rating and Shipping COD Supported Countries or Territories in the Appendix.Presence/Absence Indicator. Any value inside is ignored. This field is a flag to indicate Package Release Code is requested for shipment. - - This accessorial is only valid with ShipmentIndicationType '01' - Hold for Pickup at UPS Access Point™. - - * - * @var string - */ + * For valid values, refer to Rating and Shipping COD Supported Countries or Territories in the Appendix.Presence/Absence Indicator. Any value inside is ignored. This field is a flag to indicate Package Release Code is requested for shipment. + * + * This accessorial is only valid with ShipmentIndicationType '01' - Hold for Pickup at UPS Access Point™. + * + * + * @var string + */ protected $ePRAIndicator; /** - * Inside Delivery accessory. Valid values: - - 01 - White Glove - - 02 - Room of Choice - - 03 - Installation Shippers account needs to have a valid contract for Heavy Goods Service. - - * - * @var string - */ + * Inside Delivery accessory. Valid values: + * - 01 - White Glove + * - 02 - Room of Choice + * - 03 - Installation Shippers account needs to have a valid contract for Heavy Goods Service. + * + * + * @var string + */ protected $insideDelivery; /** * Presence/Absence Indicator. Any value inside is ignored. If present, indicates that the customer would like items disposed. Shippers account needs to have a valid contract for Heavy Goods Service. @@ -256,12 +256,12 @@ public function setAvailableServicesOption(string $availableServicesOption): sel return $this; } /** - * Access Point COD indicates COD is requested for a shipment. Valid only for "01 - Hold For Pickup At UPS Access Point" Shipment Indication type. Shipment Access Point COD is valid only for countries or territories within E.U. - Not valid with (Shipment) COD. - Not available to shipment with return service. - * - * @return ShipmentServiceOptionsAccessPointCOD - */ + * Access Point COD indicates COD is requested for a shipment. Valid only for "01 - Hold For Pickup At UPS Access Point" Shipment Indication type. Shipment Access Point COD is valid only for countries or territories within E.U. + * Not valid with (Shipment) COD. + * Not available to shipment with return service. + * + * @return ShipmentServiceOptionsAccessPointCOD + */ public function getAccessPointCOD(): ShipmentServiceOptionsAccessPointCOD { return $this->accessPointCOD; @@ -282,15 +282,15 @@ public function setAccessPointCOD(ShipmentServiceOptionsAccessPointCOD $accessPo return $this; } /** - * Presence/Absence Indicator. Any value inside is ignored. - - DeliverToAddresseeOnlyIndicator is shipper specified restriction that requires the addressee to be the one who takes final delivery of the "Hold For PickUp at UPS Access Point" package. - - Presence of indicator means shipper restriction will apply to the shipment. Only valid for Shipment Indication type "01 - Hold For PickUp at UPS Access Point". - - * - * @return string - */ + * Presence/Absence Indicator. Any value inside is ignored. + * + * DeliverToAddresseeOnlyIndicator is shipper specified restriction that requires the addressee to be the one who takes final delivery of the "Hold For PickUp at UPS Access Point" package. + * + * Presence of indicator means shipper restriction will apply to the shipment. Only valid for Shipment Indication type "01 - Hold For PickUp at UPS Access Point". + * + * + * @return string + */ public function getDeliverToAddresseeOnlyIndicator(): string { return $this->deliverToAddresseeOnlyIndicator; @@ -314,13 +314,13 @@ public function setDeliverToAddresseeOnlyIndicator(string $deliverToAddresseeOnl return $this; } /** - * Presence/Absence Indicator. Any value inside is ignored. Direct Delivery Only (DDO) accessorial in a request would ensure that delivery is made only to the Ship To address on the shipping label. This accessorial is not valid with Shipment Indication Types: - - 01 - Hold For Pickup At UPS Access Point - - 02 - UPS Access Point™ Delivery - - * - * @return string - */ + * Presence/Absence Indicator. Any value inside is ignored. Direct Delivery Only (DDO) accessorial in a request would ensure that delivery is made only to the Ship To address on the shipping label. This accessorial is not valid with Shipment Indication Types: + * - 01 - Hold For Pickup At UPS Access Point + * - 02 - UPS Access Point™ Delivery + * + * + * @return string + */ public function getDirectDeliveryOnlyIndicator(): string { return $this->directDeliveryOnlyIndicator; @@ -628,13 +628,13 @@ public function setSDLShipmentIndicator(string $sDLShipmentIndicator): self return $this; } /** - * For valid values, refer to Rating and Shipping COD Supported Countries or Territories in the Appendix.Presence/Absence Indicator. Any value inside is ignored. This field is a flag to indicate Package Release Code is requested for shipment. - - This accessorial is only valid with ShipmentIndicationType '01' - Hold for Pickup at UPS Access Point™. - - * - * @return string - */ + * For valid values, refer to Rating and Shipping COD Supported Countries or Territories in the Appendix.Presence/Absence Indicator. Any value inside is ignored. This field is a flag to indicate Package Release Code is requested for shipment. + * + * This accessorial is only valid with ShipmentIndicationType '01' - Hold for Pickup at UPS Access Point™. + * + * + * @return string + */ public function getEPRAIndicator(): string { return $this->ePRAIndicator; @@ -656,14 +656,14 @@ public function setEPRAIndicator(string $ePRAIndicator): self return $this; } /** - * Inside Delivery accessory. Valid values: - - 01 - White Glove - - 02 - Room of Choice - - 03 - Installation Shippers account needs to have a valid contract for Heavy Goods Service. - - * - * @return string - */ + * Inside Delivery accessory. Valid values: + * - 01 - White Glove + * - 02 - Room of Choice + * - 03 - Installation Shippers account needs to have a valid contract for Heavy Goods Service. + * + * + * @return string + */ public function getInsideDelivery(): string { return $this->insideDelivery; diff --git a/src/Api/Model/RateShipmentShipper.php b/src/Api/Model/RateShipmentShipper.php index 2ed7b298..34042688 100644 --- a/src/Api/Model/RateShipmentShipper.php +++ b/src/Api/Model/RateShipmentShipper.php @@ -31,15 +31,15 @@ public function isInitialized($property): bool */ protected $shipperNumber; /** - * Address tag Container. The package should be returned to this address if the package is undeliverable. - - This address appears on the upper left hand corner of the label. - - Note: If the ShipFrom container is not present then this address will be used as the ShipFrom address. If this address is used as the ShipFrom the shipment will be rated from this origin address. - - * - * @var ShipperAddress - */ + * Address tag Container. The package should be returned to this address if the package is undeliverable. + * + * This address appears on the upper left hand corner of the label. + * + * Note: If the ShipFrom container is not present then this address will be used as the ShipFrom address. If this address is used as the ShipFrom the shipment will be rated from this origin address. + * + * + * @var ShipperAddress + */ protected $address; /** * Shipper's name or company name. Length is not validated. @@ -108,15 +108,15 @@ public function setShipperNumber(string $shipperNumber): self return $this; } /** - * Address tag Container. The package should be returned to this address if the package is undeliverable. - - This address appears on the upper left hand corner of the label. - - Note: If the ShipFrom container is not present then this address will be used as the ShipFrom address. If this address is used as the ShipFrom the shipment will be rated from this origin address. - - * - * @return ShipperAddress - */ + * Address tag Container. The package should be returned to this address if the package is undeliverable. + * + * This address appears on the upper left hand corner of the label. + * + * Note: If the ShipFrom container is not present then this address will be used as the ShipFrom address. If this address is used as the ShipFrom the shipment will be rated from this origin address. + * + * + * @return ShipperAddress + */ public function getAddress(): ShipperAddress { return $this->address; diff --git a/src/Api/Model/RatedPackageNegotiatedCharges.php b/src/Api/Model/RatedPackageNegotiatedCharges.php index 8bf0d829..3ade0b64 100644 --- a/src/Api/Model/RatedPackageNegotiatedCharges.php +++ b/src/Api/Model/RatedPackageNegotiatedCharges.php @@ -14,14 +14,18 @@ public function isInitialized($property): bool } /** * Negotiated Itemized Accessorial and Sur Charges. These charges would be returned only when subversion is greater than or equal to 1607. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $itemizedCharges; /** * Negotiated Itemized Accessorial and Sur Charges. These charges would be returned only when subversion is greater than or equal to 1607. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/RatedPackageSimpleRate.php b/src/Api/Model/RatedPackageSimpleRate.php index f55ae419..a43d606b 100644 --- a/src/Api/Model/RatedPackageSimpleRate.php +++ b/src/Api/Model/RatedPackageSimpleRate.php @@ -13,28 +13,28 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Simple Rate Code - - XS = Extra Small - - S = Small - - M = Medium - - L = Large - - XL = Extra Large - - * - * @var string - */ + * Simple Rate Code + * - XS = Extra Small + * - S = Small + * - M = Medium + * - L = Large + * - XL = Extra Large + * + * + * @var string + */ protected $code; /** - * Simple Rate Code - - XS = Extra Small - - S = Small - - M = Medium - - L = Large - - XL = Extra Large - - * - * @return string - */ + * Simple Rate Code + * - XS = Extra Small + * - S = Small + * - M = Medium + * - L = Large + * - XL = Extra Large + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/RatedShipmentFRSShipmentData.php b/src/Api/Model/RatedShipmentFRSShipmentData.php index bc1d7836..c08fd425 100644 --- a/src/Api/Model/RatedShipmentFRSShipmentData.php +++ b/src/Api/Model/RatedShipmentFRSShipmentData.php @@ -26,7 +26,9 @@ public function isInitialized($property): bool protected $freightDensityRate; /** * Handling Unit for Density based rating container. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -77,7 +79,9 @@ public function setFreightDensityRate(FRSShipmentDataFreightDensityRate $freight } /** * Handling Unit for Density based rating container. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/RatedShipmentNegotiatedRateCharges.php b/src/Api/Model/RatedShipmentNegotiatedRateCharges.php index 5c8b249e..8bc0ff87 100644 --- a/src/Api/Model/RatedShipmentNegotiatedRateCharges.php +++ b/src/Api/Model/RatedShipmentNegotiatedRateCharges.php @@ -14,14 +14,18 @@ public function isInitialized($property): bool } /** * Itemized Charges are returned only when the subversion element is present and greater than or equal to '1601'. These charges would be returned only when subversion is greater than or equal to 1601. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $itemizedCharges; /** * TaxCharges container are returned only when TaxInformationIndicator is present in request. TaxCharges container contains Tax information for a given shipment. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -40,7 +44,9 @@ public function isInitialized($property): bool protected $totalChargesWithTaxes; /** * Itemized Charges are returned only when the subversion element is present and greater than or equal to '1601'. These charges would be returned only when subversion is greater than or equal to 1601. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -64,7 +70,9 @@ public function setItemizedCharges(array $itemizedCharges): self } /** * TaxCharges container are returned only when TaxInformationIndicator is present in request. TaxCharges container contains Tax information for a given shipment. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/RatedShipmentRatedPackage.php b/src/Api/Model/RatedShipmentRatedPackage.php index 38b226f7..1a85abbe 100644 --- a/src/Api/Model/RatedShipmentRatedPackage.php +++ b/src/Api/Model/RatedShipmentRatedPackage.php @@ -50,14 +50,18 @@ public function isInitialized($property): bool protected $billingWeight; /** * The container for Accessorial indicators. This information would be returned only if ItemizedChargesRequested was present during Rate request. This is valid only for UPS Worldwide Express Freight and UPS Worldwide Express Freight Mid-day service request with Dry Ice or Oversize Pallet and SubVersion greater than or equal to 1707. This is valid only for UPS Worldwide Express Freight and UPS Worldwide Express Freight Middday Service. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $accessorial; /** * Itemized Charges are returned only when the subversion element is present and greater than or equal to '1607'. These charges would be returned only when subversion is greater than or equal to 1607. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -76,7 +80,9 @@ public function isInitialized($property): bool protected $simpleRate; /** * Container for returned Rate Modifier information. Applies only if SubVersion is 2205 or greater. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -215,7 +221,9 @@ public function setBillingWeight(RatedPackageBillingWeight $billingWeight): self } /** * The container for Accessorial indicators. This information would be returned only if ItemizedChargesRequested was present during Rate request. This is valid only for UPS Worldwide Express Freight and UPS Worldwide Express Freight Mid-day service request with Dry Ice or Oversize Pallet and SubVersion greater than or equal to 1707. This is valid only for UPS Worldwide Express Freight and UPS Worldwide Express Freight Middday Service. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -239,7 +247,9 @@ public function setAccessorial(array $accessorial): self } /** * Itemized Charges are returned only when the subversion element is present and greater than or equal to '1607'. These charges would be returned only when subversion is greater than or equal to 1607. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -307,7 +317,9 @@ public function setSimpleRate(RatedPackageSimpleRate $simpleRate): self } /** * Container for returned Rate Modifier information. Applies only if SubVersion is 2205 or greater. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/ReceiptImageImageFormat.php b/src/Api/Model/ReceiptImageImageFormat.php index 5924e2c5..bbb86ab3 100644 --- a/src/Api/Model/ReceiptImageImageFormat.php +++ b/src/Api/Model/ReceiptImageImageFormat.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code representing the format in which a receipt is returned. Valid values: - - HTML = HTML format - - PDF = pdf - - * - * @var string - */ + * Code representing the format in which a receipt is returned. Valid values: + * - HTML = HTML format + * - PDF = pdf + * + * + * @var string + */ protected $code; /** * Description of the form image format code. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $description; /** - * Code representing the format in which a receipt is returned. Valid values: - - HTML = HTML format - - PDF = pdf - - * - * @return string - */ + * Code representing the format in which a receipt is returned. Valid values: + * - HTML = HTML format + * - PDF = pdf + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ReferenceWeight.php b/src/Api/Model/ReferenceWeight.php index 2186141b..9d99fd3f 100644 --- a/src/Api/Model/ReferenceWeight.php +++ b/src/Api/Model/ReferenceWeight.php @@ -19,18 +19,18 @@ public function isInitialized($property): bool */ protected $unitOfMeasurement; /** - * The value for the total weight associated with this reference. - - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @var string - */ + * The value for the total weight associated with this reference. + * + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @var string + */ protected $value; /** * Reference Weight UnitOfMeasurement Container. @@ -55,18 +55,18 @@ public function setUnitOfMeasurement(WeightUnitOfMeasurement $unitOfMeasurement) return $this; } /** - * The value for the total weight associated with this reference. - - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @return string - */ + * The value for the total weight associated with this reference. + * + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @return string + */ public function getValue(): string { return $this->value; diff --git a/src/Api/Model/ResponseError.php b/src/Api/Model/ResponseError.php index 73fed20a..2379c8eb 100644 --- a/src/Api/Model/ResponseError.php +++ b/src/Api/Model/ResponseError.php @@ -38,14 +38,18 @@ public function isInitialized($property): bool protected $minimumRetrySeconds; /** * Identifies the element in error. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $errorLocation; /** * The contents of the element in error. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -140,7 +144,9 @@ public function setMinimumRetrySeconds(string $minimumRetrySeconds): self } /** * Identifies the element in error. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -164,7 +170,9 @@ public function setErrorLocation(array $errorLocation): self } /** * The contents of the element in error. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/ResponseResponseStatus.php b/src/Api/Model/ResponseResponseStatus.php index 5f4f2b82..89a0c290 100644 --- a/src/Api/Model/ResponseResponseStatus.php +++ b/src/Api/Model/ResponseResponseStatus.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Identifies the success or failure of the transaction. - 1 = Successful - * - * @var string - */ + * Identifies the success or failure of the transaction. + * 1 = Successful + * + * @var string + */ protected $code; /** * Describes Response Status Code.Returns text of "Success". @@ -26,11 +26,11 @@ public function isInitialized($property): bool */ protected $description; /** - * Identifies the success or failure of the transaction. - 1 = Successful - * - * @return string - */ + * Identifies the success or failure of the transaction. + * 1 = Successful + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ScheduleBUnitOfMeasurement.php b/src/Api/Model/ScheduleBUnitOfMeasurement.php index adb7cc28..da162abf 100644 --- a/src/Api/Model/ScheduleBUnitOfMeasurement.php +++ b/src/Api/Model/ScheduleBUnitOfMeasurement.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The unit of measure indicated on the Export License. Enter an X if there is no unit of measure in the Schedule B Unit field. Applies to EEI forms only. Required for the EEI form. - - Refer to ScheduleB Unit of Measure Codes in the Appendix for valid values. - - * - * @var string - */ + * The unit of measure indicated on the Export License. Enter an X if there is no unit of measure in the Schedule B Unit field. Applies to EEI forms only. Required for the EEI form. + * + * Refer to ScheduleB Unit of Measure Codes in the Appendix for valid values. + * + * + * @var string + */ protected $code; /** * Description of the Unit of Measure. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $description; /** - * The unit of measure indicated on the Export License. Enter an X if there is no unit of measure in the Schedule B Unit field. Applies to EEI forms only. Required for the EEI form. - - Refer to ScheduleB Unit of Measure Codes in the Appendix for valid values. - - * - * @return string - */ + * The unit of measure indicated on the Export License. Enter an X if there is no unit of measure in the Schedule B Unit field. Applies to EEI forms only. Required for the EEI form. + * + * Refer to ScheduleB Unit of Measure Codes in the Appendix for valid values. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/SearchOptionOptionCode.php b/src/Api/Model/SearchOptionOptionCode.php index 31a82701..8be58024 100644 --- a/src/Api/Model/SearchOptionOptionCode.php +++ b/src/Api/Model/SearchOptionOptionCode.php @@ -13,22 +13,22 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * These codes vary by country. It is strongly recommended that clients contact UPS to retrieve the primary search indicator and the valid Location Types and Service Level Options for each country or territory. - - Refer to Location Search Option Codes in the Appendix for additional information. - - * - * @var string - */ + * These codes vary by country. It is strongly recommended that clients contact UPS to retrieve the primary search indicator and the valid Location Types and Service Level Options for each country or territory. + * + * Refer to Location Search Option Codes in the Appendix for additional information. + * + * + * @var string + */ protected $code; /** - * These codes vary by country. It is strongly recommended that clients contact UPS to retrieve the primary search indicator and the valid Location Types and Service Level Options for each country or territory. - - Refer to Location Search Option Codes in the Appendix for additional information. - - * - * @return string - */ + * These codes vary by country. It is strongly recommended that clients contact UPS to retrieve the primary search indicator and the valid Location Types and Service Level Options for each country or territory. + * + * Refer to Location Search Option Codes in the Appendix for additional information. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/SearchOptionOptionType.php b/src/Api/Model/SearchOptionOptionType.php index 7a867732..3f6aa711 100644 --- a/src/Api/Model/SearchOptionOptionType.php +++ b/src/Api/Model/SearchOptionOptionType.php @@ -13,32 +13,32 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code for Option type valid values are: - - - 01-Location - - 02-Retail Location - - 03-Additional Services - - 04-Program Type - - 05-Service Level Option. - - 06-End Point Service Offering - - * - * @var string - */ + * Code for Option type valid values are: + * + * - 01-Location + * - 02-Retail Location + * - 03-Additional Services + * - 04-Program Type + * - 05-Service Level Option. + * - 06-End Point Service Offering + * + * + * @var string + */ protected $code; /** - * Code for Option type valid values are: - - - 01-Location - - 02-Retail Location - - 03-Additional Services - - 04-Program Type - - 05-Service Level Option. - - 06-End Point Service Offering - - * - * @return string - */ + * Code for Option type valid values are: + * + * - 01-Location + * - 02-Retail Location + * - 03-Additional Services + * - 04-Program Type + * - 05-Service Level Option. + * - 06-End Point Service Offering + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/SearchOptionRelation.php b/src/Api/Model/SearchOptionRelation.php index d7ecb6c9..bd1bf131 100644 --- a/src/Api/Model/SearchOptionRelation.php +++ b/src/Api/Model/SearchOptionRelation.php @@ -13,28 +13,28 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Applicable for Additional Services and Program Types. - - Valid values: - - - 01 - And (Default) - - 02 - Or - - * - * @var string - */ + * Applicable for Additional Services and Program Types. + * + * Valid values: + * + * - 01 - And (Default) + * - 02 - Or + * + * + * @var string + */ protected $code; /** - * Applicable for Additional Services and Program Types. - - Valid values: - - - 01 - And (Default) - - 02 - Or - - * - * @return string - */ + * Applicable for Additional Services and Program Types. + * + * Valid values: + * + * - 01 - And (Default) + * - 02 - Or + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/SearchResultsDropLocation.php b/src/Api/Model/SearchResultsDropLocation.php index e32b3ab6..a9cd16ef 100644 --- a/src/Api/Model/SearchResultsDropLocation.php +++ b/src/Api/Model/SearchResultsDropLocation.php @@ -19,19 +19,19 @@ public function isInitialized($property): bool */ protected $locationID; /** - * OriginOrDestination will returned for FreightWillCallRequestType 1 Postal based and 3 City and/or State based search. - - OriginOrDestination will be 01 for origin facilities and 02 for Destination facilities - * - * @var string - */ + * OriginOrDestination will returned for FreightWillCallRequestType 1 Postal based and 3 City and/or State based search. + * + * OriginOrDestination will be 01 for origin facilities and 02 for Destination facilities + * + * @var string + */ protected $originOrDestination; /** - * Integrated Voice Response information. - ONLY FOR IVR. - * - * @var DropLocationIVR - */ + * Integrated Voice Response information. + * ONLY FOR IVR. + * + * @var DropLocationIVR + */ protected $iVR; /** * Geocode is the latitude and longitude of the location address. The Geocode for the location address will be returned when Location is requested in the Request Option. @@ -46,25 +46,25 @@ public function isInitialized($property): bool */ protected $addressKeyFormat; /** - * The UPS locations Phone number. A phone number of the location will be returned. - - 10 digits allowed for US, otherwise 1..15 digits allowed. - - The phone number will be returned as a string. - - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @var list - */ + * The UPS locations Phone number. A phone number of the location will be returned. + * + * 10 digits allowed for US, otherwise 1..15 digits allowed. + * + * The phone number will be returned as a string. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * + * @var list + */ protected $phoneNumber; /** - * The UPS location's Fax number. A fax number of the location will be returned when available. - 10 digits allowed for US, otherwise 1..15 digits allowed. - The fax number will be returned as string. - * - * @var string - */ + * The UPS location's Fax number. A fax number of the location will be returned when available. + * 10 digits allowed for US, otherwise 1..15 digits allowed. + * The fax number will be returned as string. + * + * @var string + */ protected $faxNumber; /** * Email address of the UPS location. Returned when available. @@ -73,17 +73,17 @@ public function isInitialized($property): bool */ protected $eMailAddress; /** - * OptionType is a container that indicates the type of the location attribute. - - There are 4 types of attributes. - - They are: Location, Retail Location, Additional Services and Program Type. - - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @var list - */ + * OptionType is a container that indicates the type of the location attribute. + * + * There are 4 types of attributes. + * + * They are: Location, Retail Location, Additional Services and Program Type. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * + * @var list + */ protected $locationAttribute; /** * Container for the straight line distance from the origin to the UPS location. @@ -93,32 +93,34 @@ public function isInitialized($property): bool protected $distance; /** * Walking directions. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $specialInstructions; /** - * The latest ground time the users can Drop-off the package at the location to be picked up. The time information is based on the time at the UPS location. - - When a user specifies a Drop-off Time and Ground as the Service Type, the locations that have latest Drop-off times equal to or later than the specified Drop-off time and service type are returned. - - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @var list - */ + * The latest ground time the users can Drop-off the package at the location to be picked up. The time information is based on the time at the UPS location. + * + * When a user specifies a Drop-off Time and Ground as the Service Type, the locations that have latest Drop-off times equal to or later than the specified Drop-off time and service type are returned. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * + * @var list + */ protected $latestGroundDropOffTime; /** - * The latest airtime the users can Drop-off the package at the location to be picked up. The time information is based on the time at the UPS location. - - When a user specifies a Drop-off Time and Air as the Service Type, the locations that have latest Drop-off times equal to or later than the specified Drop-off time and service type are returned. - - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @var list - */ + * The latest airtime the users can Drop-off the package at the location to be picked up. The time information is based on the time at the UPS location. + * + * When a user specifies a Drop-off Time and Air as the Service Type, the locations that have latest Drop-off times equal to or later than the specified Drop-off time and service type are returned. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * + * @var list + */ protected $latestAirDropOffTime; /** * Presence or Absence Indicator. If present, Indicates if the UPS location would have an additional charge. ASO locations will require an additional charge. @@ -170,7 +172,9 @@ public function isInitialized($property): bool protected $additionalComments; /** * Textual disclaimer about the drop location. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -201,14 +205,18 @@ public function isInitialized($property): bool protected $operatingHours; /** * LocalizedInstruction container. Applicable for SearchOptionCode 01, 02, 03. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $localizedInstruction; /** * Container to hold any promotion text for the location. Text will be displayed in English or the locale given in the request. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -226,13 +234,13 @@ public function isInitialized($property): bool */ protected $serviceOfferingList; /** - * Valid Values: - 0-Do not display phone number - 1-Display phone number. - This indicator will be returned only for the contact type Telephone number. This indicator is used by the clients to determine whether to display the telephone number to the end user. - * - * @var string - */ + * Valid Values: + * 0-Do not display phone number + * 1-Display phone number. + * This indicator will be returned only for the contact type Telephone number. This indicator is used by the clients to determine whether to display the telephone number to the end user. + * + * @var string + */ protected $displayPhoneNumberIndicator; /** * Container for UPS Access Point specific parameters. @@ -259,24 +267,24 @@ public function isInitialized($property): bool */ protected $promotionalLinkURL; /** - * Feature Ranking values: - Null or blank - Location is not featured. - 1 - Featured Location ranked number 1. - 2 - Featured Location ranked number 2. - * - * @var string - */ + * Feature Ranking values: + * Null or blank - Location is not featured. + * 1 - Featured Location ranked number 1. + * 2 - Featured Location ranked number 2. + * + * @var string + */ protected $featuredRank; /** - * Will Call Location Indicator values: - - Y – Signifies a Will Call location that serves the customers address. - - N - Signifies it is not a Will Call location. - - Will Call locations are only returned with a \"Y\" indicator if the request included EnhancedSearchOption code 10. - - * - * @var string - */ + * Will Call Location Indicator values: + * - Y – Signifies a Will Call location that serves the customers address. + * - N - Signifies it is not a Will Call location. + * + * Will Call locations are only returned with a \"Y\" indicator if the request included EnhancedSearchOption code 10. + * + * + * @var string + */ protected $willCallLocationIndicator; /** * The location ID that corresponds to the UPS location. Do not expose the Location ID. @@ -301,12 +309,12 @@ public function setLocationID(string $locationID): self return $this; } /** - * OriginOrDestination will returned for FreightWillCallRequestType 1 Postal based and 3 City and/or State based search. - - OriginOrDestination will be 01 for origin facilities and 02 for Destination facilities - * - * @return string - */ + * OriginOrDestination will returned for FreightWillCallRequestType 1 Postal based and 3 City and/or State based search. + * + * OriginOrDestination will be 01 for origin facilities and 02 for Destination facilities + * + * @return string + */ public function getOriginOrDestination(): string { return $this->originOrDestination; @@ -327,11 +335,11 @@ public function setOriginOrDestination(string $originOrDestination): self return $this; } /** - * Integrated Voice Response information. - ONLY FOR IVR. - * - * @return DropLocationIVR - */ + * Integrated Voice Response information. + * ONLY FOR IVR. + * + * @return DropLocationIVR + */ public function getIVR(): DropLocationIVR { return $this->iVR; @@ -395,17 +403,17 @@ public function setAddressKeyFormat(DropLocationAddressKeyFormat $addressKeyForm return $this; } /** - * The UPS locations Phone number. A phone number of the location will be returned. - - 10 digits allowed for US, otherwise 1..15 digits allowed. - - The phone number will be returned as a string. - - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @return list - */ + * The UPS locations Phone number. A phone number of the location will be returned. + * + * 10 digits allowed for US, otherwise 1..15 digits allowed. + * + * The phone number will be returned as a string. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * + * @return list + */ public function getPhoneNumber(): array { return $this->phoneNumber; @@ -431,12 +439,12 @@ public function setPhoneNumber(array $phoneNumber): self return $this; } /** - * The UPS location's Fax number. A fax number of the location will be returned when available. - 10 digits allowed for US, otherwise 1..15 digits allowed. - The fax number will be returned as string. - * - * @return string - */ + * The UPS location's Fax number. A fax number of the location will be returned when available. + * 10 digits allowed for US, otherwise 1..15 digits allowed. + * The fax number will be returned as string. + * + * @return string + */ public function getFaxNumber(): string { return $this->faxNumber; @@ -479,17 +487,17 @@ public function setEMailAddress(string $eMailAddress): self return $this; } /** - * OptionType is a container that indicates the type of the location attribute. - - There are 4 types of attributes. - - They are: Location, Retail Location, Additional Services and Program Type. - - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @return list - */ + * OptionType is a container that indicates the type of the location attribute. + * + * There are 4 types of attributes. + * + * They are: Location, Retail Location, Additional Services and Program Type. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * + * @return list + */ public function getLocationAttribute(): array { return $this->locationAttribute; @@ -538,7 +546,9 @@ public function setDistance(DropLocationDistance $distance): self } /** * Walking directions. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -561,15 +571,15 @@ public function setSpecialInstructions(array $specialInstructions): self return $this; } /** - * The latest ground time the users can Drop-off the package at the location to be picked up. The time information is based on the time at the UPS location. - - When a user specifies a Drop-off Time and Ground as the Service Type, the locations that have latest Drop-off times equal to or later than the specified Drop-off time and service type are returned. - - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @return list - */ + * The latest ground time the users can Drop-off the package at the location to be picked up. The time information is based on the time at the UPS location. + * + * When a user specifies a Drop-off Time and Ground as the Service Type, the locations that have latest Drop-off times equal to or later than the specified Drop-off time and service type are returned. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * + * @return list + */ public function getLatestGroundDropOffTime(): array { return $this->latestGroundDropOffTime; @@ -593,15 +603,15 @@ public function setLatestGroundDropOffTime(array $latestGroundDropOffTime): self return $this; } /** - * The latest airtime the users can Drop-off the package at the location to be picked up. The time information is based on the time at the UPS location. - - When a user specifies a Drop-off Time and Air as the Service Type, the locations that have latest Drop-off times equal to or later than the specified Drop-off time and service type are returned. - - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @return list - */ + * The latest airtime the users can Drop-off the package at the location to be picked up. The time information is based on the time at the UPS location. + * + * When a user specifies a Drop-off Time and Air as the Service Type, the locations that have latest Drop-off times equal to or later than the specified Drop-off time and service type are returned. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * + * @return list + */ public function getLatestAirDropOffTime(): array { return $this->latestAirDropOffTime; @@ -802,7 +812,9 @@ public function setAdditionalComments(DropLocationAdditionalComments $additional } /** * Textual disclaimer about the drop location. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -914,7 +926,9 @@ public function setOperatingHours(DropLocationOperatingHours $operatingHours): s } /** * LocalizedInstruction container. Applicable for SearchOptionCode 01, 02, 03. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -938,7 +952,9 @@ public function setLocalizedInstruction(array $localizedInstruction): self } /** * Container to hold any promotion text for the location. Text will be displayed in English or the locale given in the request. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -1005,13 +1021,13 @@ public function setServiceOfferingList(DropLocationServiceOfferingList $serviceO return $this; } /** - * Valid Values: - 0-Do not display phone number - 1-Display phone number. - This indicator will be returned only for the contact type Telephone number. This indicator is used by the clients to determine whether to display the telephone number to the end user. - * - * @return string - */ + * Valid Values: + * 0-Do not display phone number + * 1-Display phone number. + * This indicator will be returned only for the contact type Telephone number. This indicator is used by the clients to determine whether to display the telephone number to the end user. + * + * @return string + */ public function getDisplayPhoneNumberIndicator(): string { return $this->displayPhoneNumberIndicator; @@ -1121,13 +1137,13 @@ public function setPromotionalLinkURL(string $promotionalLinkURL): self return $this; } /** - * Feature Ranking values: - Null or blank - Location is not featured. - 1 - Featured Location ranked number 1. - 2 - Featured Location ranked number 2. - * - * @return string - */ + * Feature Ranking values: + * Null or blank - Location is not featured. + * 1 - Featured Location ranked number 1. + * 2 - Featured Location ranked number 2. + * + * @return string + */ public function getFeaturedRank(): string { return $this->featuredRank; @@ -1149,15 +1165,15 @@ public function setFeaturedRank(string $featuredRank): self return $this; } /** - * Will Call Location Indicator values: - - Y – Signifies a Will Call location that serves the customers address. - - N - Signifies it is not a Will Call location. - - Will Call locations are only returned with a \"Y\" indicator if the request included EnhancedSearchOption code 10. - - * - * @return string - */ + * Will Call Location Indicator values: + * - Y – Signifies a Will Call location that serves the customers address. + * - N - Signifies it is not a Will Call location. + * + * Will Call locations are only returned with a \"Y\" indicator if the request included EnhancedSearchOption code 10. + * + * + * @return string + */ public function getWillCallLocationIndicator(): string { return $this->willCallLocationIndicator; diff --git a/src/Api/Model/ServiceCenterLocationDropOffFacilities.php b/src/Api/Model/ServiceCenterLocationDropOffFacilities.php index 6fa388a2..554f788c 100644 --- a/src/Api/Model/ServiceCenterLocationDropOffFacilities.php +++ b/src/Api/Model/ServiceCenterLocationDropOffFacilities.php @@ -37,13 +37,13 @@ public function isInitialized($property): bool */ protected $type; /** - * Facility's Timezone. Format: - - America/New_York - - Asia/Hong_Kong - - Europe/London - * - * @var string - */ + * Facility's Timezone. Format: + * - America/New_York + * - Asia/Hong_Kong + * - Europe/London + * + * @var string + */ protected $timezone; /** * Phone Number of the Drop off Facility @@ -70,8 +70,6 @@ public function isInitialized($property): bool */ protected $originOrDestination; /** - * - * * @var list */ protected $localizedInstruction; @@ -170,13 +168,13 @@ public function setType(string $type): self return $this; } /** - * Facility's Timezone. Format: - - America/New_York - - Asia/Hong_Kong - - Europe/London - * - * @return string - */ + * Facility's Timezone. Format: + * - America/New_York + * - Asia/Hong_Kong + * - Europe/London + * + * @return string + */ public function getTimezone(): string { return $this->timezone; @@ -286,8 +284,6 @@ public function setOriginOrDestination(string $originOrDestination): self return $this; } /** - * - * * @return list */ public function getLocalizedInstruction(): array @@ -295,8 +291,6 @@ public function getLocalizedInstruction(): array return $this->localizedInstruction; } /** - * - * * @param list $localizedInstruction * * @return self diff --git a/src/Api/Model/ServiceCenterLocationPickupFacilities.php b/src/Api/Model/ServiceCenterLocationPickupFacilities.php index d62d22b3..651b8779 100644 --- a/src/Api/Model/ServiceCenterLocationPickupFacilities.php +++ b/src/Api/Model/ServiceCenterLocationPickupFacilities.php @@ -37,13 +37,13 @@ public function isInitialized($property): bool */ protected $type; /** - * Facility's Timezone. Format: - - America/New_York - - Asia/Hong_Kong - - Europe/London - * - * @var string - */ + * Facility's Timezone. Format: + * - America/New_York + * - Asia/Hong_Kong + * - Europe/London + * + * @var string + */ protected $timezone; /** * Phone Number of the Pickup Facility @@ -64,19 +64,19 @@ public function isInitialized($property): bool */ protected $facilityTime; /** - * AirPort Code for destination/pickup facility. - Example: ATL (Atlanta) - If Airport code is not present "---" will be returned. - * - * @var string - */ + * AirPort Code for destination/pickup facility. + * Example: ATL (Atlanta) + * If Airport code is not present "---" will be returned. + * + * @var string + */ protected $airportCode; /** - * Sort Code for destination/pickup facility. - Example: V1 - * - * @var string - */ + * Sort Code for destination/pickup facility. + * Example: V1 + * + * @var string + */ protected $sortCode; /** * Name of the facility @@ -167,13 +167,13 @@ public function setType(string $type): self return $this; } /** - * Facility's Timezone. Format: - - America/New_York - - Asia/Hong_Kong - - Europe/London - * - * @return string - */ + * Facility's Timezone. Format: + * - America/New_York + * - Asia/Hong_Kong + * - Europe/London + * + * @return string + */ public function getTimezone(): string { return $this->timezone; @@ -261,12 +261,12 @@ public function setFacilityTime(PickupFacilitiesFacilityTime $facilityTime): sel return $this; } /** - * AirPort Code for destination/pickup facility. - Example: ATL (Atlanta) - If Airport code is not present "---" will be returned. - * - * @return string - */ + * AirPort Code for destination/pickup facility. + * Example: ATL (Atlanta) + * If Airport code is not present "---" will be returned. + * + * @return string + */ public function getAirportCode(): string { return $this->airportCode; @@ -287,11 +287,11 @@ public function setAirportCode(string $airportCode): self return $this; } /** - * Sort Code for destination/pickup facility. - Example: V1 - * - * @return string - */ + * Sort Code for destination/pickup facility. + * Example: V1 + * + * @return string + */ public function getSortCode(): string { return $this->sortCode; diff --git a/src/Api/Model/ServiceOfferingListServiceOffering.php b/src/Api/Model/ServiceOfferingListServiceOffering.php index 972b4cce..ab1d2a9c 100644 --- a/src/Api/Model/ServiceOfferingListServiceOffering.php +++ b/src/Api/Model/ServiceOfferingListServiceOffering.php @@ -13,23 +13,23 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The valid values are: - 001-Direct To Retail - 002-Not In One ADL - 003-Click and Collect - 004-Retail to Retail - 005-Pickup - 006-Drop Off - 007-PUDO - 008-Early Pickup Delivery Time - 009-Accept prepaid drop offs - 010-DCO DCR intercept accepted - 011-Accepts Payments - 012-Pay At Store - 013-Accepts Restricted Articles - * - * @var string - */ + * The valid values are: + * 001-Direct To Retail + * 002-Not In One ADL + * 003-Click and Collect + * 004-Retail to Retail + * 005-Pickup + * 006-Drop Off + * 007-PUDO + * 008-Early Pickup Delivery Time + * 009-Accept prepaid drop offs + * 010-DCO DCR intercept accepted + * 011-Accepts Payments + * 012-Pay At Store + * 013-Accepts Restricted Articles + * + * @var string + */ protected $code; /** * Description of the service offering. Text will be displayed in the locale requested. @@ -38,23 +38,23 @@ public function isInitialized($property): bool */ protected $description; /** - * The valid values are: - 001-Direct To Retail - 002-Not In One ADL - 003-Click and Collect - 004-Retail to Retail - 005-Pickup - 006-Drop Off - 007-PUDO - 008-Early Pickup Delivery Time - 009-Accept prepaid drop offs - 010-DCO DCR intercept accepted - 011-Accepts Payments - 012-Pay At Store - 013-Accepts Restricted Articles - * - * @return string - */ + * The valid values are: + * 001-Direct To Retail + * 002-Not In One ADL + * 003-Click and Collect + * 004-Retail to Retail + * 005-Pickup + * 006-Drop Off + * 007-PUDO + * 008-Early Pickup Delivery Time + * 009-Accept prepaid drop offs + * 010-DCO DCR intercept accepted + * 011-Accepts Payments + * 012-Pay At Store + * 013-Accepts Restricted Articles + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ServiceSearchServiceCode.php b/src/Api/Model/ServiceSearchServiceCode.php index 2e27e055..50b9a491 100644 --- a/src/Api/Model/ServiceSearchServiceCode.php +++ b/src/Api/Model/ServiceSearchServiceCode.php @@ -13,26 +13,26 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code indicating the different services. Valid values are: - 01-Ground. - 02-Air. - 03-Express - 04-Standard - 05-International (Only avialable July 17) - * - * @var string - */ + * Code indicating the different services. Valid values are: + * 01-Ground. + * 02-Air. + * 03-Express + * 04-Standard + * 05-International (Only avialable July 17) + * + * @var string + */ protected $code; /** - * Code indicating the different services. Valid values are: - 01-Ground. - 02-Air. - 03-Express - 04-Standard - 05-International (Only avialable July 17) - * - * @return string - */ + * Code indicating the different services. Valid values are: + * 01-Ground. + * 02-Air. + * 03-Express + * 04-Standard + * 05-International (Only avialable July 17) + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ServiceSearchServiceOptionCode.php b/src/Api/Model/ServiceSearchServiceOptionCode.php index c8b94ec4..dc28c8b8 100644 --- a/src/Api/Model/ServiceSearchServiceOptionCode.php +++ b/src/Api/Model/ServiceSearchServiceOptionCode.php @@ -13,28 +13,28 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code that defines the optional service. - - Valid values: - - 01 - Saturday pickup. - - Only valid for air service. - - * - * @var string - */ + * Code that defines the optional service. + * + * Valid values: + * - 01 - Saturday pickup. + * + * Only valid for air service. + * + * + * @var string + */ protected $code; /** - * Code that defines the optional service. - - Valid values: - - 01 - Saturday pickup. - - Only valid for air service. - - * - * @return string - */ + * Code that defines the optional service. + * + * Valid values: + * - 01 - Saturday pickup. + * + * Only valid for air service. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/Services.php b/src/Api/Model/Services.php index e3529c4a..59c2e881 100644 --- a/src/Api/Model/Services.php +++ b/src/Api/Model/Services.php @@ -13,14 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Service level code - - Valid domestic service codes: "1DMS","1DAS","1DM","1DA","1DP","2DM","2DA","3DS","GND". - - Valid International service codes (not a complete list) ,"01","02","03","05","08","09","10","11","18","19","20","21","22","23","24","25","26","28","29","33","68". - * - * @var string - */ + * Service level code + * + * Valid domestic service codes: "1DMS","1DAS","1DM","1DA","1DP","2DM","2DA","3DS","GND". + * + * Valid International service codes (not a complete list) ,"01","02","03","05","08","09","10","11","18","19","20","21","22","23","24","25","26","28","29","33","68". + * + * @var string + */ protected $serviceLevel; /** * Service name. Examples are: UPS Next Day Air, UPS Ground, UPS Expedited, UPS Worldwide Express Freight @@ -29,78 +29,78 @@ public function isInitialized($property): bool */ protected $serviceLevelDescription; /** - * The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). This date may or may not be the UPS business date. - - Valid Format: YYYY-MM-DD - * - * @var string - */ + * The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). This date may or may not be the UPS business date. + * + * Valid Format: YYYY-MM-DD + * + * @var string + */ protected $shipDate; /** - * Scheduled delivery date. - - Valid format: YYYY-MM-DD - * - * @var string - */ + * Scheduled delivery date. + * + * Valid format: YYYY-MM-DD + * + * @var string + */ protected $deliveryDate; /** - * Scheduled commit time. - - For international shipments the value always come back from SE (OPSYS data) but for domestic, value may be used from NRF commit time. - - Valid format: HH:MM:SS - * - * @var string - */ + * Scheduled commit time. + * + * For international shipments the value always come back from SE (OPSYS data) but for domestic, value may be used from NRF commit time. + * + * Valid format: HH:MM:SS + * + * @var string + */ protected $commitTime; /** - * Scheduled Delivery Time, value may be later then commit time. - - Valid format: HH:MM:SS - * - * @var string - */ + * Scheduled Delivery Time, value may be later then commit time. + * + * Valid format: HH:MM:SS + * + * @var string + */ protected $deliveryTime; /** - * Three character scheduled delivery day of week. - - Valid values: "MON","TUE","WED","THU","FRI", "SAT" - * - * @var string - */ + * Three character scheduled delivery day of week. + * + * Valid values: "MON","TUE","WED","THU","FRI", "SAT" + * + * @var string + */ protected $deliveryDayOfWeek; /** - * Returns a "1" if the requested shipped on date was changed. This data is available only for international transactions. - - When this flag is set, WWDTDisclaimer.getNextDayDisclaimer method could be called to return the next day disclaimer message. - * - * @var string - */ + * Returns a "1" if the requested shipped on date was changed. This data is available only for international transactions. + * + * When this flag is set, WWDTDisclaimer.getNextDayDisclaimer method could be called to return the next day disclaimer message. + * + * @var string + */ protected $nextDayPickupIndicator; /** - * Returns "1" if Saturday Pickup is available for an extra charge otherwise it will return "0". - - When this flag is set, WWDTDisclaimer.getSaturdayPickupDisclaimer method could be called to return the Saturday pickup extra charge message - * - * @var string - */ + * Returns "1" if Saturday Pickup is available for an extra charge otherwise it will return "0". + * + * When this flag is set, WWDTDisclaimer.getSaturdayPickupDisclaimer method could be called to return the Saturday pickup extra charge message + * + * @var string + */ protected $saturdayPickupIndicator; /** - * Delivery date of Saturday Delivery - - Valid Format: YYYY-MM-DD - * - * @var string - */ + * Delivery date of Saturday Delivery + * + * Valid Format: YYYY-MM-DD + * + * @var string + */ protected $saturdayDeliveryDate; /** - * Delivery time of Saturday deliver - - Valid format: HH:MM:SS - * - * @var string - */ + * Delivery time of Saturday deliver + * + * Valid format: HH:MM:SS + * + * @var string + */ protected $saturdayDeliveryTime; /** * Service remarks text. The contents of this field will represent text that the back end application/function needs to display to clarify the time in transit calculation. @@ -109,22 +109,22 @@ public function isInitialized($property): bool */ protected $serviceRemarksText; /** - * Return "1" Guaranteed, or "0" Not Guaranteed based on below conditions: - - If the ship date, delivery date, and system date are not within a defined peak date range, and a value for service guarantee is available in SE (OPSYS data) that will be returned. - - If the ship date or delivery date or system date are within a defined peak date range and the service is within the list of services to remove guarantees for, "0" wil be returned. - * - * @var string - */ + * Return "1" Guaranteed, or "0" Not Guaranteed based on below conditions: + * + * If the ship date, delivery date, and system date are not within a defined peak date range, and a value for service guarantee is available in SE (OPSYS data) that will be returned. + * + * If the ship date or delivery date or system date are within a defined peak date range and the service is within the list of services to remove guarantees for, "0" wil be returned. + * + * @var string + */ protected $guaranteeIndicator; /** - * Available for International requests. Number of calendar days from origin location to destination location. TotalTransitDays = BusinessTransitDays + RestDaysCount + HolidayCount. - - Defaults to 0. - * - * @var int - */ + * Available for International requests. Number of calendar days from origin location to destination location. TotalTransitDays = BusinessTransitDays + RestDaysCount + HolidayCount. + * + * Defaults to 0. + * + * @var int + */ protected $totalTransitDays; /** * Returns the number of UPS business days from origin location to destination location. @@ -133,36 +133,36 @@ public function isInitialized($property): bool */ protected $businessTransitDays; /** - * Returns the number of rest days encountered at the origin location. this data is available only for international transactions. - - Defaults to 0. - * - * @var int - */ + * Returns the number of rest days encountered at the origin location. this data is available only for international transactions. + * + * Defaults to 0. + * + * @var int + */ protected $restDaysCount; /** - * Returns the number of holidays encountered at the origin and destination location, if it effects the time and transit. This data is available only for international transactions. - - Defaults to 0. - * - * @var int - */ + * Returns the number of holidays encountered at the origin and destination location, if it effects the time and transit. This data is available only for international transactions. + * + * Defaults to 0. + * + * @var int + */ protected $holidayCount; /** - * Returns the number of delay needed for customs encounter at the origin or destination location. This data is available only for international transactions. - - Defaults to 0. - * - * @var int - */ + * Returns the number of delay needed for customs encounter at the origin or destination location. This data is available only for international transactions. + * + * Defaults to 0. + * + * @var int + */ protected $delayCount; /** - * Planned pickup date. - - Note: This value may not equal the shipped on value requested. This could happen when the requested shipped on date is a holiday or for locations needing 24 hour notice before a pickup could be made. - * - * @var string - */ + * Planned pickup date. + * + * Note: This value may not equal the shipped on value requested. This could happen when the requested shipped on date is a holiday or for locations needing 24 hour notice before a pickup could be made. + * + * @var string + */ protected $pickupDate; /** * Latest possible pickup time. This data is available only for international transactions. If the package was not actually picked by UPS before this time, the services will not meet the guarantee commitment. @@ -189,14 +189,14 @@ public function isInitialized($property): bool */ protected $poddays; /** - * Service level code - - Valid domestic service codes: "1DMS","1DAS","1DM","1DA","1DP","2DM","2DA","3DS","GND". - - Valid International service codes (not a complete list) ,"01","02","03","05","08","09","10","11","18","19","20","21","22","23","24","25","26","28","29","33","68". - * - * @return string - */ + * Service level code + * + * Valid domestic service codes: "1DMS","1DAS","1DM","1DA","1DP","2DM","2DA","3DS","GND". + * + * Valid International service codes (not a complete list) ,"01","02","03","05","08","09","10","11","18","19","20","21","22","23","24","25","26","28","29","33","68". + * + * @return string + */ public function getServiceLevel(): string { return $this->serviceLevel; @@ -241,12 +241,12 @@ public function setServiceLevelDescription(string $serviceLevelDescription): sel return $this; } /** - * The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). This date may or may not be the UPS business date. - - Valid Format: YYYY-MM-DD - * - * @return string - */ + * The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). This date may or may not be the UPS business date. + * + * Valid Format: YYYY-MM-DD + * + * @return string + */ public function getShipDate(): string { return $this->shipDate; @@ -267,12 +267,12 @@ public function setShipDate(string $shipDate): self return $this; } /** - * Scheduled delivery date. - - Valid format: YYYY-MM-DD - * - * @return string - */ + * Scheduled delivery date. + * + * Valid format: YYYY-MM-DD + * + * @return string + */ public function getDeliveryDate(): string { return $this->deliveryDate; @@ -293,14 +293,14 @@ public function setDeliveryDate(string $deliveryDate): self return $this; } /** - * Scheduled commit time. - - For international shipments the value always come back from SE (OPSYS data) but for domestic, value may be used from NRF commit time. - - Valid format: HH:MM:SS - * - * @return string - */ + * Scheduled commit time. + * + * For international shipments the value always come back from SE (OPSYS data) but for domestic, value may be used from NRF commit time. + * + * Valid format: HH:MM:SS + * + * @return string + */ public function getCommitTime(): string { return $this->commitTime; @@ -323,12 +323,12 @@ public function setCommitTime(string $commitTime): self return $this; } /** - * Scheduled Delivery Time, value may be later then commit time. - - Valid format: HH:MM:SS - * - * @return string - */ + * Scheduled Delivery Time, value may be later then commit time. + * + * Valid format: HH:MM:SS + * + * @return string + */ public function getDeliveryTime(): string { return $this->deliveryTime; @@ -349,12 +349,12 @@ public function setDeliveryTime(string $deliveryTime): self return $this; } /** - * Three character scheduled delivery day of week. - - Valid values: "MON","TUE","WED","THU","FRI", "SAT" - * - * @return string - */ + * Three character scheduled delivery day of week. + * + * Valid values: "MON","TUE","WED","THU","FRI", "SAT" + * + * @return string + */ public function getDeliveryDayOfWeek(): string { return $this->deliveryDayOfWeek; @@ -375,12 +375,12 @@ public function setDeliveryDayOfWeek(string $deliveryDayOfWeek): self return $this; } /** - * Returns a "1" if the requested shipped on date was changed. This data is available only for international transactions. - - When this flag is set, WWDTDisclaimer.getNextDayDisclaimer method could be called to return the next day disclaimer message. - * - * @return string - */ + * Returns a "1" if the requested shipped on date was changed. This data is available only for international transactions. + * + * When this flag is set, WWDTDisclaimer.getNextDayDisclaimer method could be called to return the next day disclaimer message. + * + * @return string + */ public function getNextDayPickupIndicator(): string { return $this->nextDayPickupIndicator; @@ -401,12 +401,12 @@ public function setNextDayPickupIndicator(string $nextDayPickupIndicator): self return $this; } /** - * Returns "1" if Saturday Pickup is available for an extra charge otherwise it will return "0". - - When this flag is set, WWDTDisclaimer.getSaturdayPickupDisclaimer method could be called to return the Saturday pickup extra charge message - * - * @return string - */ + * Returns "1" if Saturday Pickup is available for an extra charge otherwise it will return "0". + * + * When this flag is set, WWDTDisclaimer.getSaturdayPickupDisclaimer method could be called to return the Saturday pickup extra charge message + * + * @return string + */ public function getSaturdayPickupIndicator(): string { return $this->saturdayPickupIndicator; @@ -427,12 +427,12 @@ public function setSaturdayPickupIndicator(string $saturdayPickupIndicator): sel return $this; } /** - * Delivery date of Saturday Delivery - - Valid Format: YYYY-MM-DD - * - * @return string - */ + * Delivery date of Saturday Delivery + * + * Valid Format: YYYY-MM-DD + * + * @return string + */ public function getSaturdayDeliveryDate(): string { return $this->saturdayDeliveryDate; @@ -453,12 +453,12 @@ public function setSaturdayDeliveryDate(string $saturdayDeliveryDate): self return $this; } /** - * Delivery time of Saturday deliver - - Valid format: HH:MM:SS - * - * @return string - */ + * Delivery time of Saturday deliver + * + * Valid format: HH:MM:SS + * + * @return string + */ public function getSaturdayDeliveryTime(): string { return $this->saturdayDeliveryTime; @@ -501,14 +501,14 @@ public function setServiceRemarksText(string $serviceRemarksText): self return $this; } /** - * Return "1" Guaranteed, or "0" Not Guaranteed based on below conditions: - - If the ship date, delivery date, and system date are not within a defined peak date range, and a value for service guarantee is available in SE (OPSYS data) that will be returned. - - If the ship date or delivery date or system date are within a defined peak date range and the service is within the list of services to remove guarantees for, "0" wil be returned. - * - * @return string - */ + * Return "1" Guaranteed, or "0" Not Guaranteed based on below conditions: + * + * If the ship date, delivery date, and system date are not within a defined peak date range, and a value for service guarantee is available in SE (OPSYS data) that will be returned. + * + * If the ship date or delivery date or system date are within a defined peak date range and the service is within the list of services to remove guarantees for, "0" wil be returned. + * + * @return string + */ public function getGuaranteeIndicator(): string { return $this->guaranteeIndicator; @@ -531,12 +531,12 @@ public function setGuaranteeIndicator(string $guaranteeIndicator): self return $this; } /** - * Available for International requests. Number of calendar days from origin location to destination location. TotalTransitDays = BusinessTransitDays + RestDaysCount + HolidayCount. - - Defaults to 0. - * - * @return int - */ + * Available for International requests. Number of calendar days from origin location to destination location. TotalTransitDays = BusinessTransitDays + RestDaysCount + HolidayCount. + * + * Defaults to 0. + * + * @return int + */ public function getTotalTransitDays(): int { return $this->totalTransitDays; @@ -579,12 +579,12 @@ public function setBusinessTransitDays(int $businessTransitDays): self return $this; } /** - * Returns the number of rest days encountered at the origin location. this data is available only for international transactions. - - Defaults to 0. - * - * @return int - */ + * Returns the number of rest days encountered at the origin location. this data is available only for international transactions. + * + * Defaults to 0. + * + * @return int + */ public function getRestDaysCount(): int { return $this->restDaysCount; @@ -605,12 +605,12 @@ public function setRestDaysCount(int $restDaysCount): self return $this; } /** - * Returns the number of holidays encountered at the origin and destination location, if it effects the time and transit. This data is available only for international transactions. - - Defaults to 0. - * - * @return int - */ + * Returns the number of holidays encountered at the origin and destination location, if it effects the time and transit. This data is available only for international transactions. + * + * Defaults to 0. + * + * @return int + */ public function getHolidayCount(): int { return $this->holidayCount; @@ -631,12 +631,12 @@ public function setHolidayCount(int $holidayCount): self return $this; } /** - * Returns the number of delay needed for customs encounter at the origin or destination location. This data is available only for international transactions. - - Defaults to 0. - * - * @return int - */ + * Returns the number of delay needed for customs encounter at the origin or destination location. This data is available only for international transactions. + * + * Defaults to 0. + * + * @return int + */ public function getDelayCount(): int { return $this->delayCount; @@ -657,12 +657,12 @@ public function setDelayCount(int $delayCount): self return $this; } /** - * Planned pickup date. - - Note: This value may not equal the shipped on value requested. This could happen when the requested shipped on date is a holiday or for locations needing 24 hour notice before a pickup could be made. - * - * @return string - */ + * Planned pickup date. + * + * Note: This value may not equal the shipped on value requested. This could happen when the requested shipped on date is a holiday or for locations needing 24 hour notice before a pickup could be made. + * + * @return string + */ public function getPickupDate(): string { return $this->pickupDate; diff --git a/src/Api/Model/ShipFromTaxIDType.php b/src/Api/Model/ShipFromTaxIDType.php index f0f9b797..93b18c68 100644 --- a/src/Api/Model/ShipFromTaxIDType.php +++ b/src/Api/Model/ShipFromTaxIDType.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Company's tax Identification type. Valid values: EIN, DNS, and FGN. - Applies to EEI form only. - * - * @var string - */ + * Company's tax Identification type. Valid values: EIN, DNS, and FGN. + * Applies to EEI form only. + * + * @var string + */ protected $code; /** * Description of TaxID submitted. Applies to EEI form only. @@ -26,11 +26,11 @@ public function isInitialized($property): bool */ protected $description; /** - * Company's tax Identification type. Valid values: EIN, DNS, and FGN. - Applies to EEI form only. - * - * @return string - */ + * Company's tax Identification type. Valid values: EIN, DNS, and FGN. + * Applies to EEI form only. + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ShipFromVendorInfo.php b/src/Api/Model/ShipFromVendorInfo.php index b0a17ce6..42932dee 100644 --- a/src/Api/Model/ShipFromVendorInfo.php +++ b/src/Api/Model/ShipFromVendorInfo.php @@ -13,27 +13,27 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code that identifies the type of Vendor Collect ID Number. Valid Values - - 0356 = IOSS - - 0357 = VOEC - - 0358 = HMRC - - Vendor Collect ID Number type code will be printed on commercial invoice if present. - - * - * @var string - */ + * Code that identifies the type of Vendor Collect ID Number. Valid Values + * - 0356 = IOSS + * - 0357 = VOEC + * - 0358 = HMRC + * + * Vendor Collect ID Number type code will be printed on commercial invoice if present. + * + * + * @var string + */ protected $vendorCollectIDTypeCode; /** - * Shipper's VAT Tax collection registration number to be entered by Shipper at time of shipment creation. Presence of this number as part of the shipment information implies the shipper has collected/paid the required VAT tax (outside of UPS/UPS systems). Vendor Colect ID Number will be printed on commercial invoice if present. - - Sample Values: 'IMDEU1234567' (IOSS #), 'VOEC1234567' (VOEC #), 'GB1234567' (HMRC #) - - Required if the shipment is subject to Vendor Collect ID collection - - * - * @var string - */ + * Shipper's VAT Tax collection registration number to be entered by Shipper at time of shipment creation. Presence of this number as part of the shipment information implies the shipper has collected/paid the required VAT tax (outside of UPS/UPS systems). Vendor Colect ID Number will be printed on commercial invoice if present. + * + * Sample Values: 'IMDEU1234567' (IOSS #), 'VOEC1234567' (VOEC #), 'GB1234567' (HMRC #) + * + * Required if the shipment is subject to Vendor Collect ID collection + * + * + * @var string + */ protected $vendorCollectIDNumber; /** * Consignee Type. 01 = Business 02 = Consumer NA = Not Applicable @@ -42,16 +42,16 @@ public function isInitialized($property): bool */ protected $consigneeType; /** - * Code that identifies the type of Vendor Collect ID Number. Valid Values - - 0356 = IOSS - - 0357 = VOEC - - 0358 = HMRC - - Vendor Collect ID Number type code will be printed on commercial invoice if present. - - * - * @return string - */ + * Code that identifies the type of Vendor Collect ID Number. Valid Values + * - 0356 = IOSS + * - 0357 = VOEC + * - 0358 = HMRC + * + * Vendor Collect ID Number type code will be printed on commercial invoice if present. + * + * + * @return string + */ public function getVendorCollectIDTypeCode(): string { return $this->vendorCollectIDTypeCode; @@ -76,15 +76,15 @@ public function setVendorCollectIDTypeCode(string $vendorCollectIDTypeCode): sel return $this; } /** - * Shipper's VAT Tax collection registration number to be entered by Shipper at time of shipment creation. Presence of this number as part of the shipment information implies the shipper has collected/paid the required VAT tax (outside of UPS/UPS systems). Vendor Colect ID Number will be printed on commercial invoice if present. - - Sample Values: 'IMDEU1234567' (IOSS #), 'VOEC1234567' (VOEC #), 'GB1234567' (HMRC #) - - Required if the shipment is subject to Vendor Collect ID collection - - * - * @return string - */ + * Shipper's VAT Tax collection registration number to be entered by Shipper at time of shipment creation. Presence of this number as part of the shipment information implies the shipper has collected/paid the required VAT tax (outside of UPS/UPS systems). Vendor Colect ID Number will be printed on commercial invoice if present. + * + * Sample Values: 'IMDEU1234567' (IOSS #), 'VOEC1234567' (VOEC #), 'GB1234567' (HMRC #) + * + * Required if the shipment is subject to Vendor Collect ID collection + * + * + * @return string + */ public function getVendorCollectIDNumber(): string { return $this->vendorCollectIDNumber; diff --git a/src/Api/Model/ShipToAddress.php b/src/Api/Model/ShipToAddress.php index d7f2bf0b..f0e7e926 100644 --- a/src/Api/Model/ShipToAddress.php +++ b/src/Api/Model/ShipToAddress.php @@ -25,42 +25,42 @@ public function isInitialized($property): bool */ protected $city; /** - * Consignee's state or province code. Required for US or Canada. If destination is US or CA, then the value must be a valid US State/ Canadian Province code. - - If the country or territory is Ireland, the StateProvinceCode will contain the county. - - * - * @var string - */ + * Consignee's state or province code. Required for US or Canada. If destination is US or CA, then the value must be a valid US State/ Canadian Province code. + * + * If the country or territory is Ireland, the StateProvinceCode will contain the county. + * + * + * @var string + */ protected $stateProvinceCode; /** - * Consignee's postal code. If the ShipTo country or territory is US or Puerto Rico, 5 or 9 digits are required. - - If the ShipTo country or territory is CA, then the postal code is required and must be 6 alphanumeric characters whose format is A#A#A# where A is an uppercase letter and # is a digit. - - Otherwise optional. For all other countries or territories the postal code is optional and must be no more than 9 alphanumeric characters long. - - * - * @var string - */ + * Consignee's postal code. If the ShipTo country or territory is US or Puerto Rico, 5 or 9 digits are required. + * + * If the ShipTo country or territory is CA, then the postal code is required and must be 6 alphanumeric characters whose format is A#A#A# where A is an uppercase letter and # is a digit. + * + * Otherwise optional. For all other countries or territories the postal code is optional and must be no more than 9 alphanumeric characters long. + * + * + * @var string + */ protected $postalCode; /** - * Consignee's country or territory code. Must be a valid UPS Billing country or territory code. - For Return Shipment the country or territory code must meet the following conditions: - - At least two of the following country or territory codes are the same: ShipTo, ShipFrom, and Shipper. - - None of the following country or territory codes are the same and are a member of the EU: ShipTo, ShipFrom, and Shipper. - - If any of the two following country or territory codes: ShipTo/ ShipFrom/ Shipper are members in EU otherwise check if the shipper has Third country or territory Contract. - - * - * @var string - */ + * Consignee's country or territory code. Must be a valid UPS Billing country or territory code. + * For Return Shipment the country or territory code must meet the following conditions: + * - At least two of the following country or territory codes are the same: ShipTo, ShipFrom, and Shipper. + * - None of the following country or territory codes are the same and are a member of the EU: ShipTo, ShipFrom, and Shipper. + * - If any of the two following country or territory codes: ShipTo/ ShipFrom/ Shipper are members in EU otherwise check if the shipper has Third country or territory Contract. + * + * + * @var string + */ protected $countryCode; /** - * This field is a flag to indicate if the receiver is a residential location. - True if ResidentialAddressIndicator tag exists. This is an empty tag, any value inside is ignored. - * - * @var string - */ + * This field is a flag to indicate if the receiver is a residential location. + * True if ResidentialAddressIndicator tag exists. This is an empty tag, any value inside is ignored. + * + * @var string + */ protected $residentialAddressIndicator; /** * Address Line of the consignee. Only first two Address Lines will be printed on the label. @@ -107,13 +107,13 @@ public function setCity(string $city): self return $this; } /** - * Consignee's state or province code. Required for US or Canada. If destination is US or CA, then the value must be a valid US State/ Canadian Province code. - - If the country or territory is Ireland, the StateProvinceCode will contain the county. - - * - * @return string - */ + * Consignee's state or province code. Required for US or Canada. If destination is US or CA, then the value must be a valid US State/ Canadian Province code. + * + * If the country or territory is Ireland, the StateProvinceCode will contain the county. + * + * + * @return string + */ public function getStateProvinceCode(): string { return $this->stateProvinceCode; @@ -135,15 +135,15 @@ public function setStateProvinceCode(string $stateProvinceCode): self return $this; } /** - * Consignee's postal code. If the ShipTo country or territory is US or Puerto Rico, 5 or 9 digits are required. - - If the ShipTo country or territory is CA, then the postal code is required and must be 6 alphanumeric characters whose format is A#A#A# where A is an uppercase letter and # is a digit. - - Otherwise optional. For all other countries or territories the postal code is optional and must be no more than 9 alphanumeric characters long. - - * - * @return string - */ + * Consignee's postal code. If the ShipTo country or territory is US or Puerto Rico, 5 or 9 digits are required. + * + * If the ShipTo country or territory is CA, then the postal code is required and must be 6 alphanumeric characters whose format is A#A#A# where A is an uppercase letter and # is a digit. + * + * Otherwise optional. For all other countries or territories the postal code is optional and must be no more than 9 alphanumeric characters long. + * + * + * @return string + */ public function getPostalCode(): string { return $this->postalCode; @@ -167,15 +167,15 @@ public function setPostalCode(string $postalCode): self return $this; } /** - * Consignee's country or territory code. Must be a valid UPS Billing country or territory code. - For Return Shipment the country or territory code must meet the following conditions: - - At least two of the following country or territory codes are the same: ShipTo, ShipFrom, and Shipper. - - None of the following country or territory codes are the same and are a member of the EU: ShipTo, ShipFrom, and Shipper. - - If any of the two following country or territory codes: ShipTo/ ShipFrom/ Shipper are members in EU otherwise check if the shipper has Third country or territory Contract. - - * - * @return string - */ + * Consignee's country or territory code. Must be a valid UPS Billing country or territory code. + * For Return Shipment the country or territory code must meet the following conditions: + * - At least two of the following country or territory codes are the same: ShipTo, ShipFrom, and Shipper. + * - None of the following country or territory codes are the same and are a member of the EU: ShipTo, ShipFrom, and Shipper. + * - If any of the two following country or territory codes: ShipTo/ ShipFrom/ Shipper are members in EU otherwise check if the shipper has Third country or territory Contract. + * + * + * @return string + */ public function getCountryCode(): string { return $this->countryCode; @@ -199,11 +199,11 @@ public function setCountryCode(string $countryCode): self return $this; } /** - * This field is a flag to indicate if the receiver is a residential location. - True if ResidentialAddressIndicator tag exists. This is an empty tag, any value inside is ignored. - * - * @return string - */ + * This field is a flag to indicate if the receiver is a residential location. + * True if ResidentialAddressIndicator tag exists. This is an empty tag, any value inside is ignored. + * + * @return string + */ public function getResidentialAddressIndicator(): string { return $this->residentialAddressIndicator; diff --git a/src/Api/Model/Shipment.php b/src/Api/Model/Shipment.php index e086998c..d0f6025b 100644 --- a/src/Api/Model/Shipment.php +++ b/src/Api/Model/Shipment.php @@ -19,8 +19,6 @@ public function isInitialized($property): bool */ protected $inquiryNumber; /** - * - * * @var list|null */ protected $package; @@ -31,8 +29,6 @@ public function isInitialized($property): bool */ protected $userRelation; /** - * - * * @var list|null */ protected $warnings; @@ -59,8 +55,6 @@ public function setInquiryNumber(string $inquiryNumber): self return $this; } /** - * - * * @return list|null */ public function getPackage(): ?array @@ -68,8 +62,6 @@ public function getPackage(): ?array return $this->package; } /** - * - * * @param list|null $package * * @return self @@ -103,8 +95,6 @@ public function setUserRelation(array $userRelation): self return $this; } /** - * - * * @return list|null */ public function getWarnings(): ?array @@ -112,8 +102,6 @@ public function getWarnings(): ?array return $this->warnings; } /** - * - * * @param list|null $warnings * * @return self diff --git a/src/Api/Model/ShipmentChargeBillReceiver.php b/src/Api/Model/ShipmentChargeBillReceiver.php index a1b617cd..bd66f697 100644 --- a/src/Api/Model/ShipmentChargeBillReceiver.php +++ b/src/Api/Model/ShipmentChargeBillReceiver.php @@ -13,14 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The UPS account number. The account must be a valid UPS account number that is active. - - For US, PR and CA accounts, the account must be a daily pickup account, an occasional account, a customer B.I.N account, or a dropper shipper account. - - All other accounts must be either a daily pickup account, an occasional account, a drop shipper account, or a non-shipping account. - * - * @var string - */ + * The UPS account number. The account must be a valid UPS account number that is active. + * + * For US, PR and CA accounts, the account must be a daily pickup account, an occasional account, a customer B.I.N account, or a dropper shipper account. + * + * All other accounts must be either a daily pickup account, an occasional account, a drop shipper account, or a non-shipping account. + * + * @var string + */ protected $accountNumber; /** * Container for additional information for the bill receiver's UPS accounts address. @@ -29,14 +29,14 @@ public function isInitialized($property): bool */ protected $address; /** - * The UPS account number. The account must be a valid UPS account number that is active. - - For US, PR and CA accounts, the account must be a daily pickup account, an occasional account, a customer B.I.N account, or a dropper shipper account. - - All other accounts must be either a daily pickup account, an occasional account, a drop shipper account, or a non-shipping account. - * - * @return string - */ + * The UPS account number. The account must be a valid UPS account number that is active. + * + * For US, PR and CA accounts, the account must be a daily pickup account, an occasional account, a customer B.I.N account, or a dropper shipper account. + * + * All other accounts must be either a daily pickup account, an occasional account, a drop shipper account, or a non-shipping account. + * + * @return string + */ public function getAccountNumber(): string { return $this->accountNumber; diff --git a/src/Api/Model/ShipmentChargeBillShipper.php b/src/Api/Model/ShipmentChargeBillShipper.php index 10435110..b96ec71e 100644 --- a/src/Api/Model/ShipmentChargeBillShipper.php +++ b/src/Api/Model/ShipmentChargeBillShipper.php @@ -13,46 +13,46 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * UPS account number. Must be the same UPS account number as the one provided in Shipper/ShipperNumber. - - Either this element or one of the sibling elements CreditCard or AlternatePaymentMethod must be provided, but all of them may not be provided. - * - * @var string - */ + * UPS account number. Must be the same UPS account number as the one provided in Shipper/ShipperNumber. + * + * Either this element or one of the sibling elements CreditCard or AlternatePaymentMethod must be provided, but all of them may not be provided. + * + * @var string + */ protected $accountNumber; /** - * Credit card information container. Required if neither of the following is present: - - /ShipmentRequest/Shipment/PaymentInformation/ShipmentCharge/BillShipper/AccountNumber - or - /ShipmentRequest/Shipment/PaymentInformation/ShipmentCharge/BillShipper/AlternatePaymentMethod. - - Credit card payment is valid for shipments without return service only. - * - * @var BillShipperCreditCard - */ + * Credit card information container. Required if neither of the following is present: + * + * /ShipmentRequest/Shipment/PaymentInformation/ShipmentCharge/BillShipper/AccountNumber + * or + * /ShipmentRequest/Shipment/PaymentInformation/ShipmentCharge/BillShipper/AlternatePaymentMethod. + * + * Credit card payment is valid for shipments without return service only. + * + * @var BillShipperCreditCard + */ protected $creditCard; /** - * Alternate Payment Method. - - Valid value: 01= PayPal - - Only valid for forward shipments. It is not valid for Return or Import Control shipments. - - This element or one of the sibling elements CreditCard or AccountNumber must be provided, but all of them may not be provided. PayPal 01: Is only valid for forward shipments. It is not valid for Return or Import Control shipments. - - This element or one of the sibling elements CreditCard or AccountNumber must be provided, but all of them may not be provided. - * - * @var string - */ + * Alternate Payment Method. + * + * Valid value: 01= PayPal + * + * Only valid for forward shipments. It is not valid for Return or Import Control shipments. + * + * This element or one of the sibling elements CreditCard or AccountNumber must be provided, but all of them may not be provided. PayPal 01: Is only valid for forward shipments. It is not valid for Return or Import Control shipments. + * + * This element or one of the sibling elements CreditCard or AccountNumber must be provided, but all of them may not be provided. + * + * @var string + */ protected $alternatePaymentMethod; /** - * UPS account number. Must be the same UPS account number as the one provided in Shipper/ShipperNumber. - - Either this element or one of the sibling elements CreditCard or AlternatePaymentMethod must be provided, but all of them may not be provided. - * - * @return string - */ + * UPS account number. Must be the same UPS account number as the one provided in Shipper/ShipperNumber. + * + * Either this element or one of the sibling elements CreditCard or AlternatePaymentMethod must be provided, but all of them may not be provided. + * + * @return string + */ public function getAccountNumber(): string { return $this->accountNumber; @@ -73,16 +73,16 @@ public function setAccountNumber(string $accountNumber): self return $this; } /** - * Credit card information container. Required if neither of the following is present: - - /ShipmentRequest/Shipment/PaymentInformation/ShipmentCharge/BillShipper/AccountNumber - or - /ShipmentRequest/Shipment/PaymentInformation/ShipmentCharge/BillShipper/AlternatePaymentMethod. - - Credit card payment is valid for shipments without return service only. - * - * @return BillShipperCreditCard - */ + * Credit card information container. Required if neither of the following is present: + * + * /ShipmentRequest/Shipment/PaymentInformation/ShipmentCharge/BillShipper/AccountNumber + * or + * /ShipmentRequest/Shipment/PaymentInformation/ShipmentCharge/BillShipper/AlternatePaymentMethod. + * + * Credit card payment is valid for shipments without return service only. + * + * @return BillShipperCreditCard + */ public function getCreditCard(): BillShipperCreditCard { return $this->creditCard; @@ -107,18 +107,18 @@ public function setCreditCard(BillShipperCreditCard $creditCard): self return $this; } /** - * Alternate Payment Method. - - Valid value: 01= PayPal - - Only valid for forward shipments. It is not valid for Return or Import Control shipments. - - This element or one of the sibling elements CreditCard or AccountNumber must be provided, but all of them may not be provided. PayPal 01: Is only valid for forward shipments. It is not valid for Return or Import Control shipments. - - This element or one of the sibling elements CreditCard or AccountNumber must be provided, but all of them may not be provided. - * - * @return string - */ + * Alternate Payment Method. + * + * Valid value: 01= PayPal + * + * Only valid for forward shipments. It is not valid for Return or Import Control shipments. + * + * This element or one of the sibling elements CreditCard or AccountNumber must be provided, but all of them may not be provided. PayPal 01: Is only valid for forward shipments. It is not valid for Return or Import Control shipments. + * + * This element or one of the sibling elements CreditCard or AccountNumber must be provided, but all of them may not be provided. + * + * @return string + */ public function getAlternatePaymentMethod(): string { return $this->alternatePaymentMethod; diff --git a/src/Api/Model/ShipmentChargeBillThirdParty.php b/src/Api/Model/ShipmentChargeBillThirdParty.php index d88151a9..1777bba6 100644 --- a/src/Api/Model/ShipmentChargeBillThirdParty.php +++ b/src/Api/Model/ShipmentChargeBillThirdParty.php @@ -13,14 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The UPS account number of the third party shipper. The account must be a valid UPS account number that is active. - - For US, PR and CA accounts, the account must be either a daily pickup account, an occasional account, or a customer B.I.N account, or a drop shipper account. - - All other accounts must be either a daily pickup account, an occasional account, a drop shipper account, or a non-shipping account. - * - * @var string - */ + * The UPS account number of the third party shipper. The account must be a valid UPS account number that is active. + * + * For US, PR and CA accounts, the account must be either a daily pickup account, an occasional account, or a customer B.I.N account, or a drop shipper account. + * + * All other accounts must be either a daily pickup account, an occasional account, a drop shipper account, or a non-shipping account. + * + * @var string + */ protected $accountNumber; /** * Posta Elettronica Certificata (PEC) which is the recipient code for the customers certified electronic mail value. @@ -41,14 +41,14 @@ public function isInitialized($property): bool */ protected $address; /** - * The UPS account number of the third party shipper. The account must be a valid UPS account number that is active. - - For US, PR and CA accounts, the account must be either a daily pickup account, an occasional account, or a customer B.I.N account, or a drop shipper account. - - All other accounts must be either a daily pickup account, an occasional account, a drop shipper account, or a non-shipping account. - * - * @return string - */ + * The UPS account number of the third party shipper. The account must be a valid UPS account number that is active. + * + * For US, PR and CA accounts, the account must be either a daily pickup account, an occasional account, or a customer B.I.N account, or a drop shipper account. + * + * All other accounts must be either a daily pickup account, an occasional account, a drop shipper account, or a non-shipping account. + * + * @return string + */ public function getAccountNumber(): string { return $this->accountNumber; diff --git a/src/Api/Model/ShipmentCommodity.php b/src/Api/Model/ShipmentCommodity.php index 304e5e04..1959d59c 100644 --- a/src/Api/Model/ShipmentCommodity.php +++ b/src/Api/Model/ShipmentCommodity.php @@ -73,11 +73,11 @@ public function isInitialized($property): bool */ protected $nMFCCommodityCode; /** - * Container for National Motor Freight Classification Commodity. This Container is for customers who choose to send the NMFC Prime and sub code as two different fields. - This container is mutually exclusive with NMFCCommodityCode element above. - * - * @var CommodityNMFCCommodity - */ + * Container for National Motor Freight Classification Commodity. This Container is for customers who choose to send the NMFC Prime and sub code as two different fields. + * This container is mutually exclusive with NMFCCommodityCode element above. + * + * @var CommodityNMFCCommodity + */ protected $nMFCCommodity; /** * Unique identifier for the commodity. @@ -300,11 +300,11 @@ public function setNMFCCommodityCode(string $nMFCCommodityCode): self return $this; } /** - * Container for National Motor Freight Classification Commodity. This Container is for customers who choose to send the NMFC Prime and sub code as two different fields. - This container is mutually exclusive with NMFCCommodityCode element above. - * - * @return CommodityNMFCCommodity - */ + * Container for National Motor Freight Classification Commodity. This Container is for customers who choose to send the NMFC Prime and sub code as two different fields. + * This container is mutually exclusive with NMFCCommodityCode element above. + * + * @return CommodityNMFCCommodity + */ public function getNMFCCommodity(): CommodityNMFCCommodity { return $this->nMFCCommodity; diff --git a/src/Api/Model/ShipmentDGSignatoryInfo.php b/src/Api/Model/ShipmentDGSignatoryInfo.php index 24e54930..2da5ec87 100644 --- a/src/Api/Model/ShipmentDGSignatoryInfo.php +++ b/src/Api/Model/ShipmentDGSignatoryInfo.php @@ -13,19 +13,19 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Name of the person signing the declaration. - - Note: The name of person or department he/she is employed with, are both acceptable. - * - * @var string - */ + * Name of the person signing the declaration. + * + * Note: The name of person or department he/she is employed with, are both acceptable. + * + * @var string + */ protected $name; /** - * Title of the person signing the declaration. - Note: The title of the person or department he/she is employed with, are both acceptable. - * - * @var string - */ + * Title of the person signing the declaration. + * Note: The title of the person or department he/she is employed with, are both acceptable. + * + * @var string + */ protected $title; /** * The city of the Signatory. @@ -40,13 +40,13 @@ public function isInitialized($property): bool */ protected $date; /** - * Valid values: - 01 = Shipment level - 02 = Package level - Valid only for the Shipper Declaration paper. If missing or invalid DGPaperImage will be returned at package level. - * - * @var string - */ + * Valid values: + * 01 = Shipment level + * 02 = Package level + * Valid only for the Shipper Declaration paper. If missing or invalid DGPaperImage will be returned at package level. + * + * @var string + */ protected $shipperDeclaration; /** * Dangerous Goods Paper Upload Only Indicator. DG Paper will not be returned in response if UploadOnlyIndicator present. @@ -55,12 +55,12 @@ public function isInitialized($property): bool */ protected $uploadOnlyIndicator; /** - * Name of the person signing the declaration. - - Note: The name of person or department he/she is employed with, are both acceptable. - * - * @return string - */ + * Name of the person signing the declaration. + * + * Note: The name of person or department he/she is employed with, are both acceptable. + * + * @return string + */ public function getName(): string { return $this->name; @@ -81,11 +81,11 @@ public function setName(string $name): self return $this; } /** - * Title of the person signing the declaration. - Note: The title of the person or department he/she is employed with, are both acceptable. - * - * @return string - */ + * Title of the person signing the declaration. + * Note: The title of the person or department he/she is employed with, are both acceptable. + * + * @return string + */ public function getTitle(): string { return $this->title; @@ -149,13 +149,13 @@ public function setDate(string $date): self return $this; } /** - * Valid values: - 01 = Shipment level - 02 = Package level - Valid only for the Shipper Declaration paper. If missing or invalid DGPaperImage will be returned at package level. - * - * @return string - */ + * Valid values: + * 01 = Shipment level + * 02 = Package level + * Valid only for the Shipper Declaration paper. If missing or invalid DGPaperImage will be returned at package level. + * + * @return string + */ public function getShipperDeclaration(): string { return $this->shipperDeclaration; diff --git a/src/Api/Model/ShipmentDeliveryTimeInformation.php b/src/Api/Model/ShipmentDeliveryTimeInformation.php index 799906b1..df6fd1ee 100644 --- a/src/Api/Model/ShipmentDeliveryTimeInformation.php +++ b/src/Api/Model/ShipmentDeliveryTimeInformation.php @@ -13,17 +13,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Valid values are: - - 02 - Document only - - 03 - Non-Document - - 04 - WWEF Pallet - - 07 - Domestic Pallet - - If 04 is included, Worldwide Express Freight and UPS Worldwide Express Freight Midday services (if applicable) will be included in the response. - - * - * @var string - */ + * Valid values are: + * - 02 - Document only + * - 03 - Non-Document + * - 04 - WWEF Pallet + * - 07 - Domestic Pallet + * + * If 04 is included, Worldwide Express Freight and UPS Worldwide Express Freight Midday services (if applicable) will be included in the response. + * + * + * @var string + */ protected $packageBillType; /** * Pickup container. @@ -32,23 +32,21 @@ public function isInitialized($property): bool */ protected $pickup; /** - * - * * @var list */ protected $returnContractServices; /** - * Valid values are: - - 02 - Document only - - 03 - Non-Document - - 04 - WWEF Pallet - - 07 - Domestic Pallet - - If 04 is included, Worldwide Express Freight and UPS Worldwide Express Freight Midday services (if applicable) will be included in the response. - - * - * @return string - */ + * Valid values are: + * - 02 - Document only + * - 03 - Non-Document + * - 04 - WWEF Pallet + * - 07 - Domestic Pallet + * + * If 04 is included, Worldwide Express Freight and UPS Worldwide Express Freight Midday services (if applicable) will be included in the response. + * + * + * @return string + */ public function getPackageBillType(): string { return $this->packageBillType; @@ -96,8 +94,6 @@ public function setPickup(DeliveryTimeInformationPickup $pickup): self return $this; } /** - * - * * @return list */ public function getReturnContractServices(): array @@ -105,8 +101,6 @@ public function getReturnContractServices(): array return $this->returnContractServices; } /** - * - * * @param list $returnContractServices * * @return self diff --git a/src/Api/Model/ShipmentDetailPackagingType.php b/src/Api/Model/ShipmentDetailPackagingType.php index 8d8f8c47..27d3aa23 100644 --- a/src/Api/Model/ShipmentDetailPackagingType.php +++ b/src/Api/Model/ShipmentDetailPackagingType.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The code for the UPS packaging type associated with the shipment. - For valid values, see Package Type Codes in the Appendix. - * - * @var string - */ + * The code for the UPS packaging type associated with the shipment. + * For valid values, see Package Type Codes in the Appendix. + * + * @var string + */ protected $code; /** * A text description of the code for the UPS packaging type associated with the shipment. @@ -26,11 +26,11 @@ public function isInitialized($property): bool */ protected $description; /** - * The code for the UPS packaging type associated with the shipment. - For valid values, see Package Type Codes in the Appendix. - * - * @return string - */ + * The code for the UPS packaging type associated with the shipment. + * For valid values, see Package Type Codes in the Appendix. + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ShipmentDetailWeight.php b/src/Api/Model/ShipmentDetailWeight.php index 2a6a4745..7d20611b 100644 --- a/src/Api/Model/ShipmentDetailWeight.php +++ b/src/Api/Model/ShipmentDetailWeight.php @@ -19,12 +19,12 @@ public function isInitialized($property): bool */ protected $unitOfMeasurement; /** - * The value for the weight associated with the shipment. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - * - * @var string - */ + * The value for the weight associated with the shipment. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * + * @var string + */ protected $value; /** * Reference Weight UnitOfMeasurement Container. @@ -49,12 +49,12 @@ public function setUnitOfMeasurement(WeightUnitOfMeasurement $unitOfMeasurement) return $this; } /** - * The value for the weight associated with the shipment. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - * - * @return string - */ + * The value for the weight associated with the shipment. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * + * @return string + */ public function getValue(): string { return $this->value; diff --git a/src/Api/Model/ShipmentDocuments.php b/src/Api/Model/ShipmentDocuments.php index fc2036c4..f981215f 100644 --- a/src/Api/Model/ShipmentDocuments.php +++ b/src/Api/Model/ShipmentDocuments.php @@ -13,8 +13,6 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $image; @@ -25,8 +23,6 @@ public function isInitialized($property): bool */ protected $packingList; /** - * - * * @return list */ public function getImage(): array @@ -34,8 +30,6 @@ public function getImage(): array return $this->image; } /** - * - * * @param list $image * * @return self diff --git a/src/Api/Model/ShipmentExistingShipmentID.php b/src/Api/Model/ShipmentExistingShipmentID.php index f8939054..fc7e82fc 100644 --- a/src/Api/Model/ShipmentExistingShipmentID.php +++ b/src/Api/Model/ShipmentExistingShipmentID.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $shipmentNumber; /** - * Container for the existing shipment pickup confirmation number. - Required only for Shipment Updates. - * - * @var ExistingShipmentIDConfirmationNumber - */ + * Container for the existing shipment pickup confirmation number. + * Required only for Shipment Updates. + * + * @var ExistingShipmentIDConfirmationNumber + */ protected $confirmationNumber; /** * The PRO Number assigned to the shipment. @@ -48,11 +48,11 @@ public function setShipmentNumber(string $shipmentNumber): self return $this; } /** - * Container for the existing shipment pickup confirmation number. - Required only for Shipment Updates. - * - * @return ExistingShipmentIDConfirmationNumber - */ + * Container for the existing shipment pickup confirmation number. + * Required only for Shipment Updates. + * + * @return ExistingShipmentIDConfirmationNumber + */ public function getConfirmationNumber(): ExistingShipmentIDConfirmationNumber { return $this->confirmationNumber; diff --git a/src/Api/Model/ShipmentFreightShipmentInformation.php b/src/Api/Model/ShipmentFreightShipmentInformation.php index d6101d8f..e1980f21 100644 --- a/src/Api/Model/ShipmentFreightShipmentInformation.php +++ b/src/Api/Model/ShipmentFreightShipmentInformation.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $freightDensityInfo; /** - * The presence of the tag indicates that the rate request is density based. - For Density Based Rating (DBR), the customer must have DBR Contract Service. - * - * @var string - */ + * The presence of the tag indicates that the rate request is density based. + * For Density Based Rating (DBR), the customer must have DBR Contract Service. + * + * @var string + */ protected $densityEligibleIndicator; /** * Freight Density Info container. Required if DensityEligibleIndicator is present. @@ -48,11 +48,11 @@ public function setFreightDensityInfo(FreightShipmentInformationFreightDensityIn return $this; } /** - * The presence of the tag indicates that the rate request is density based. - For Density Based Rating (DBR), the customer must have DBR Contract Service. - * - * @return string - */ + * The presence of the tag indicates that the rate request is density based. + * For Density Based Rating (DBR), the customer must have DBR Contract Service. + * + * @return string + */ public function getDensityEligibleIndicator(): string { return $this->densityEligibleIndicator; diff --git a/src/Api/Model/ShipmentPackage.php b/src/Api/Model/ShipmentPackage.php index a55de5db..26fe13fa 100644 --- a/src/Api/Model/ShipmentPackage.php +++ b/src/Api/Model/ShipmentPackage.php @@ -61,12 +61,12 @@ public function isInitialized($property): bool */ protected $packageWeight; /** - * Presence of the indicator mentions that the package is Large Package. - - This is an empty tag, any value inside is ignored. - * - * @var string - */ + * Presence of the indicator mentions that the package is Large Package. + * + * This is an empty tag, any value inside is ignored. + * + * @var string + */ protected $largePackageIndicator; /** * Presence/Absence Indicator. Any value is ignored. If present, indicates that the package is over size. Applicable for UPS Worldwide Economy DDU service. @@ -81,8 +81,6 @@ public function isInitialized($property): bool */ protected $minimumBillableWeightIndicator; /** - * - * * @var list */ protected $referenceNumber; @@ -299,12 +297,12 @@ public function setPackageWeight(PackagePackageWeight $packageWeight): self return $this; } /** - * Presence of the indicator mentions that the package is Large Package. - - This is an empty tag, any value inside is ignored. - * - * @return string - */ + * Presence of the indicator mentions that the package is Large Package. + * + * This is an empty tag, any value inside is ignored. + * + * @return string + */ public function getLargePackageIndicator(): string { return $this->largePackageIndicator; @@ -369,8 +367,6 @@ public function setMinimumBillableWeightIndicator(string $minimumBillableWeightI return $this; } /** - * - * * @return list */ public function getReferenceNumber(): array @@ -378,8 +374,6 @@ public function getReferenceNumber(): array return $this->referenceNumber; } /** - * - * * @param list $referenceNumber * * @return self diff --git a/src/Api/Model/ShipmentPaymentDetails.php b/src/Api/Model/ShipmentPaymentDetails.php index 6d355881..0eec2df2 100644 --- a/src/Api/Model/ShipmentPaymentDetails.php +++ b/src/Api/Model/ShipmentPaymentDetails.php @@ -13,8 +13,6 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $shipmentCharge; @@ -25,8 +23,6 @@ public function isInitialized($property): bool */ protected $splitDutyVATIndicator; /** - * - * * @return list */ public function getShipmentCharge(): array @@ -34,8 +30,6 @@ public function getShipmentCharge(): array return $this->shipmentCharge; } /** - * - * * @param list $shipmentCharge * * @return self diff --git a/src/Api/Model/ShipmentPaymentInformation.php b/src/Api/Model/ShipmentPaymentInformation.php index 90bce70b..230bf917 100644 --- a/src/Api/Model/ShipmentPaymentInformation.php +++ b/src/Api/Model/ShipmentPaymentInformation.php @@ -13,8 +13,6 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $shipmentCharge; @@ -25,8 +23,6 @@ public function isInitialized($property): bool */ protected $splitDutyVATIndicator; /** - * - * * @return list */ public function getShipmentCharge(): array @@ -34,8 +30,6 @@ public function getShipmentCharge(): array return $this->shipmentCharge; } /** - * - * * @param list $shipmentCharge * * @return self diff --git a/src/Api/Model/ShipmentPickupRequest.php b/src/Api/Model/ShipmentPickupRequest.php index 92ecbb62..2fe6edde 100644 --- a/src/Api/Model/ShipmentPickupRequest.php +++ b/src/Api/Model/ShipmentPickupRequest.php @@ -19,41 +19,41 @@ public function isInitialized($property): bool */ protected $additionalComments; /** - * Requester Container. Also referred to as caller. - Required for ground shipments if PickupRequest container is present. - * - * @var PickupRequestRequester - */ + * Requester Container. Also referred to as caller. + * Required for ground shipments if PickupRequest container is present. + * + * @var PickupRequestRequester + */ protected $requester; /** - * Date of the Pickup. - Format: YYYYMMDD. - Ground pickup may be scheduled up to 42 days in the future. - Note: This element will act as PickupDate or DropOffDate based on the presence of PickupTimeReady or DropOffTimeReady element. - * - * @var string - */ + * Date of the Pickup. + * Format: YYYYMMDD. + * Ground pickup may be scheduled up to 42 days in the future. + * Note: This element will act as PickupDate or DropOffDate based on the presence of PickupTimeReady or DropOffTimeReady element. + * + * @var string + */ protected $pickupDate; /** - * The earliest time a shipment is ready to be picked up. - The time is on a 24 hour clock. - Format: HHMM - HH = Hour values 00 to 23 - MM = Minute values 00 to 59 - * - * @var string - */ + * The earliest time a shipment is ready to be picked up. + * The time is on a 24 hour clock. + * Format: HHMM + * HH = Hour values 00 to 23 + * MM = Minute values 00 to 59 + * + * @var string + */ protected $earliestTimeReady; /** - * The latest time a shipment can be picked up. Can be also referred as the Closing Time for a pickup time window. - The time is on a 24 hour clock. - Format: HHMM - HH = Hour values 00 to 23 - MM = Minute values 00 to 59 - Optional if the account type is House. - * - * @var string - */ + * The latest time a shipment can be picked up. Can be also referred as the Closing Time for a pickup time window. + * The time is on a 24 hour clock. + * Format: HHMM + * HH = Hour values 00 to 23 + * MM = Minute values 00 to 59 + * Optional if the account type is House. + * + * @var string + */ protected $latestTimeReady; /** * Pickup Order Management (POM) container. @@ -84,11 +84,11 @@ public function setAdditionalComments(string $additionalComments): self return $this; } /** - * Requester Container. Also referred to as caller. - Required for ground shipments if PickupRequest container is present. - * - * @return PickupRequestRequester - */ + * Requester Container. Also referred to as caller. + * Required for ground shipments if PickupRequest container is present. + * + * @return PickupRequestRequester + */ public function getRequester(): PickupRequestRequester { return $this->requester; @@ -108,13 +108,13 @@ public function setRequester(PickupRequestRequester $requester): self return $this; } /** - * Date of the Pickup. - Format: YYYYMMDD. - Ground pickup may be scheduled up to 42 days in the future. - Note: This element will act as PickupDate or DropOffDate based on the presence of PickupTimeReady or DropOffTimeReady element. - * - * @return string - */ + * Date of the Pickup. + * Format: YYYYMMDD. + * Ground pickup may be scheduled up to 42 days in the future. + * Note: This element will act as PickupDate or DropOffDate based on the presence of PickupTimeReady or DropOffTimeReady element. + * + * @return string + */ public function getPickupDate(): string { return $this->pickupDate; @@ -136,14 +136,14 @@ public function setPickupDate(string $pickupDate): self return $this; } /** - * The earliest time a shipment is ready to be picked up. - The time is on a 24 hour clock. - Format: HHMM - HH = Hour values 00 to 23 - MM = Minute values 00 to 59 - * - * @return string - */ + * The earliest time a shipment is ready to be picked up. + * The time is on a 24 hour clock. + * Format: HHMM + * HH = Hour values 00 to 23 + * MM = Minute values 00 to 59 + * + * @return string + */ public function getEarliestTimeReady(): string { return $this->earliestTimeReady; @@ -166,15 +166,15 @@ public function setEarliestTimeReady(string $earliestTimeReady): self return $this; } /** - * The latest time a shipment can be picked up. Can be also referred as the Closing Time for a pickup time window. - The time is on a 24 hour clock. - Format: HHMM - HH = Hour values 00 to 23 - MM = Minute values 00 to 59 - Optional if the account type is House. - * - * @return string - */ + * The latest time a shipment can be picked up. Can be also referred as the Closing Time for a pickup time window. + * The time is on a 24 hour clock. + * Format: HHMM + * HH = Hour values 00 to 23 + * MM = Minute values 00 to 59 + * Optional if the account type is House. + * + * @return string + */ public function getLatestTimeReady(): string { return $this->latestTimeReady; diff --git a/src/Api/Model/ShipmentReference.php b/src/Api/Model/ShipmentReference.php index 2b69f420..e8aadab5 100644 --- a/src/Api/Model/ShipmentReference.php +++ b/src/Api/Model/ShipmentReference.php @@ -25,18 +25,18 @@ public function isInitialized($property): bool */ protected $barCodeIndicator; /** - * Number of cartons attached to this reference. - Strongly recommended for ground services. - * - * @var string - */ + * Number of cartons attached to this reference. + * Strongly recommended for ground services. + * + * @var string + */ protected $numberOfCartons; /** - * Reference Weight Container. - Strongly recommended for ground services.Ignored for air services. - * - * @var ReferenceWeight - */ + * Reference Weight Container. + * Strongly recommended for ground services.Ignored for air services. + * + * @var ReferenceWeight + */ protected $weight; /** * Reference Number Container. @@ -83,11 +83,11 @@ public function setBarCodeIndicator(string $barCodeIndicator): self return $this; } /** - * Number of cartons attached to this reference. - Strongly recommended for ground services. - * - * @return string - */ + * Number of cartons attached to this reference. + * Strongly recommended for ground services. + * + * @return string + */ public function getNumberOfCartons(): string { return $this->numberOfCartons; @@ -107,11 +107,11 @@ public function setNumberOfCartons(string $numberOfCartons): self return $this; } /** - * Reference Weight Container. - Strongly recommended for ground services.Ignored for air services. - * - * @return ReferenceWeight - */ + * Reference Weight Container. + * Strongly recommended for ground services.Ignored for air services. + * + * @return ReferenceWeight + */ public function getWeight(): ReferenceWeight { return $this->weight; diff --git a/src/Api/Model/ShipmentRequestLabelSpecification.php b/src/Api/Model/ShipmentRequestLabelSpecification.php index 14d383e7..ee7b3109 100644 --- a/src/Api/Model/ShipmentRequestLabelSpecification.php +++ b/src/Api/Model/ShipmentRequestLabelSpecification.php @@ -31,40 +31,38 @@ public function isInitialized($property): bool */ protected $labelStockSize; /** - * - * * @var list */ protected $instruction; /** - * Language character set expected on label. - Valid values: - dan = Danish (Latin-1) - nld = Dutch (Latin-1) - fin = Finnish (Latin-1) - fra = French (Latin-1) - deu = German (Latin-1) - itl = Italian (Latin-1) - nor = Norwegian (Latin-1) - pol = Polish (Latin-2) - por = Poruguese (Latin-1) - spa = Spanish (Latin-1) - swe = Swedish (Latin-1) - ces = Czech (Latin-2) - hun = Hungarian (Latin-2) - slk = Slovak (Latin-2) - rus = Russian (Cyrillic) - tur = Turkish (Latin-5) - ron = Romanian (Latin-2) - bul = Bulgarian (Latin-2) - est = Estonian (Latin-2) - ell = Greek (Latin-2) - lav = Latvian (Latin-2) - lit = Lithuanian (Latin-2) - eng = English (Latin-1) Default is English (Latin-1). - * - * @var string - */ + * Language character set expected on label. + * Valid values: + * dan = Danish (Latin-1) + * nld = Dutch (Latin-1) + * fin = Finnish (Latin-1) + * fra = French (Latin-1) + * deu = German (Latin-1) + * itl = Italian (Latin-1) + * nor = Norwegian (Latin-1) + * pol = Polish (Latin-2) + * por = Poruguese (Latin-1) + * spa = Spanish (Latin-1) + * swe = Swedish (Latin-1) + * ces = Czech (Latin-2) + * hun = Hungarian (Latin-2) + * slk = Slovak (Latin-2) + * rus = Russian (Cyrillic) + * tur = Turkish (Latin-5) + * ron = Romanian (Latin-2) + * bul = Bulgarian (Latin-2) + * est = Estonian (Latin-2) + * ell = Greek (Latin-2) + * lav = Latvian (Latin-2) + * lit = Lithuanian (Latin-2) + * eng = English (Latin-1) Default is English (Latin-1). + * + * @var string + */ protected $characterSet; /** * LabelImageFormat Container. @@ -133,8 +131,6 @@ public function setLabelStockSize(LabelSpecificationLabelStockSize $labelStockSi return $this; } /** - * - * * @return list */ public function getInstruction(): array @@ -142,8 +138,6 @@ public function getInstruction(): array return $this->instruction; } /** - * - * * @param list $instruction * * @return self @@ -155,34 +149,34 @@ public function setInstruction(array $instruction): self return $this; } /** - * Language character set expected on label. - Valid values: - dan = Danish (Latin-1) - nld = Dutch (Latin-1) - fin = Finnish (Latin-1) - fra = French (Latin-1) - deu = German (Latin-1) - itl = Italian (Latin-1) - nor = Norwegian (Latin-1) - pol = Polish (Latin-2) - por = Poruguese (Latin-1) - spa = Spanish (Latin-1) - swe = Swedish (Latin-1) - ces = Czech (Latin-2) - hun = Hungarian (Latin-2) - slk = Slovak (Latin-2) - rus = Russian (Cyrillic) - tur = Turkish (Latin-5) - ron = Romanian (Latin-2) - bul = Bulgarian (Latin-2) - est = Estonian (Latin-2) - ell = Greek (Latin-2) - lav = Latvian (Latin-2) - lit = Lithuanian (Latin-2) - eng = English (Latin-1) Default is English (Latin-1). - * - * @return string - */ + * Language character set expected on label. + * Valid values: + * dan = Danish (Latin-1) + * nld = Dutch (Latin-1) + * fin = Finnish (Latin-1) + * fra = French (Latin-1) + * deu = German (Latin-1) + * itl = Italian (Latin-1) + * nor = Norwegian (Latin-1) + * pol = Polish (Latin-2) + * por = Poruguese (Latin-1) + * spa = Spanish (Latin-1) + * swe = Swedish (Latin-1) + * ces = Czech (Latin-2) + * hun = Hungarian (Latin-2) + * slk = Slovak (Latin-2) + * rus = Russian (Cyrillic) + * tur = Turkish (Latin-5) + * ron = Romanian (Latin-2) + * bul = Bulgarian (Latin-2) + * est = Estonian (Latin-2) + * ell = Greek (Latin-2) + * lav = Latvian (Latin-2) + * lit = Lithuanian (Latin-2) + * eng = English (Latin-1) Default is English (Latin-1). + * + * @return string + */ public function getCharacterSet(): string { return $this->characterSet; diff --git a/src/Api/Model/ShipmentRequestRequest.php b/src/Api/Model/ShipmentRequestRequest.php index 53a70c49..1abb0100 100644 --- a/src/Api/Model/ShipmentRequestRequest.php +++ b/src/Api/Model/ShipmentRequestRequest.php @@ -13,29 +13,29 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Optional Processing. - - Note: Full address validation is not performed. Therefore, it is the responsibility of the Shipping Tool User to ensure the address entered is correct to avoid an address correction fee. Valid values: - nonvalidate = No street level address validation would be performed, but Postal Code/State combination validation would still be performed. - - validate = No street level address validation would be performed, but City/State/Postal Code/ combination validation would still be performed. - * - * @var string - */ + * Optional Processing. + * + * Note: Full address validation is not performed. Therefore, it is the responsibility of the Shipping Tool User to ensure the address entered is correct to avoid an address correction fee. Valid values: + * nonvalidate = No street level address validation would be performed, but Postal Code/State combination validation would still be performed. + * + * validate = No street level address validation would be performed, but City/State/Postal Code/ combination validation would still be performed. + * + * @var string + */ protected $requestOption; /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. - - Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to 1601. - - Format: YYMM = Year and month of the release. - - Example: 1607 = 2016 July Supported values: 1601, 1607, 1701, 1707, 1801, 1807, 2108, 2205 - * - * @var string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. + * + * Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to 1601. + * + * Format: YYMM = Year and month of the release. + * + * Example: 1607 = 2016 July Supported values: 1601, 1607, 1701, 1707, 1801, 1807, 2108, 2205 + * + * @var string + */ protected $subVersion; /** * TransactionReference identifies transactions between client and server. @@ -44,15 +44,15 @@ public function isInitialized($property): bool */ protected $transactionReference; /** - * Optional Processing. - - Note: Full address validation is not performed. Therefore, it is the responsibility of the Shipping Tool User to ensure the address entered is correct to avoid an address correction fee. Valid values: - nonvalidate = No street level address validation would be performed, but Postal Code/State combination validation would still be performed. - - validate = No street level address validation would be performed, but City/State/Postal Code/ combination validation would still be performed. - * - * @return string - */ + * Optional Processing. + * + * Note: Full address validation is not performed. Therefore, it is the responsibility of the Shipping Tool User to ensure the address entered is correct to avoid an address correction fee. Valid values: + * nonvalidate = No street level address validation would be performed, but Postal Code/State combination validation would still be performed. + * + * validate = No street level address validation would be performed, but City/State/Postal Code/ combination validation would still be performed. + * + * @return string + */ public function getRequestOption(): string { return $this->requestOption; @@ -76,18 +76,18 @@ public function setRequestOption(string $requestOption): self return $this; } /** - * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. - - To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. - - Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to 1601. - - Format: YYMM = Year and month of the release. - - Example: 1607 = 2016 July Supported values: 1601, 1607, 1701, 1707, 1801, 1807, 2108, 2205 - * - * @return string - */ + * When UPS introduces new elements in the response that are not associated with new request elements, Subversion is used. This ensures backward compatibility. + * + * To get such elements you need to have the right Subversion. The value of the subversion is explained in the Response element Description. + * + * Example: Itemized Charges are returned only when the Subversion element is present and greater than or equal to 1601. + * + * Format: YYMM = Year and month of the release. + * + * Example: 1607 = 2016 July Supported values: 1601, 1607, 1701, 1707, 1801, 1807, 2108, 2205 + * + * @return string + */ public function getSubVersion(): string { return $this->subVersion; diff --git a/src/Api/Model/ShipmentRequestShipment.php b/src/Api/Model/ShipmentRequestShipment.php index 7eaf3557..fe6f4394 100644 --- a/src/Api/Model/ShipmentRequestShipment.php +++ b/src/Api/Model/ShipmentRequestShipment.php @@ -13,15 +13,15 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The Description of Goods for the shipment. Applies to international and domestic shipments. - - Provide a detailed description of items being shipped for documents and non-documents. - - Examples: "annual reports" and "9 mm steel screws". Required if all of the listed conditions are true: - ShipFrom and ShipTo countries or territories are not the same; The packaging type is not UPS Letter; The ShipFrom and or ShipTo countries or territories are not in the European Union or the ShipFrom and ShipTo countries or territories are both in the European Union and the shipments service type is not UPS Standard. - * - * @var string - */ + * The Description of Goods for the shipment. Applies to international and domestic shipments. + * + * Provide a detailed description of items being shipped for documents and non-documents. + * + * Examples: "annual reports" and "9 mm steel screws". Required if all of the listed conditions are true: + * ShipFrom and ShipTo countries or territories are not the same; The packaging type is not UPS Letter; The ShipFrom and or ShipTo countries or territories are not in the European Union or the ShipFrom and ShipTo countries or territories are both in the European Union and the shipments service type is not UPS Standard. + * + * @var string + */ protected $description; /** * Type of Return service. When this container exists, the shipment is a return shipment. @@ -30,16 +30,16 @@ public function isInitialized($property): bool */ protected $returnService; /** - * Indicates a shipment contains written, typed, or printed communication of no commercial value. - - If DocumentsOnly is not specified then it implies that the shipment contains non documents or documents of commercial value. - - Default is a shipment contains non- documents or documents of commercial value. This is an empty tag, any value inside is ignored. - - Valid only for shipments with different origin and destination countries or territories. The origin country or territory is not US, and the destination country or territory is not CA, PR or MX. - * - * @var string - */ + * Indicates a shipment contains written, typed, or printed communication of no commercial value. + * + * If DocumentsOnly is not specified then it implies that the shipment contains non documents or documents of commercial value. + * + * Default is a shipment contains non- documents or documents of commercial value. This is an empty tag, any value inside is ignored. + * + * Valid only for shipments with different origin and destination countries or territories. The origin country or territory is not US, and the destination country or territory is not CA, PR or MX. + * + * @var string + */ protected $documentsOnlyIndicator; /** * Container for the Shipper's information. @@ -60,12 +60,12 @@ public function isInitialized($property): bool */ protected $alternateDeliveryAddress; /** - * Ship From Container. Required for return shipment. - - Required if pickup location is different from the shipper's address. - * - * @var ShipmentShipFrom - */ + * Ship From Container. Required for return shipment. + * + * Required if pickup location is different from the shipper's address. + * + * @var ShipmentShipFrom + */ protected $shipFrom; /** * Payment information container for detailed shipment charges. The two shipment charges that are available for specification are Transportation charges and Duties and Taxes. It is required for non-Ground Freight Pricing shipments only. @@ -116,8 +116,6 @@ public function isInitialized($property): bool */ protected $movementReferenceNumber; /** - * - * * @var list */ protected $referenceNumber; @@ -140,17 +138,17 @@ public function isInitialized($property): bool */ protected $numOfPiecesInShipment; /** - * USPS Endorsement. - Valid values: - 1 = Return Service Requested - 2 = Forwarding Service Requested - 3 = Address Service Requested - 4 = Change Service Requested and - 5 = No Service Selected. - Note: For International Mail Innovations shipments use No Service Selected. International Mail Innovations shipments are applicable for Priority Mail Innovations and Mail Innovations Economy Mail Innovations services only. Required for Mail Innovations forward shipments. - * - * @var string - */ + * USPS Endorsement. + * Valid values: + * 1 = Return Service Requested + * 2 = Forwarding Service Requested + * 3 = Address Service Requested + * 4 = Change Service Requested and + * 5 = No Service Selected. + * Note: For International Mail Innovations shipments use No Service Selected. International Mail Innovations shipments are applicable for Priority Mail Innovations and Mail Innovations Economy Mail Innovations services only. Required for Mail Innovations forward shipments. + * + * @var string + */ protected $uSPSEndorsement; /** * Indicates single label with both MI label and CN22 form. International CN22 form is required. @@ -159,23 +157,23 @@ public function isInitialized($property): bool */ protected $mILabelCN22Indicator; /** - * A component encoded on the barcode of the Mail Innovations label. Valid values: - IR = Irregular - MA = Machineable - SubClass is only required if the customer's contract have them subclass the package not UPS. - * - * @var string - */ + * A component encoded on the barcode of the Mail Innovations label. Valid values: + * IR = Irregular + * MA = Machineable + * SubClass is only required if the customer's contract have them subclass the package not UPS. + * + * @var string + */ protected $subClassification; /** - * Customer assigned identifier for report and billing summarization displays to the right of the Cost Center title. Required for Mail Innovations Return shipments. It is shown on the bottom of the shipping label as reference 2. - - Cost Center length is alphanumeric with a max length of 30 for Mail Innovations forward shipments. - - Cost Center length is numeric with a max length of 4 for Mail Innovations Return shipments. - * - * @var string - */ + * Customer assigned identifier for report and billing summarization displays to the right of the Cost Center title. Required for Mail Innovations Return shipments. It is shown on the bottom of the shipping label as reference 2. + * + * Cost Center length is alphanumeric with a max length of 30 for Mail Innovations forward shipments. + * + * Cost Center length is numeric with a max length of 4 for Mail Innovations Return shipments. + * + * @var string + */ protected $costCenter; /** * Presence/Absence indicator. Presence of this indicator means that the customer is requesting for the CostCenter field to be barcoded at the bottom of the label. @@ -196,57 +194,55 @@ public function isInitialized($property): bool */ protected $packageIDBarcodeIndicator; /** - * Mail classification defined by the USPS. Valid values: - 1 = Balloon - 2 = Oversize - 3 = Not Applicable - * - * @var string - */ + * Mail classification defined by the USPS. Valid values: + * 1 = Balloon + * 2 = Oversize + * 3 = Not Applicable + * + * @var string + */ protected $irregularIndicator; /** - * - * * @var list */ protected $shipmentIndicationType; /** - * MIDualReturnShipmentKey is unique key required to process Mail Innovations Dual Return Shipment. - - The unique identifier (key) would be returned in response of first phase of Mail Innovations Dual Return Shipments. - - This unique identifier (key) would be part of request for second phase of Mail Innovations Dual Return Shipments. - - Format: - For Package return shipments, the package tracking number is concatenated with the system time (YYYY-MM-DDHH.MM.SS.NNN), followed by service code. - - For MI Return shipments, the Mail Manifest ID (MMI) is concatenated with the system time. The unique identifier (key) is required to link the package and the Mail Innovations portion of Dual Return shipment. - - If unique identifier (key) is empty in the request for UPS Mail Innovations Return Service, the request will be treated as the first phase of the Mail Innovations Dual Returns Request. - - If the MIDualReturnShipmentIndicator is present with empty or null MIDualReturnShipmentKey in UPS Package Return Shipment, the request will be treated as the first phase of Dual MI Return Label Shipment. - - This field would be ignored if MIDualReturnShipmentIndicator is not present in UPS Package Return Shipment request. - * - * @var string - */ + * MIDualReturnShipmentKey is unique key required to process Mail Innovations Dual Return Shipment. + * + * The unique identifier (key) would be returned in response of first phase of Mail Innovations Dual Return Shipments. + * + * This unique identifier (key) would be part of request for second phase of Mail Innovations Dual Return Shipments. + * + * Format: + * For Package return shipments, the package tracking number is concatenated with the system time (YYYY-MM-DDHH.MM.SS.NNN), followed by service code. + * + * For MI Return shipments, the Mail Manifest ID (MMI) is concatenated with the system time. The unique identifier (key) is required to link the package and the Mail Innovations portion of Dual Return shipment. + * + * If unique identifier (key) is empty in the request for UPS Mail Innovations Return Service, the request will be treated as the first phase of the Mail Innovations Dual Returns Request. + * + * If the MIDualReturnShipmentIndicator is present with empty or null MIDualReturnShipmentKey in UPS Package Return Shipment, the request will be treated as the first phase of Dual MI Return Label Shipment. + * + * This field would be ignored if MIDualReturnShipmentIndicator is not present in UPS Package Return Shipment request. + * + * @var string + */ protected $mIDualReturnShipmentKey; /** - * MIDualReturnShipmentIndicator is an indicator to identify a Package Shipment is part of UPS Mail Innovations Dual Label Shipment. - - Its presence means Package Shipment is part of UPS Mail Innovations Dual Label shipment. If the indicator is present in Package Shipment request, shipment would be considered as part of a Dual Mail Innovations Returns. - - This indicator is not valid with UPS Mail Innovations Returns Service code. - * - * @var string - */ + * MIDualReturnShipmentIndicator is an indicator to identify a Package Shipment is part of UPS Mail Innovations Dual Label Shipment. + * + * Its presence means Package Shipment is part of UPS Mail Innovations Dual Label shipment. If the indicator is present in Package Shipment request, shipment would be considered as part of a Dual Mail Innovations Returns. + * + * This indicator is not valid with UPS Mail Innovations Returns Service code. + * + * @var string + */ protected $mIDualReturnShipmentIndicator; /** - * Presence/Absence Indicator. Any value inside is ignored. RatingMethodRequestedIndicator is an indicator. - If present, Billable Weight Calculation method information and Rating Method information would be returned in response. - * - * @var string - */ + * Presence/Absence Indicator. Any value inside is ignored. RatingMethodRequestedIndicator is an indicator. + * If present, Billable Weight Calculation method information and Rating Method information would be returned in response. + * + * @var string + */ protected $ratingMethodRequestedIndicator; /** * Presence/Absence Indicator. Any value inside is ignored. TaxInformationIndicator is an indicator. If present, any taxes that may be applicable to a shipment would be returned in response. If this indicator is requested with NegotiatedRatesIndicator, Tax related information, if applicable, would be returned only for Negotiated Rates and not for Published Rates. The Tax related information includes any type of Taxes, corresponding Monetary Values, Total Charges with Taxes and disclaimers (if applicable) would be returned in response. @@ -261,19 +257,19 @@ public function isInitialized($property): bool */ protected $shipmentServiceOptions; /** - * Represents 5 character ISO Locale that allows the user to request Reference Number Code on Label, Label instructions and Receipt instructions (if applicable) in desired language. - Locale is specified by the combination of language code and country or territory code - 2 character language code and 2 character country or territory code seperated by an underscore ('_') character. If Locale element is requested along with LabelLinksIndicator, the URL to retrieve Label and Receipts (if applicable) will be returned in the requested Locale. Please note only LabelURL and ReceiptURL (if applicable) will be returned. LocalLanguageLabelURL and LocalLanguageReceiptURL will not be returned if Locale element is present in request. - Queen's English (en_GB) is the default - * - * @var string - */ + * Represents 5 character ISO Locale that allows the user to request Reference Number Code on Label, Label instructions and Receipt instructions (if applicable) in desired language. + * Locale is specified by the combination of language code and country or territory code - 2 character language code and 2 character country or territory code seperated by an underscore ('_') character. If Locale element is requested along with LabelLinksIndicator, the URL to retrieve Label and Receipts (if applicable) will be returned in the requested Locale. Please note only LabelURL and ReceiptURL (if applicable) will be returned. LocalLanguageLabelURL and LocalLanguageReceiptURL will not be returned if Locale element is present in request. + * Queen's English (en_GB) is the default + * + * @var string + */ protected $locale; /** - * Shipment Value Threshold Code. 01 = Shipment value is below or equals to threshold value - 02 = Shipment value is above threshold value. NA = Not Applicable - * - * @var string - */ + * Shipment Value Threshold Code. 01 = Shipment value is below or equals to threshold value + * 02 = Shipment value is above threshold value. NA = Not Applicable + * + * @var string + */ protected $shipmentValueThresholdCode; /** * Master Carton ID. If Economy Service (17 or 72) : Economy Shipment will be associated with given Master Carton ID. If Non-Economy Service: Master Carton Shipment will be created for given Master Carton ID. @@ -282,11 +278,11 @@ public function isInitialized($property): bool */ protected $masterCartonID; /** - * Master Carton Indicator. Presence of the indicator means Master Carton ID will be created and returned to client. - This is an empty tag, any value inside is ignored. MasterCartonIndicator is only valid with Econmoy Shipment (Service Code 17 or 72). Will be ignored if master carton id present. - * - * @var string - */ + * Master Carton Indicator. Presence of the indicator means Master Carton ID will be created and returned to client. + * This is an empty tag, any value inside is ignored. MasterCartonIndicator is only valid with Econmoy Shipment (Service Code 17 or 72). Will be ignored if master carton id present. + * + * @var string + */ protected $masterCartonIndicator; /** * User can send up to 7 days in the future with current date as day zero. Format: YYYYMMDD @@ -295,21 +291,19 @@ public function isInitialized($property): bool */ protected $shipmentDate; /** - * - * * @var list */ protected $package; /** - * The Description of Goods for the shipment. Applies to international and domestic shipments. - - Provide a detailed description of items being shipped for documents and non-documents. - - Examples: "annual reports" and "9 mm steel screws". Required if all of the listed conditions are true: - ShipFrom and ShipTo countries or territories are not the same; The packaging type is not UPS Letter; The ShipFrom and or ShipTo countries or territories are not in the European Union or the ShipFrom and ShipTo countries or territories are both in the European Union and the shipments service type is not UPS Standard. - * - * @return string - */ + * The Description of Goods for the shipment. Applies to international and domestic shipments. + * + * Provide a detailed description of items being shipped for documents and non-documents. + * + * Examples: "annual reports" and "9 mm steel screws". Required if all of the listed conditions are true: + * ShipFrom and ShipTo countries or territories are not the same; The packaging type is not UPS Letter; The ShipFrom and or ShipTo countries or territories are not in the European Union or the ShipFrom and ShipTo countries or territories are both in the European Union and the shipments service type is not UPS Standard. + * + * @return string + */ public function getDescription(): string { return $this->description; @@ -355,16 +349,16 @@ public function setReturnService(ShipmentReturnService $returnService): self return $this; } /** - * Indicates a shipment contains written, typed, or printed communication of no commercial value. - - If DocumentsOnly is not specified then it implies that the shipment contains non documents or documents of commercial value. - - Default is a shipment contains non- documents or documents of commercial value. This is an empty tag, any value inside is ignored. - - Valid only for shipments with different origin and destination countries or territories. The origin country or territory is not US, and the destination country or territory is not CA, PR or MX. - * - * @return string - */ + * Indicates a shipment contains written, typed, or printed communication of no commercial value. + * + * If DocumentsOnly is not specified then it implies that the shipment contains non documents or documents of commercial value. + * + * Default is a shipment contains non- documents or documents of commercial value. This is an empty tag, any value inside is ignored. + * + * Valid only for shipments with different origin and destination countries or territories. The origin country or territory is not US, and the destination country or territory is not CA, PR or MX. + * + * @return string + */ public function getDocumentsOnlyIndicator(): string { return $this->documentsOnlyIndicator; @@ -455,12 +449,12 @@ public function setAlternateDeliveryAddress(ShipmentAlternateDeliveryAddress $al return $this; } /** - * Ship From Container. Required for return shipment. - - Required if pickup location is different from the shipper's address. - * - * @return ShipmentShipFrom - */ + * Ship From Container. Required for return shipment. + * + * Required if pickup location is different from the shipper's address. + * + * @return ShipmentShipFrom + */ public function getShipFrom(): ShipmentShipFrom { return $this->shipFrom; @@ -657,8 +651,6 @@ public function setMovementReferenceNumber(string $movementReferenceNumber): sel return $this; } /** - * - * * @return list */ public function getReferenceNumber(): array @@ -666,8 +658,6 @@ public function getReferenceNumber(): array return $this->referenceNumber; } /** - * - * * @param list $referenceNumber * * @return self @@ -745,17 +735,17 @@ public function setNumOfPiecesInShipment(string $numOfPiecesInShipment): self return $this; } /** - * USPS Endorsement. - Valid values: - 1 = Return Service Requested - 2 = Forwarding Service Requested - 3 = Address Service Requested - 4 = Change Service Requested and - 5 = No Service Selected. - Note: For International Mail Innovations shipments use No Service Selected. International Mail Innovations shipments are applicable for Priority Mail Innovations and Mail Innovations Economy Mail Innovations services only. Required for Mail Innovations forward shipments. - * - * @return string - */ + * USPS Endorsement. + * Valid values: + * 1 = Return Service Requested + * 2 = Forwarding Service Requested + * 3 = Address Service Requested + * 4 = Change Service Requested and + * 5 = No Service Selected. + * Note: For International Mail Innovations shipments use No Service Selected. International Mail Innovations shipments are applicable for Priority Mail Innovations and Mail Innovations Economy Mail Innovations services only. Required for Mail Innovations forward shipments. + * + * @return string + */ public function getUSPSEndorsement(): string { return $this->uSPSEndorsement; @@ -803,13 +793,13 @@ public function setMILabelCN22Indicator(string $mILabelCN22Indicator): self return $this; } /** - * A component encoded on the barcode of the Mail Innovations label. Valid values: - IR = Irregular - MA = Machineable - SubClass is only required if the customer's contract have them subclass the package not UPS. - * - * @return string - */ + * A component encoded on the barcode of the Mail Innovations label. Valid values: + * IR = Irregular + * MA = Machineable + * SubClass is only required if the customer's contract have them subclass the package not UPS. + * + * @return string + */ public function getSubClassification(): string { return $this->subClassification; @@ -831,14 +821,14 @@ public function setSubClassification(string $subClassification): self return $this; } /** - * Customer assigned identifier for report and billing summarization displays to the right of the Cost Center title. Required for Mail Innovations Return shipments. It is shown on the bottom of the shipping label as reference 2. - - Cost Center length is alphanumeric with a max length of 30 for Mail Innovations forward shipments. - - Cost Center length is numeric with a max length of 4 for Mail Innovations Return shipments. - * - * @return string - */ + * Customer assigned identifier for report and billing summarization displays to the right of the Cost Center title. Required for Mail Innovations Return shipments. It is shown on the bottom of the shipping label as reference 2. + * + * Cost Center length is alphanumeric with a max length of 30 for Mail Innovations forward shipments. + * + * Cost Center length is numeric with a max length of 4 for Mail Innovations Return shipments. + * + * @return string + */ public function getCostCenter(): string { return $this->costCenter; @@ -927,13 +917,13 @@ public function setPackageIDBarcodeIndicator(string $packageIDBarcodeIndicator): return $this; } /** - * Mail classification defined by the USPS. Valid values: - 1 = Balloon - 2 = Oversize - 3 = Not Applicable - * - * @return string - */ + * Mail classification defined by the USPS. Valid values: + * 1 = Balloon + * 2 = Oversize + * 3 = Not Applicable + * + * @return string + */ public function getIrregularIndicator(): string { return $this->irregularIndicator; @@ -955,8 +945,6 @@ public function setIrregularIndicator(string $irregularIndicator): self return $this; } /** - * - * * @return list */ public function getShipmentIndicationType(): array @@ -964,8 +952,6 @@ public function getShipmentIndicationType(): array return $this->shipmentIndicationType; } /** - * - * * @param list $shipmentIndicationType * * @return self @@ -977,25 +963,25 @@ public function setShipmentIndicationType(array $shipmentIndicationType): self return $this; } /** - * MIDualReturnShipmentKey is unique key required to process Mail Innovations Dual Return Shipment. - - The unique identifier (key) would be returned in response of first phase of Mail Innovations Dual Return Shipments. - - This unique identifier (key) would be part of request for second phase of Mail Innovations Dual Return Shipments. - - Format: - For Package return shipments, the package tracking number is concatenated with the system time (YYYY-MM-DDHH.MM.SS.NNN), followed by service code. - - For MI Return shipments, the Mail Manifest ID (MMI) is concatenated with the system time. The unique identifier (key) is required to link the package and the Mail Innovations portion of Dual Return shipment. - - If unique identifier (key) is empty in the request for UPS Mail Innovations Return Service, the request will be treated as the first phase of the Mail Innovations Dual Returns Request. - - If the MIDualReturnShipmentIndicator is present with empty or null MIDualReturnShipmentKey in UPS Package Return Shipment, the request will be treated as the first phase of Dual MI Return Label Shipment. - - This field would be ignored if MIDualReturnShipmentIndicator is not present in UPS Package Return Shipment request. - * - * @return string - */ + * MIDualReturnShipmentKey is unique key required to process Mail Innovations Dual Return Shipment. + * + * The unique identifier (key) would be returned in response of first phase of Mail Innovations Dual Return Shipments. + * + * This unique identifier (key) would be part of request for second phase of Mail Innovations Dual Return Shipments. + * + * Format: + * For Package return shipments, the package tracking number is concatenated with the system time (YYYY-MM-DDHH.MM.SS.NNN), followed by service code. + * + * For MI Return shipments, the Mail Manifest ID (MMI) is concatenated with the system time. The unique identifier (key) is required to link the package and the Mail Innovations portion of Dual Return shipment. + * + * If unique identifier (key) is empty in the request for UPS Mail Innovations Return Service, the request will be treated as the first phase of the Mail Innovations Dual Returns Request. + * + * If the MIDualReturnShipmentIndicator is present with empty or null MIDualReturnShipmentKey in UPS Package Return Shipment, the request will be treated as the first phase of Dual MI Return Label Shipment. + * + * This field would be ignored if MIDualReturnShipmentIndicator is not present in UPS Package Return Shipment request. + * + * @return string + */ public function getMIDualReturnShipmentKey(): string { return $this->mIDualReturnShipmentKey; @@ -1029,14 +1015,14 @@ public function setMIDualReturnShipmentKey(string $mIDualReturnShipmentKey): sel return $this; } /** - * MIDualReturnShipmentIndicator is an indicator to identify a Package Shipment is part of UPS Mail Innovations Dual Label Shipment. - - Its presence means Package Shipment is part of UPS Mail Innovations Dual Label shipment. If the indicator is present in Package Shipment request, shipment would be considered as part of a Dual Mail Innovations Returns. - - This indicator is not valid with UPS Mail Innovations Returns Service code. - * - * @return string - */ + * MIDualReturnShipmentIndicator is an indicator to identify a Package Shipment is part of UPS Mail Innovations Dual Label Shipment. + * + * Its presence means Package Shipment is part of UPS Mail Innovations Dual Label shipment. If the indicator is present in Package Shipment request, shipment would be considered as part of a Dual Mail Innovations Returns. + * + * This indicator is not valid with UPS Mail Innovations Returns Service code. + * + * @return string + */ public function getMIDualReturnShipmentIndicator(): string { return $this->mIDualReturnShipmentIndicator; @@ -1059,11 +1045,11 @@ public function setMIDualReturnShipmentIndicator(string $mIDualReturnShipmentInd return $this; } /** - * Presence/Absence Indicator. Any value inside is ignored. RatingMethodRequestedIndicator is an indicator. - If present, Billable Weight Calculation method information and Rating Method information would be returned in response. - * - * @return string - */ + * Presence/Absence Indicator. Any value inside is ignored. RatingMethodRequestedIndicator is an indicator. + * If present, Billable Weight Calculation method information and Rating Method information would be returned in response. + * + * @return string + */ public function getRatingMethodRequestedIndicator(): string { return $this->ratingMethodRequestedIndicator; @@ -1127,12 +1113,12 @@ public function setShipmentServiceOptions(ShipmentShipmentServiceOptions $shipme return $this; } /** - * Represents 5 character ISO Locale that allows the user to request Reference Number Code on Label, Label instructions and Receipt instructions (if applicable) in desired language. - Locale is specified by the combination of language code and country or territory code - 2 character language code and 2 character country or territory code seperated by an underscore ('_') character. If Locale element is requested along with LabelLinksIndicator, the URL to retrieve Label and Receipts (if applicable) will be returned in the requested Locale. Please note only LabelURL and ReceiptURL (if applicable) will be returned. LocalLanguageLabelURL and LocalLanguageReceiptURL will not be returned if Locale element is present in request. - Queen's English (en_GB) is the default - * - * @return string - */ + * Represents 5 character ISO Locale that allows the user to request Reference Number Code on Label, Label instructions and Receipt instructions (if applicable) in desired language. + * Locale is specified by the combination of language code and country or territory code - 2 character language code and 2 character country or territory code seperated by an underscore ('_') character. If Locale element is requested along with LabelLinksIndicator, the URL to retrieve Label and Receipts (if applicable) will be returned in the requested Locale. Please note only LabelURL and ReceiptURL (if applicable) will be returned. LocalLanguageLabelURL and LocalLanguageReceiptURL will not be returned if Locale element is present in request. + * Queen's English (en_GB) is the default + * + * @return string + */ public function getLocale(): string { return $this->locale; @@ -1153,11 +1139,11 @@ public function setLocale(string $locale): self return $this; } /** - * Shipment Value Threshold Code. 01 = Shipment value is below or equals to threshold value - 02 = Shipment value is above threshold value. NA = Not Applicable - * - * @return string - */ + * Shipment Value Threshold Code. 01 = Shipment value is below or equals to threshold value + * 02 = Shipment value is above threshold value. NA = Not Applicable + * + * @return string + */ public function getShipmentValueThresholdCode(): string { return $this->shipmentValueThresholdCode; @@ -1199,11 +1185,11 @@ public function setMasterCartonID(string $masterCartonID): self return $this; } /** - * Master Carton Indicator. Presence of the indicator means Master Carton ID will be created and returned to client. - This is an empty tag, any value inside is ignored. MasterCartonIndicator is only valid with Econmoy Shipment (Service Code 17 or 72). Will be ignored if master carton id present. - * - * @return string - */ + * Master Carton Indicator. Presence of the indicator means Master Carton ID will be created and returned to client. + * This is an empty tag, any value inside is ignored. MasterCartonIndicator is only valid with Econmoy Shipment (Service Code 17 or 72). Will be ignored if master carton id present. + * + * @return string + */ public function getMasterCartonIndicator(): string { return $this->masterCartonIndicator; @@ -1245,8 +1231,6 @@ public function setShipmentDate(string $shipmentDate): self return $this; } /** - * - * * @return list */ public function getPackage(): array @@ -1254,8 +1238,6 @@ public function getPackage(): array return $this->package; } /** - * - * * @param list $package * * @return self diff --git a/src/Api/Model/ShipmentResponseResponse.php b/src/Api/Model/ShipmentResponseResponse.php index ec9d5d09..4fec4690 100644 --- a/src/Api/Model/ShipmentResponseResponse.php +++ b/src/Api/Model/ShipmentResponseResponse.php @@ -20,7 +20,9 @@ public function isInitialized($property): bool protected $responseStatus; /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list|null */ @@ -55,7 +57,9 @@ public function setResponseStatus(ResponseResponseStatus $responseStatus): self } /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list|null */ diff --git a/src/Api/Model/ShipmentResponseShipmentResults.php b/src/Api/Model/ShipmentResponseShipmentResults.php index ce3c5ad9..a530ac8e 100644 --- a/src/Api/Model/ShipmentResponseShipmentResults.php +++ b/src/Api/Model/ShipmentResponseShipmentResults.php @@ -14,7 +14,9 @@ public function isInitialized($property): bool } /** * Disclaimer would be used to provide more information to shipper regarding the processed shipment. This would be used to notify shipper about possible taxes and duties that might have been added or might apply to the shipment. This field would be returned only if TaxInformationIndicator is present in a request. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -38,20 +40,20 @@ public function isInitialized($property): bool */ protected $fRSShipmentData; /** - * RatingMethod is to indicate whether the Shipment was rated as shipment level or package level. This information will be returned only if RatingMethodRequestedIndicator is present in the request. Valid values: - 01 = Shipment level - 02 = Package level - * - * @var string|null - */ + * RatingMethod is to indicate whether the Shipment was rated as shipment level or package level. This information will be returned only if RatingMethodRequestedIndicator is present in the request. Valid values: + * 01 = Shipment level + * 02 = Package level + * + * @var string|null + */ protected $ratingMethod; /** - * BillableWeightCalculationMethod is to indicate whether the billable weight calculation method utilized was - the package level or shipment level. This information will be returned only if RatingMethodRequestedIndicator is present in the request. Valid values: - 01 = Shipment Billable Weight - 02 = Package Billable Weight - * - * @var string|null - */ + * BillableWeightCalculationMethod is to indicate whether the billable weight calculation method utilized was - the package level or shipment level. This information will be returned only if RatingMethodRequestedIndicator is present in the request. Valid values: + * 01 = Shipment Billable Weight + * 02 = Package Billable Weight + * + * @var string|null + */ protected $billableWeightCalculationMethod; /** * Billing Weight container. @@ -66,16 +68,16 @@ public function isInitialized($property): bool */ protected $shipmentIdentificationNumber; /** - * MIDualReturnShipmentKey is unique key required to process Mail Innovations Dual Return Shipment. - - The unique identifier (key) would be returned in response of first phase of Mail Innovations Dual Return Shipments. - - This unique identifier (key) would be part of request for second phase of Mail Innovations Dual Return Shipments and would be played back in response for second phase of Mail Innovations Dual Return Shipment. If the shipment is a Package return shipment, the package tracking number will be concatenated with the system time (in the format YYYY-MM-DDHH.MM.SS.NNN) and followed by service code. - - If the shipment is an MI Returns shipment, the Mail Manifest ID (MMI) will be concatenated with the system time. - * - * @var string|null - */ + * MIDualReturnShipmentKey is unique key required to process Mail Innovations Dual Return Shipment. + * + * The unique identifier (key) would be returned in response of first phase of Mail Innovations Dual Return Shipments. + * + * This unique identifier (key) would be part of request for second phase of Mail Innovations Dual Return Shipments and would be played back in response for second phase of Mail Innovations Dual Return Shipment. If the shipment is a Package return shipment, the package tracking number will be concatenated with the system time (in the format YYYY-MM-DDHH.MM.SS.NNN) and followed by service code. + * + * If the shipment is an MI Returns shipment, the Mail Manifest ID (MMI) will be concatenated with the system time. + * + * @var string|null + */ protected $mIDualReturnShipmentKey; /** * Bar Code Image will be returned as Base 64 encoded graphic image. Bar Code Image will be returned if BarCodeImageIndicator or BarCodeAndLabelIndicator is present. @@ -85,26 +87,30 @@ public function isInitialized($property): bool protected $barCodeImage; /** * Returned Package Information. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list|null */ protected $packageResults; /** * Container for the High Value reports when forward shipments have declared value between $999 and $50,000 USD. \nTwo copies of high value report needs to be pointed out. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list|null */ protected $controlLogReceipt; /** - * Container tag for the International forms image. Form is returned for following shipments - - Forward shipments, - Shipments with PRL ReturnService, - Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. - * - * @var ShipmentResultsForm|null - */ + * Container tag for the International forms image. Form is returned for following shipments - + * Forward shipments, + * Shipments with PRL ReturnService, + * Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. + * + * @var ShipmentResultsForm|null + */ protected $form; /** * The container of the COD Turn In Page. @@ -119,42 +125,44 @@ public function isInitialized($property): bool */ protected $highValueReport; /** - * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. LabelURL is returned only if the LabelLinksIndicator is requested for following shipments: - Print/Electronic ImportControl shipment - Print/Electronic Return shipment. - Forward shipment except for Mail Innovations Forward. - * - * @var string|null - */ + * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. LabelURL is returned only if the LabelLinksIndicator is requested for following shipments: + * Print/Electronic ImportControl shipment + * Print/Electronic Return shipment. + * Forward shipment except for Mail Innovations Forward. + * + * @var string|null + */ protected $labelURL; /** - * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. LocalLanguageLabelURL is returned only if the LabelLinksIndicator is requested for following shipments: - Print/Electronic ImportControl shipment - Print/Electronic Return shipment. - Forward shipment except for Mail Innovations Forward. Not returned if LabelLinksIndicator is requested with Locale element. - * - * @var string|null - */ + * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. LocalLanguageLabelURL is returned only if the LabelLinksIndicator is requested for following shipments: + * Print/Electronic ImportControl shipment + * Print/Electronic Return shipment. + * Forward shipment except for Mail Innovations Forward. Not returned if LabelLinksIndicator is requested with Locale element. + * + * @var string|null + */ protected $localLanguageLabelURL; /** - * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. ReceiptURL is returned only if the LabelLinksIndicator is requested for following shipments: - Print/Electronic ImportControl shipment - Print/Electronic Return shipment. - * - * @var string|null - */ + * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. ReceiptURL is returned only if the LabelLinksIndicator is requested for following shipments: + * Print/Electronic ImportControl shipment + * Print/Electronic Return shipment. + * + * @var string|null + */ protected $receiptURL; /** - * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. LocalLanguageReceiptURL is returned only if the LabelLinksIndicator is requested for following shipments: - Print/Electronic ImportControl shipment - Print/Electronic Return shipment. Not returned if LabelLinksIndicator is requested with Locale element. - * - * @var string|null - */ + * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. LocalLanguageReceiptURL is returned only if the LabelLinksIndicator is requested for following shipments: + * Print/Electronic ImportControl shipment + * Print/Electronic Return shipment. Not returned if LabelLinksIndicator is requested with Locale element. + * + * @var string|null + */ protected $localLanguageReceiptURL; /** * Dangerous Good Paper Image in pdf format. One multipage PDF document will be returned that will contain all required Dangrous Goods shipping paper copies for all Dangerous Goods packages. Only returned when DGSignatoryInfo is present. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list|null */ @@ -173,7 +181,9 @@ public function isInitialized($property): bool protected $roarRatedIndicator; /** * Disclaimer would be used to provide more information to shipper regarding the processed shipment. This would be used to notify shipper about possible taxes and duties that might have been added or might apply to the shipment. This field would be returned only if TaxInformationIndicator is present in a request. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -262,12 +272,12 @@ public function setFRSShipmentData(?ShipmentResultsFRSShipmentData $fRSShipmentD return $this; } /** - * RatingMethod is to indicate whether the Shipment was rated as shipment level or package level. This information will be returned only if RatingMethodRequestedIndicator is present in the request. Valid values: - 01 = Shipment level - 02 = Package level - * - * @return string|null - */ + * RatingMethod is to indicate whether the Shipment was rated as shipment level or package level. This information will be returned only if RatingMethodRequestedIndicator is present in the request. Valid values: + * 01 = Shipment level + * 02 = Package level + * + * @return string|null + */ public function getRatingMethod(): ?string { return $this->ratingMethod; @@ -288,12 +298,12 @@ public function setRatingMethod(?string $ratingMethod): self return $this; } /** - * BillableWeightCalculationMethod is to indicate whether the billable weight calculation method utilized was - the package level or shipment level. This information will be returned only if RatingMethodRequestedIndicator is present in the request. Valid values: - 01 = Shipment Billable Weight - 02 = Package Billable Weight - * - * @return string|null - */ + * BillableWeightCalculationMethod is to indicate whether the billable weight calculation method utilized was - the package level or shipment level. This information will be returned only if RatingMethodRequestedIndicator is present in the request. Valid values: + * 01 = Shipment Billable Weight + * 02 = Package Billable Weight + * + * @return string|null + */ public function getBillableWeightCalculationMethod(): ?string { return $this->billableWeightCalculationMethod; @@ -358,16 +368,16 @@ public function setShipmentIdentificationNumber(?string $shipmentIdentificationN return $this; } /** - * MIDualReturnShipmentKey is unique key required to process Mail Innovations Dual Return Shipment. - - The unique identifier (key) would be returned in response of first phase of Mail Innovations Dual Return Shipments. - - This unique identifier (key) would be part of request for second phase of Mail Innovations Dual Return Shipments and would be played back in response for second phase of Mail Innovations Dual Return Shipment. If the shipment is a Package return shipment, the package tracking number will be concatenated with the system time (in the format YYYY-MM-DDHH.MM.SS.NNN) and followed by service code. - - If the shipment is an MI Returns shipment, the Mail Manifest ID (MMI) will be concatenated with the system time. - * - * @return string|null - */ + * MIDualReturnShipmentKey is unique key required to process Mail Innovations Dual Return Shipment. + * + * The unique identifier (key) would be returned in response of first phase of Mail Innovations Dual Return Shipments. + * + * This unique identifier (key) would be part of request for second phase of Mail Innovations Dual Return Shipments and would be played back in response for second phase of Mail Innovations Dual Return Shipment. If the shipment is a Package return shipment, the package tracking number will be concatenated with the system time (in the format YYYY-MM-DDHH.MM.SS.NNN) and followed by service code. + * + * If the shipment is an MI Returns shipment, the Mail Manifest ID (MMI) will be concatenated with the system time. + * + * @return string|null + */ public function getMIDualReturnShipmentKey(): ?string { return $this->mIDualReturnShipmentKey; @@ -415,7 +425,9 @@ public function setBarCodeImage(?string $barCodeImage): self } /** * Returned Package Information. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list|null */ @@ -439,7 +451,9 @@ public function setPackageResults(?array $packageResults): self } /** * Container for the High Value reports when forward shipments have declared value between $999 and $50,000 USD. \nTwo copies of high value report needs to be pointed out. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list|null */ @@ -462,13 +476,13 @@ public function setControlLogReceipt(?array $controlLogReceipt): self return $this; } /** - * Container tag for the International forms image. Form is returned for following shipments - - Forward shipments, - Shipments with PRL ReturnService, - Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. - * - * @return ShipmentResultsForm|null - */ + * Container tag for the International forms image. Form is returned for following shipments - + * Forward shipments, + * Shipments with PRL ReturnService, + * Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. + * + * @return ShipmentResultsForm|null + */ public function getForm(): ?ShipmentResultsForm { return $this->form; @@ -534,13 +548,13 @@ public function setHighValueReport(?ShipmentResultsHighValueReport $highValueRep return $this; } /** - * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. LabelURL is returned only if the LabelLinksIndicator is requested for following shipments: - Print/Electronic ImportControl shipment - Print/Electronic Return shipment. - Forward shipment except for Mail Innovations Forward. - * - * @return string|null - */ + * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. LabelURL is returned only if the LabelLinksIndicator is requested for following shipments: + * Print/Electronic ImportControl shipment + * Print/Electronic Return shipment. + * Forward shipment except for Mail Innovations Forward. + * + * @return string|null + */ public function getLabelURL(): ?string { return $this->labelURL; @@ -562,13 +576,13 @@ public function setLabelURL(?string $labelURL): self return $this; } /** - * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. LocalLanguageLabelURL is returned only if the LabelLinksIndicator is requested for following shipments: - Print/Electronic ImportControl shipment - Print/Electronic Return shipment. - Forward shipment except for Mail Innovations Forward. Not returned if LabelLinksIndicator is requested with Locale element. - * - * @return string|null - */ + * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. LocalLanguageLabelURL is returned only if the LabelLinksIndicator is requested for following shipments: + * Print/Electronic ImportControl shipment + * Print/Electronic Return shipment. + * Forward shipment except for Mail Innovations Forward. Not returned if LabelLinksIndicator is requested with Locale element. + * + * @return string|null + */ public function getLocalLanguageLabelURL(): ?string { return $this->localLanguageLabelURL; @@ -590,12 +604,12 @@ public function setLocalLanguageLabelURL(?string $localLanguageLabelURL): self return $this; } /** - * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. ReceiptURL is returned only if the LabelLinksIndicator is requested for following shipments: - Print/Electronic ImportControl shipment - Print/Electronic Return shipment. - * - * @return string|null - */ + * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. ReceiptURL is returned only if the LabelLinksIndicator is requested for following shipments: + * Print/Electronic ImportControl shipment + * Print/Electronic Return shipment. + * + * @return string|null + */ public function getReceiptURL(): ?string { return $this->receiptURL; @@ -616,12 +630,12 @@ public function setReceiptURL(?string $receiptURL): self return $this; } /** - * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. LocalLanguageReceiptURL is returned only if the LabelLinksIndicator is requested for following shipments: - Print/Electronic ImportControl shipment - Print/Electronic Return shipment. Not returned if LabelLinksIndicator is requested with Locale element. - * - * @return string|null - */ + * URL will point to a page wherein label, receipt and other documents, if applicable, such as HighValueReport, CustomsInvoice and ImportControl instructions can be requested. LocalLanguageReceiptURL is returned only if the LabelLinksIndicator is requested for following shipments: + * Print/Electronic ImportControl shipment + * Print/Electronic Return shipment. Not returned if LabelLinksIndicator is requested with Locale element. + * + * @return string|null + */ public function getLocalLanguageReceiptURL(): ?string { return $this->localLanguageReceiptURL; @@ -643,7 +657,9 @@ public function setLocalLanguageReceiptURL(?string $localLanguageReceiptURL): se } /** * Dangerous Good Paper Image in pdf format. One multipage PDF document will be returned that will contain all required Dangrous Goods shipping paper copies for all Dangerous Goods packages. Only returned when DGSignatoryInfo is present. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list|null */ diff --git a/src/Api/Model/ShipmentResultsDisclaimer.php b/src/Api/Model/ShipmentResultsDisclaimer.php index 39d37aab..dab7b26a 100644 --- a/src/Api/Model/ShipmentResultsDisclaimer.php +++ b/src/Api/Model/ShipmentResultsDisclaimer.php @@ -19,12 +19,12 @@ public function isInitialized($property): bool */ protected $code; /** - * Disclaimer description. This field would be returned only if TaxInformationIndicator is present in a request. - - Refer to Disclaimer Codes and Messages in the Appendix for various disclaimers that would be possible for a given shipment. - * - * @var string - */ + * Disclaimer description. This field would be returned only if TaxInformationIndicator is present in a request. + * + * Refer to Disclaimer Codes and Messages in the Appendix for various disclaimers that would be possible for a given shipment. + * + * @var string + */ protected $description; /** * Code representing type of Disclaimer. Refer to Disclaimer Codes and Messages in the Appendix for various disclaimers that would be possible for a given shipment. @@ -49,12 +49,12 @@ public function setCode(string $code): self return $this; } /** - * Disclaimer description. This field would be returned only if TaxInformationIndicator is present in a request. - - Refer to Disclaimer Codes and Messages in the Appendix for various disclaimers that would be possible for a given shipment. - * - * @return string - */ + * Disclaimer description. This field would be returned only if TaxInformationIndicator is present in a request. + * + * Refer to Disclaimer Codes and Messages in the Appendix for various disclaimers that would be possible for a given shipment. + * + * @return string + */ public function getDescription(): string { return $this->description; diff --git a/src/Api/Model/ShipmentResultsDocuments.php b/src/Api/Model/ShipmentResultsDocuments.php index 054ae37d..99df29bf 100644 --- a/src/Api/Model/ShipmentResultsDocuments.php +++ b/src/Api/Model/ShipmentResultsDocuments.php @@ -13,20 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $image; /** - * - * * @var list */ protected $forms; /** - * - * * @return list */ public function getImage(): array @@ -34,8 +28,6 @@ public function getImage(): array return $this->image; } /** - * - * * @param list $image * * @return self @@ -47,8 +39,6 @@ public function setImage(array $image): self return $this; } /** - * - * * @return list */ public function getForms(): array @@ -56,8 +46,6 @@ public function getForms(): array return $this->forms; } /** - * - * * @param list $forms * * @return self diff --git a/src/Api/Model/ShipmentResultsFRSShipmentData.php b/src/Api/Model/ShipmentResultsFRSShipmentData.php index 9dd9ade3..9d00dc2d 100644 --- a/src/Api/Model/ShipmentResultsFRSShipmentData.php +++ b/src/Api/Model/ShipmentResultsFRSShipmentData.php @@ -26,7 +26,9 @@ public function isInitialized($property): bool protected $freightDensityRate; /** * Handling Unit for Density based rating container. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -77,7 +79,9 @@ public function setFreightDensityRate(FRSShipmentDataFreightDensityRate $freight } /** * Handling Unit for Density based rating container. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/ShipmentResultsForm.php b/src/Api/Model/ShipmentResultsForm.php index d5f8fea3..d2641c54 100644 --- a/src/Api/Model/ShipmentResultsForm.php +++ b/src/Api/Model/ShipmentResultsForm.php @@ -13,12 +13,12 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code that indicates the type of form. - - Valid values: 01 - All Requested International Forms. - * - * @var string - */ + * Code that indicates the type of form. + * + * Valid values: 01 - All Requested International Forms. + * + * @var string + */ protected $code; /** * Description that indicates the type of form. Possible Values. All Requested International Forms. @@ -45,12 +45,12 @@ public function isInitialized($property): bool */ protected $formGroupIdName; /** - * Code that indicates the type of form. - - Valid values: 01 - All Requested International Forms. - * - * @return string - */ + * Code that indicates the type of form. + * + * Valid values: 01 - All Requested International Forms. + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ShipmentResultsImageImageFormat.php b/src/Api/Model/ShipmentResultsImageImageFormat.php index 70248c5f..941a1a95 100644 --- a/src/Api/Model/ShipmentResultsImageImageFormat.php +++ b/src/Api/Model/ShipmentResultsImageImageFormat.php @@ -13,12 +13,12 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code representing the format in which the forms are generated. Valid values: - - PDF = pdf - - * - * @var string - */ + * Code representing the format in which the forms are generated. Valid values: + * - PDF = pdf + * + * + * @var string + */ protected $code; /** * Description of the form image format code. @@ -27,12 +27,12 @@ public function isInitialized($property): bool */ protected $description; /** - * Code representing the format in which the forms are generated. Valid values: - - PDF = pdf - - * - * @return string - */ + * Code representing the format in which the forms are generated. Valid values: + * - PDF = pdf + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ShipmentResultsNegotiatedRateCharges.php b/src/Api/Model/ShipmentResultsNegotiatedRateCharges.php index a4c2544c..5bb7b4e9 100644 --- a/src/Api/Model/ShipmentResultsNegotiatedRateCharges.php +++ b/src/Api/Model/ShipmentResultsNegotiatedRateCharges.php @@ -13,19 +13,21 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Itemized Charges are returned only when the Subversion element is present and greater than or equal to 1601. - - Negotiated itemized charges are only returned for certain contract-only shipments as well as Worldwide Express Freight, Ground Freight Pricing, and Hazmat movements. - - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @var list - */ + * Itemized Charges are returned only when the Subversion element is present and greater than or equal to 1601. + * + * Negotiated itemized charges are only returned for certain contract-only shipments as well as Worldwide Express Freight, Ground Freight Pricing, and Hazmat movements. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * + * @var list + */ protected $itemizedCharges; /** * TaxCharges container are returned only when TaxInformationIndicator is present in request. TaxCharges container contains Tax information for a given shipment. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -43,15 +45,15 @@ public function isInitialized($property): bool */ protected $totalChargesWithTaxes; /** - * Itemized Charges are returned only when the Subversion element is present and greater than or equal to 1601. - - Negotiated itemized charges are only returned for certain contract-only shipments as well as Worldwide Express Freight, Ground Freight Pricing, and Hazmat movements. - - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. - - * - * @return list - */ + * Itemized Charges are returned only when the Subversion element is present and greater than or equal to 1601. + * + * Negotiated itemized charges are only returned for certain contract-only shipments as well as Worldwide Express Freight, Ground Freight Pricing, and Hazmat movements. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * + * @return list + */ public function getItemizedCharges(): array { return $this->itemizedCharges; @@ -76,7 +78,9 @@ public function setItemizedCharges(array $itemizedCharges): self } /** * TaxCharges container are returned only when TaxInformationIndicator is present in request. TaxCharges container contains Tax information for a given shipment. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/ShipmentResultsPackageResults.php b/src/Api/Model/ShipmentResultsPackageResults.php index 72567233..f0464332 100644 --- a/src/Api/Model/ShipmentResultsPackageResults.php +++ b/src/Api/Model/ShipmentResultsPackageResults.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Package 1Z number. - For Mail Innovations shipments, please use the USPSPICNumber when tracking packages (a non-1Z number Mail Manifest Id is returned). - * - * @var string - */ + * Package 1Z number. + * For Mail Innovations shipments, please use the USPSPICNumber when tracking packages (a non-1Z number Mail Manifest Id is returned). + * + * @var string + */ protected $trackingNumber; /** * Container for returned Rate Modifier information. Applies only if SubVersion is 2205 or greater. @@ -26,11 +26,11 @@ public function isInitialized($property): bool */ protected $rateModifier; /** - * Base Service Charge container. - Transportation charge = BaseServiceCharge + Fuel charge Returned only if Subversion >=1701. - * - * @var PackageResultsBaseServiceCharge - */ + * Base Service Charge container. + * Transportation charge = BaseServiceCharge + Fuel charge Returned only if Subversion >=1701. + * + * @var PackageResultsBaseServiceCharge + */ protected $baseServiceCharge; /** * Shipment charges info. Shipment charges are only guaranteed to be returned for shipments whose origin country or territory is US or Puerto Rico. @@ -39,21 +39,21 @@ public function isInitialized($property): bool */ protected $serviceOptionsCharges; /** - * The container for UPS shipping label. Returned for following shipments - - Forward shipments, - Shipments with PRL returns service, - Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. Shipping label wont be returned if BarCodeImageIndicator is present. - * - * @var PackageResultsShippingLabel|null - */ + * The container for UPS shipping label. Returned for following shipments - + * Forward shipments, + * Shipments with PRL returns service, + * Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. Shipping label wont be returned if BarCodeImageIndicator is present. + * + * @var PackageResultsShippingLabel|null + */ protected $shippingLabel; /** - * Supported for following shipments - - PRL shipments, - Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. - * - * @var PackageResultsShippingReceipt - */ + * Supported for following shipments - + * PRL shipments, + * Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. + * + * @var PackageResultsShippingReceipt + */ protected $shippingReceipt; /** * USPSPICNumber is USPS Package Identification; it should be used for tracking Mail Innovations shipments. @@ -62,16 +62,18 @@ public function isInitialized($property): bool */ protected $uSPSPICNumber; /** - * USPS defined CN22 ID number format varies based on destination country or territory. - Not applicable as of Jan 2015. - Mail Innovations shipments US to VI, PR, and GU are not considered international. - * - * @var string - */ + * USPS defined CN22 ID number format varies based on destination country or territory. + * Not applicable as of Jan 2015. + * Mail Innovations shipments US to VI, PR, and GU are not considered international. + * + * @var string + */ protected $cN22Number; /** * The container for Accessorial indicators. This information would be returned only for UPS Worldwide Express Freight and UPS Worldwide Express Freight Mid-day service request with Dry Ice or Oversize Pallet and SubVersion greater than or equal to 1707. This is valid only for UPS Worldwide Express Freight and UPS Worldwide Express Freight Mid-day service. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -83,35 +85,37 @@ public function isInitialized($property): bool */ protected $simpleRate; /** - * Container tag for the International forms image. Currently this container would be returned for UPS Premium Care shipments. Form is returned for following shipments - - Forward shipments, - Shipments with PRL ReturnService, - Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. CN22 data for Worlwide economy services will be returned within the PDF417 barcode of the label. - * - * @var PackageResultsForm|null - */ + * Container tag for the International forms image. Currently this container would be returned for UPS Premium Care shipments. Form is returned for following shipments - + * Forward shipments, + * Shipments with PRL ReturnService, + * Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. CN22 data for Worlwide economy services will be returned within the PDF417 barcode of the label. + * + * @var PackageResultsForm|null + */ protected $form; /** * Itemized Charges are returned only when the subversion element is present and greater than or equal to 1607. Package level itemized charges are only returned for US domestic movements. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $itemizedCharges; /** - * Negotiated Rates Charge Container. These charges are returned when: - 1) Subversion is greater than or equal to 1607 - 2) If negotiated rates were requested for GFP shipments and account number is eligible to receive negotiated rates. - * - * @var PackageResultsNegotiatedCharges - */ + * Negotiated Rates Charge Container. These charges are returned when: + * 1) Subversion is greater than or equal to 1607 + * 2) If negotiated rates were requested for GFP shipments and account number is eligible to receive negotiated rates. + * + * @var PackageResultsNegotiatedCharges + */ protected $negotiatedCharges; /** - * Package 1Z number. - For Mail Innovations shipments, please use the USPSPICNumber when tracking packages (a non-1Z number Mail Manifest Id is returned). - * - * @return string - */ + * Package 1Z number. + * For Mail Innovations shipments, please use the USPSPICNumber when tracking packages (a non-1Z number Mail Manifest Id is returned). + * + * @return string + */ public function getTrackingNumber(): string { return $this->trackingNumber; @@ -153,11 +157,11 @@ public function setRateModifier(PackageResultsRateModifier $rateModifier): self return $this; } /** - * Base Service Charge container. - Transportation charge = BaseServiceCharge + Fuel charge Returned only if Subversion >=1701. - * - * @return PackageResultsBaseServiceCharge - */ + * Base Service Charge container. + * Transportation charge = BaseServiceCharge + Fuel charge Returned only if Subversion >=1701. + * + * @return PackageResultsBaseServiceCharge + */ public function getBaseServiceCharge(): PackageResultsBaseServiceCharge { return $this->baseServiceCharge; @@ -199,13 +203,13 @@ public function setServiceOptionsCharges(PackageResultsServiceOptionsCharges $se return $this; } /** - * The container for UPS shipping label. Returned for following shipments - - Forward shipments, - Shipments with PRL returns service, - Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. Shipping label wont be returned if BarCodeImageIndicator is present. - * - * @return PackageResultsShippingLabel|null - */ + * The container for UPS shipping label. Returned for following shipments - + * Forward shipments, + * Shipments with PRL returns service, + * Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. Shipping label wont be returned if BarCodeImageIndicator is present. + * + * @return PackageResultsShippingLabel|null + */ public function getShippingLabel(): ?PackageResultsShippingLabel { return $this->shippingLabel; @@ -227,12 +231,12 @@ public function setShippingLabel(?PackageResultsShippingLabel $shippingLabel): s return $this; } /** - * Supported for following shipments - - PRL shipments, - Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. - * - * @return PackageResultsShippingReceipt - */ + * Supported for following shipments - + * PRL shipments, + * Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. + * + * @return PackageResultsShippingReceipt + */ public function getShippingReceipt(): PackageResultsShippingReceipt { return $this->shippingReceipt; @@ -275,12 +279,12 @@ public function setUSPSPICNumber(string $uSPSPICNumber): self return $this; } /** - * USPS defined CN22 ID number format varies based on destination country or territory. - Not applicable as of Jan 2015. - Mail Innovations shipments US to VI, PR, and GU are not considered international. - * - * @return string - */ + * USPS defined CN22 ID number format varies based on destination country or territory. + * Not applicable as of Jan 2015. + * Mail Innovations shipments US to VI, PR, and GU are not considered international. + * + * @return string + */ public function getCN22Number(): string { return $this->cN22Number; @@ -302,7 +306,9 @@ public function setCN22Number(string $cN22Number): self } /** * The container for Accessorial indicators. This information would be returned only for UPS Worldwide Express Freight and UPS Worldwide Express Freight Mid-day service request with Dry Ice or Oversize Pallet and SubVersion greater than or equal to 1707. This is valid only for UPS Worldwide Express Freight and UPS Worldwide Express Freight Mid-day service. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -347,13 +353,13 @@ public function setSimpleRate(PackageResultsSimpleRate $simpleRate): self return $this; } /** - * Container tag for the International forms image. Currently this container would be returned for UPS Premium Care shipments. Form is returned for following shipments - - Forward shipments, - Shipments with PRL ReturnService, - Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. CN22 data for Worlwide economy services will be returned within the PDF417 barcode of the label. - * - * @return PackageResultsForm|null - */ + * Container tag for the International forms image. Currently this container would be returned for UPS Premium Care shipments. Form is returned for following shipments - + * Forward shipments, + * Shipments with PRL ReturnService, + * Electronic Return Label or Electronic Import Control Label shipments with SubVersion greater than or equal to 1707. CN22 data for Worlwide economy services will be returned within the PDF417 barcode of the label. + * + * @return PackageResultsForm|null + */ public function getForm(): ?PackageResultsForm { return $this->form; @@ -376,7 +382,9 @@ public function setForm(?PackageResultsForm $form): self } /** * Itemized Charges are returned only when the subversion element is present and greater than or equal to 1607. Package level itemized charges are only returned for US domestic movements. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -399,12 +407,12 @@ public function setItemizedCharges(array $itemizedCharges): self return $this; } /** - * Negotiated Rates Charge Container. These charges are returned when: - 1) Subversion is greater than or equal to 1607 - 2) If negotiated rates were requested for GFP shipments and account number is eligible to receive negotiated rates. - * - * @return PackageResultsNegotiatedCharges - */ + * Negotiated Rates Charge Container. These charges are returned when: + * 1) Subversion is greater than or equal to 1607 + * 2) If negotiated rates were requested for GFP shipments and account number is eligible to receive negotiated rates. + * + * @return PackageResultsNegotiatedCharges + */ public function getNegotiatedCharges(): PackageResultsNegotiatedCharges { return $this->negotiatedCharges; diff --git a/src/Api/Model/ShipmentResultsShipmentCharges.php b/src/Api/Model/ShipmentResultsShipmentCharges.php index 1b82f6aa..c9dbb7ff 100644 --- a/src/Api/Model/ShipmentResultsShipmentCharges.php +++ b/src/Api/Model/ShipmentResultsShipmentCharges.php @@ -13,34 +13,34 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Rate Type with which Shipment is rated. Possible RateChart values for different regions will be: - US 48 origin: - - 1 – Daily Rates - - 3 – Standard List Rates - - 4 – Retail Rates. - - Alaska/Hawaii origin: - - 1 – Daily Rates - - 3 – Standard List Rates - - 4 – Retail Rates. - - All Other origins: - - 1 – Rates - - 5 - Regional Rates - - 6 - General List Rates. - - 3 and 4 do not apply. - - * - * @var string - */ + * Rate Type with which Shipment is rated. Possible RateChart values for different regions will be: + * US 48 origin: + * - 1 – Daily Rates + * - 3 – Standard List Rates + * - 4 – Retail Rates. + * + * Alaska/Hawaii origin: + * - 1 – Daily Rates + * - 3 – Standard List Rates + * - 4 – Retail Rates. + * + * All Other origins: + * - 1 – Rates + * - 5 - Regional Rates + * - 6 - General List Rates. + * + * 3 and 4 do not apply. + * + * + * @var string + */ protected $rateChart; /** - * Base Service Charge container. - Transportation charge = BaseServiceCharge + Fuel charge Returned only if Subversion >=1701. - * - * @var ShipmentChargesBaseServiceCharge - */ + * Base Service Charge container. + * Transportation charge = BaseServiceCharge + Fuel charge Returned only if Subversion >=1701. + * + * @var ShipmentChargesBaseServiceCharge + */ protected $baseServiceCharge; /** * Transportation Charges container. @@ -50,7 +50,9 @@ public function isInitialized($property): bool protected $transportationCharges; /** * Itemized Charges are returned only when the Subversion element is present and greater than or equal to 1601. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -63,7 +65,9 @@ public function isInitialized($property): bool protected $serviceOptionsCharges; /** * TaxCharges container are returned only when TaxInformationIndicator is present in request and when Negotiated Rates are not applicable. TaxCharges container contains Tax information for a given shipment. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -81,27 +85,27 @@ public function isInitialized($property): bool */ protected $totalChargesWithTaxes; /** - * Rate Type with which Shipment is rated. Possible RateChart values for different regions will be: - US 48 origin: - - 1 – Daily Rates - - 3 – Standard List Rates - - 4 – Retail Rates. - - Alaska/Hawaii origin: - - 1 – Daily Rates - - 3 – Standard List Rates - - 4 – Retail Rates. - - All Other origins: - - 1 – Rates - - 5 - Regional Rates - - 6 - General List Rates. - - 3 and 4 do not apply. - - * - * @return string - */ + * Rate Type with which Shipment is rated. Possible RateChart values for different regions will be: + * US 48 origin: + * - 1 – Daily Rates + * - 3 – Standard List Rates + * - 4 – Retail Rates. + * + * Alaska/Hawaii origin: + * - 1 – Daily Rates + * - 3 – Standard List Rates + * - 4 – Retail Rates. + * + * All Other origins: + * - 1 – Rates + * - 5 - Regional Rates + * - 6 - General List Rates. + * + * 3 and 4 do not apply. + * + * + * @return string + */ public function getRateChart(): string { return $this->rateChart; @@ -137,11 +141,11 @@ public function setRateChart(string $rateChart): self return $this; } /** - * Base Service Charge container. - Transportation charge = BaseServiceCharge + Fuel charge Returned only if Subversion >=1701. - * - * @return ShipmentChargesBaseServiceCharge - */ + * Base Service Charge container. + * Transportation charge = BaseServiceCharge + Fuel charge Returned only if Subversion >=1701. + * + * @return ShipmentChargesBaseServiceCharge + */ public function getBaseServiceCharge(): ShipmentChargesBaseServiceCharge { return $this->baseServiceCharge; @@ -184,7 +188,9 @@ public function setTransportationCharges(ShipmentChargesTransportationCharges $t } /** * Itemized Charges are returned only when the Subversion element is present and greater than or equal to 1601. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -230,7 +236,9 @@ public function setServiceOptionsCharges(ShipmentChargesServiceOptionsCharges $s } /** * TaxCharges container are returned only when TaxInformationIndicator is present in request and when Negotiated Rates are not applicable. TaxCharges container contains Tax information for a given shipment. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/ShipmentReturnService.php b/src/Api/Model/ShipmentReturnService.php index 37d7e0cf..5c4d29c8 100644 --- a/src/Api/Model/ShipmentReturnService.php +++ b/src/Api/Model/ShipmentReturnService.php @@ -13,27 +13,27 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Return Service types: - - 2 = UPS Print and Mail (PNM) - - 3 = UPS Return Service 1-Attempt (RS1) - - 5 = UPS Return Service 3-Attempt (RS3) - - 8 = UPS Electronic Return Label (ERL) - - 9 = UPS Print Return Label (PRL) - - 10 = UPS Exchange Print Return Label - - 11 = UPS Pack & Collect Service 1-Attempt Box 1 - - 12 = UPS Pack & Collect Service 1-Attempt Box 2 - - 13 = UPS Pack & Collect Service 1-Attempt Box 3 - - 14 = UPS Pack & Collect Service 1-Attempt Box 4 - - 15 = UPS Pack & Collect Service 1-Attempt Box 5 - - 16 = UPS Pack & Collect Service 3-Attempt Box 1 - - 17 = UPS Pack & Collect Service 3-Attempt Box 2 - - 18 = UPS Pack & Collect Service 3-Attempt Box 3 - - 19 = UPS Pack & Collect Service 3-Attempt Box 4 - - 20 = UPS Pack & Collect Service 3-Attempt Box 5 - - * - * @var string - */ + * Return Service types: + * - 2 = UPS Print and Mail (PNM) + * - 3 = UPS Return Service 1-Attempt (RS1) + * - 5 = UPS Return Service 3-Attempt (RS3) + * - 8 = UPS Electronic Return Label (ERL) + * - 9 = UPS Print Return Label (PRL) + * - 10 = UPS Exchange Print Return Label + * - 11 = UPS Pack & Collect Service 1-Attempt Box 1 + * - 12 = UPS Pack & Collect Service 1-Attempt Box 2 + * - 13 = UPS Pack & Collect Service 1-Attempt Box 3 + * - 14 = UPS Pack & Collect Service 1-Attempt Box 4 + * - 15 = UPS Pack & Collect Service 1-Attempt Box 5 + * - 16 = UPS Pack & Collect Service 3-Attempt Box 1 + * - 17 = UPS Pack & Collect Service 3-Attempt Box 2 + * - 18 = UPS Pack & Collect Service 3-Attempt Box 3 + * - 19 = UPS Pack & Collect Service 3-Attempt Box 4 + * - 20 = UPS Pack & Collect Service 3-Attempt Box 5 + * + * + * @var string + */ protected $code; /** * Return Service description. @@ -42,27 +42,27 @@ public function isInitialized($property): bool */ protected $description; /** - * Return Service types: - - 2 = UPS Print and Mail (PNM) - - 3 = UPS Return Service 1-Attempt (RS1) - - 5 = UPS Return Service 3-Attempt (RS3) - - 8 = UPS Electronic Return Label (ERL) - - 9 = UPS Print Return Label (PRL) - - 10 = UPS Exchange Print Return Label - - 11 = UPS Pack & Collect Service 1-Attempt Box 1 - - 12 = UPS Pack & Collect Service 1-Attempt Box 2 - - 13 = UPS Pack & Collect Service 1-Attempt Box 3 - - 14 = UPS Pack & Collect Service 1-Attempt Box 4 - - 15 = UPS Pack & Collect Service 1-Attempt Box 5 - - 16 = UPS Pack & Collect Service 3-Attempt Box 1 - - 17 = UPS Pack & Collect Service 3-Attempt Box 2 - - 18 = UPS Pack & Collect Service 3-Attempt Box 3 - - 19 = UPS Pack & Collect Service 3-Attempt Box 4 - - 20 = UPS Pack & Collect Service 3-Attempt Box 5 - - * - * @return string - */ + * Return Service types: + * - 2 = UPS Print and Mail (PNM) + * - 3 = UPS Return Service 1-Attempt (RS1) + * - 5 = UPS Return Service 3-Attempt (RS3) + * - 8 = UPS Electronic Return Label (ERL) + * - 9 = UPS Print Return Label (PRL) + * - 10 = UPS Exchange Print Return Label + * - 11 = UPS Pack & Collect Service 1-Attempt Box 1 + * - 12 = UPS Pack & Collect Service 1-Attempt Box 2 + * - 13 = UPS Pack & Collect Service 1-Attempt Box 3 + * - 14 = UPS Pack & Collect Service 1-Attempt Box 4 + * - 15 = UPS Pack & Collect Service 1-Attempt Box 5 + * - 16 = UPS Pack & Collect Service 3-Attempt Box 1 + * - 17 = UPS Pack & Collect Service 3-Attempt Box 2 + * - 18 = UPS Pack & Collect Service 3-Attempt Box 3 + * - 19 = UPS Pack & Collect Service 3-Attempt Box 4 + * - 20 = UPS Pack & Collect Service 3-Attempt Box 5 + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ShipmentServiceOptionsCallTagARS.php b/src/Api/Model/ShipmentServiceOptionsCallTagARS.php index 767b25ed..1d0a3138 100644 --- a/src/Api/Model/ShipmentServiceOptionsCallTagARS.php +++ b/src/Api/Model/ShipmentServiceOptionsCallTagARS.php @@ -19,19 +19,19 @@ public function isInitialized($property): bool */ protected $number; /** - * The type of Call Tag service. - Valid values: - 00 - No return service - 01 - UPS Call Tag Service - 02 - UPS Print and Mail - 03 - 1 UPS Pickup Attempt - 04 - UPS Print Return Label - 05 - Online Call Tag (3 UPS Pickup Attempts) - 06 - UPS Electronic Return Label - 08 - UPS Returns on the Web - * - * @var string - */ + * The type of Call Tag service. + * Valid values: + * 00 - No return service + * 01 - UPS Call Tag Service + * 02 - UPS Print and Mail + * 03 - 1 UPS Pickup Attempt + * 04 - UPS Print Return Label + * 05 - Online Call Tag (3 UPS Pickup Attempts) + * 06 - UPS Electronic Return Label + * 08 - UPS Returns on the Web + * + * @var string + */ protected $code; /** * A reference number associated with the Call Tag service. Required if CallTagARS/Code is 1. @@ -56,19 +56,19 @@ public function setNumber(string $number): self return $this; } /** - * The type of Call Tag service. - Valid values: - 00 - No return service - 01 - UPS Call Tag Service - 02 - UPS Print and Mail - 03 - 1 UPS Pickup Attempt - 04 - UPS Print Return Label - 05 - Online Call Tag (3 UPS Pickup Attempts) - 06 - UPS Electronic Return Label - 08 - UPS Returns on the Web - * - * @return string - */ + * The type of Call Tag service. + * Valid values: + * 00 - No return service + * 01 - UPS Call Tag Service + * 02 - UPS Print and Mail + * 03 - 1 UPS Pickup Attempt + * 04 - UPS Print Return Label + * 05 - Online Call Tag (3 UPS Pickup Attempts) + * 06 - UPS Electronic Return Label + * 08 - UPS Returns on the Web + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ShipmentServiceOptionsDeclaredValue.php b/src/Api/Model/ShipmentServiceOptionsDeclaredValue.php index c342b062..d4b307c1 100644 --- a/src/Api/Model/ShipmentServiceOptionsDeclaredValue.php +++ b/src/Api/Model/ShipmentServiceOptionsDeclaredValue.php @@ -13,31 +13,31 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Declared value amount currency type. - Valid value: USD - United States Dollar - * - * @var string - */ + * Declared value amount currency type. + * Valid value: USD - United States Dollar + * + * @var string + */ protected $currencyCode; /** - * Declared value amount. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @var string - */ + * Declared value amount. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @var string + */ protected $monetaryValue; /** - * Declared value amount currency type. - Valid value: USD - United States Dollar - * - * @return string - */ + * Declared value amount currency type. + * Valid value: USD - United States Dollar + * + * @return string + */ public function getCurrencyCode(): string { return $this->currencyCode; @@ -57,17 +57,17 @@ public function setCurrencyCode(string $currencyCode): self return $this; } /** - * Declared value amount. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @return string - */ + * Declared value amount. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @return string + */ public function getMonetaryValue(): string { return $this->monetaryValue; diff --git a/src/Api/Model/ShipmentServiceOptionsDeliveryConfirmation.php b/src/Api/Model/ShipmentServiceOptionsDeliveryConfirmation.php index df85a1cf..0807d72c 100644 --- a/src/Api/Model/ShipmentServiceOptionsDeliveryConfirmation.php +++ b/src/Api/Model/ShipmentServiceOptionsDeliveryConfirmation.php @@ -13,12 +13,12 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Type of delivery confirmation. Valid values: - 1 - Delivery Confirmation Signature Required - 2 - Delivery Confirmation Adult Signature Required. Valid for forward shipments only. - * - * @var string - */ + * Type of delivery confirmation. Valid values: + * 1 - Delivery Confirmation Signature Required + * 2 - Delivery Confirmation Adult Signature Required. Valid for forward shipments only. + * + * @var string + */ protected $dCISType; /** * DCIS Number. @@ -27,12 +27,12 @@ public function isInitialized($property): bool */ protected $dCISNumber; /** - * Type of delivery confirmation. Valid values: - 1 - Delivery Confirmation Signature Required - 2 - Delivery Confirmation Adult Signature Required. Valid for forward shipments only. - * - * @return string - */ + * Type of delivery confirmation. Valid values: + * 1 - Delivery Confirmation Signature Required + * 2 - Delivery Confirmation Adult Signature Required. Valid for forward shipments only. + * + * @return string + */ public function getDCISType(): string { return $this->dCISType; diff --git a/src/Api/Model/ShipmentServiceOptionsEMailInformation.php b/src/Api/Model/ShipmentServiceOptionsEMailInformation.php index 920f9499..97aed721 100644 --- a/src/Api/Model/ShipmentServiceOptionsEMailInformation.php +++ b/src/Api/Model/ShipmentServiceOptionsEMailInformation.php @@ -13,8 +13,6 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $eMailType; @@ -25,8 +23,6 @@ public function isInitialized($property): bool */ protected $eMail; /** - * - * * @return list */ public function getEMailType(): array @@ -34,8 +30,6 @@ public function getEMailType(): array return $this->eMailType; } /** - * - * * @param list $eMailType * * @return self diff --git a/src/Api/Model/ShipmentServiceOptionsExcessDeclaredValue.php b/src/Api/Model/ShipmentServiceOptionsExcessDeclaredValue.php index 704b4713..7dbbbf4c 100644 --- a/src/Api/Model/ShipmentServiceOptionsExcessDeclaredValue.php +++ b/src/Api/Model/ShipmentServiceOptionsExcessDeclaredValue.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Excess Declared value amount currency type. - Valid value: USD - United States Dollar - * - * @var string - */ + * Excess Declared value amount currency type. + * Valid value: USD - United States Dollar + * + * @var string + */ protected $currencyCode; /** * Excess Declared value amount. @@ -26,11 +26,11 @@ public function isInitialized($property): bool */ protected $monetaryValue; /** - * Excess Declared value amount currency type. - Valid value: USD - United States Dollar - * - * @return string - */ + * Excess Declared value amount currency type. + * Valid value: USD - United States Dollar + * + * @return string + */ public function getCurrencyCode(): string { return $this->currencyCode; diff --git a/src/Api/Model/ShipmentServiceOptionsHandlingCharge.php b/src/Api/Model/ShipmentServiceOptionsHandlingCharge.php index 5ec4d7fd..58353f7f 100644 --- a/src/Api/Model/ShipmentServiceOptionsHandlingCharge.php +++ b/src/Api/Model/ShipmentServiceOptionsHandlingCharge.php @@ -13,33 +13,33 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Percentage amount consistent with the handling charge. - Either Percentage or Amount needs to be present, not both. - Negative value allowed. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 7 characters. The decimal ".", does not count as a character. - * - * @var string - */ + * Percentage amount consistent with the handling charge. + * Either Percentage or Amount needs to be present, not both. + * Negative value allowed. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 7 characters. The decimal ".", does not count as a character. + * + * @var string + */ protected $percentage; /** - * HandlingCharge Amount Container. - Either Percentage or Amount needs to be present, not both. - * - * @var HandlingChargeAmount - */ + * HandlingCharge Amount Container. + * Either Percentage or Amount needs to be present, not both. + * + * @var HandlingChargeAmount + */ protected $amount; /** - * Percentage amount consistent with the handling charge. - Either Percentage or Amount needs to be present, not both. - Negative value allowed. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 7 characters. The decimal ".", does not count as a character. - * - * @return string - */ + * Percentage amount consistent with the handling charge. + * Either Percentage or Amount needs to be present, not both. + * Negative value allowed. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 7 characters. The decimal ".", does not count as a character. + * + * @return string + */ public function getPercentage(): string { return $this->percentage; @@ -63,11 +63,11 @@ public function setPercentage(string $percentage): self return $this; } /** - * HandlingCharge Amount Container. - Either Percentage or Amount needs to be present, not both. - * - * @return HandlingChargeAmount - */ + * HandlingCharge Amount Container. + * Either Percentage or Amount needs to be present, not both. + * + * @return HandlingChargeAmount + */ public function getAmount(): HandlingChargeAmount { return $this->amount; diff --git a/src/Api/Model/ShipmentServiceOptionsInternationalForms.php b/src/Api/Model/ShipmentServiceOptionsInternationalForms.php index 5ca7c0ab..00ef2fdf 100644 --- a/src/Api/Model/ShipmentServiceOptionsInternationalForms.php +++ b/src/Api/Model/ShipmentServiceOptionsInternationalForms.php @@ -13,27 +13,27 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Indicates the name of the International Form requested. - - Valid values: - - 01 - Invoice - - 03 - CO - - 04 - NAFTA CO - - 05 - Partial Invoice - - 06 - Packinglist - - 07 - Customer Generated Forms - - 08 – Air Freight Packing List - - 09 - CN22 Form - - 10 – UPS Premium Care Form - - 11 - EEI - - For shipment with return service, 05 or 10 are the only valid values. - - Note: 01 and 05 are mutually exclusive and 05 are only valid for return shipments only. - - * - * @var list - */ + * Indicates the name of the International Form requested. + * + * Valid values: + * - 01 - Invoice + * - 03 - CO + * - 04 - NAFTA CO + * - 05 - Partial Invoice + * - 06 - Packinglist + * - 07 - Customer Generated Forms + * - 08 – Air Freight Packing List + * - 09 - CN22 Form + * - 10 – UPS Premium Care Form + * - 11 - EEI + * + * For shipment with return service, 05 or 10 are the only valid values. + * + * Note: 01 and 05 are mutually exclusive and 05 are only valid for return shipments only. + * + * + * @var list + */ protected $formType; /** * Data container for DocumentID(s). Required if Form Type is 07. @@ -54,15 +54,15 @@ public function isInitialized($property): bool */ protected $cN22Form; /** - * Presence of the indicator means user will supply additional document, such as EEI, NAFTA_CO or CO. This indicator should be set when the shipper intends to utilize UPS paperless invoice functionality AND the shipper has SELF-PREPARED other International Forms (EEI, CO, NAFTACO) to accompany the shipment. - It is evaluated only when: - 1. Account is paperless enabled. - 2. Movement requires an invoice. - 3. Destination country or territory accepts paperless invoice. - 4. Invoice data is supplied by the client and the data passes validation. - * - * @var string - */ + * Presence of the indicator means user will supply additional document, such as EEI, NAFTA_CO or CO. This indicator should be set when the shipper intends to utilize UPS paperless invoice functionality AND the shipper has SELF-PREPARED other International Forms (EEI, CO, NAFTACO) to accompany the shipment. + * It is evaluated only when: + * 1. Account is paperless enabled. + * 2. Movement requires an invoice. + * 3. Destination country or territory accepts paperless invoice. + * 4. Invoice data is supplied by the client and the data passes validation. + * + * @var string + */ protected $additionalDocumentIndicator; /** * Contains description text which identifies the group of International forms. This element does not appear on the forms. @@ -83,8 +83,6 @@ public function isInitialized($property): bool */ protected $contacts; /** - * - * * @var list|null */ protected $product; @@ -107,32 +105,32 @@ public function isInitialized($property): bool */ protected $purchaseOrderNumber; /** - * Indicates the rights to the seller from the buyer. Also, it refers to Terms of Sale. Applies to Invoice and Partial Invoice forms only. - - Valid values: - CFR: Cost and Freight - CIF: Cost Insurance and Freight - CIP: Carriage and Insurance Paid - CPT: Carriage Paid To - DAF: Delivered at Frontier - DDP: Delivery Duty Paid - DDU: Delivery Duty Unpaid - DEQ: Delivered Ex Quay - DES: Delivered Ex Ship - EXW: Ex Works - FAS: Free Alongside Ship - FCA: Free Carrier - FOB: Free On Board - * - * @var string - */ + * Indicates the rights to the seller from the buyer. Also, it refers to Terms of Sale. Applies to Invoice and Partial Invoice forms only. + * + * Valid values: + * CFR: Cost and Freight + * CIF: Cost Insurance and Freight + * CIP: Carriage and Insurance Paid + * CPT: Carriage Paid To + * DAF: Delivered at Frontier + * DDP: Delivery Duty Paid + * DDU: Delivery Duty Unpaid + * DEQ: Delivered Ex Quay + * DES: Delivered Ex Ship + * EXW: Ex Works + * FAS: Free Alongside Ship + * FCA: Free Carrier + * FOB: Free On Board + * + * @var string + */ protected $termsOfShipment; /** - * A reason to export the current international shipment. - Valid values: SALE, GIFT, SAMPLE, RETURN, REPAIR, INTERCOMPANYDATA, Any other reason. Applies to Invoice and Partial Invoice forms only. Required for Invoice forms and Optional for Partial Invoice. No validation. - * - * @var string - */ + * A reason to export the current international shipment. + * Valid values: SALE, GIFT, SAMPLE, RETURN, REPAIR, INTERCOMPANYDATA, Any other reason. Applies to Invoice and Partial Invoice forms only. Required for Invoice forms and Optional for Partial Invoice. No validation. + * + * @var string + */ protected $reasonForExport; /** * Any extra information about the current shipment. Applies to Invoice and Partial Invoice forms only. @@ -189,13 +187,13 @@ public function isInitialized($property): bool */ protected $exportDate; /** - * The name of the carrier that is exporting the shipment. The vessels flag number should also be entered, if the carrier is a vessel. - - If value is empty, it will be set to default value as 'UPS' for EEI forms. Applies to CO and EEI forms only. Required for CO forms. - - * - * @var string - */ + * The name of the carrier that is exporting the shipment. The vessels flag number should also be entered, if the carrier is a vessel. + * + * If value is empty, it will be set to default value as 'UPS' for EEI forms. Applies to CO and EEI forms only. Required for CO forms. + * + * + * @var string + */ protected $exportingCarrier; /** * The four-character Standard Carrier Alpha Code (SCAC) for vessel, rail, and truck shipments. For air shipment, enter the two or three character International Air Transport Association (IATA) code. Applies to EEI forms only. No Validations. @@ -252,19 +250,19 @@ public function isInitialized($property): bool */ protected $loadingPier; /** - * Information about parties to transaction. Use Related, if the parties to the transaction are related. A related party is an export from a U.S. businessperson or business to a foreign business or from a U.S. business to a foreign person or business where the person has at least 10 percent of the voting shares of the business during the fiscal year. If unincorporated, then an equivalent interest in the business. Applies to EEI forms only. - - Valid values: - - R - Related - - N - Non-related. - - Parties to transaction is required if EEIFilingOption Code is 3 and if valid UPSFiled POA Code present in request. - - Default will be set to N - Non-related if invalid code present with length of one. - - * - * @var string - */ + * Information about parties to transaction. Use Related, if the parties to the transaction are related. A related party is an export from a U.S. businessperson or business to a foreign business or from a U.S. business to a foreign person or business where the person has at least 10 percent of the voting shares of the business during the fiscal year. If unincorporated, then an equivalent interest in the business. Applies to EEI forms only. + * + * Valid values: + * - R - Related + * - N - Non-related. + * + * Parties to transaction is required if EEIFilingOption Code is 3 and if valid UPSFiled POA Code present in request. + * + * Default will be set to N - Non-related if invalid code present with length of one. + * + * + * @var string + */ protected $partiesToTransaction; /** * If Present, indicates that it is a routed export transaction. A routed export transaction is one, where the foreign principal party in interest authorizes a U.S. forwarding (or other) agent to export the merchandise outside the U.S. Applies to EEI forms only. @@ -297,27 +295,27 @@ public function isInitialized($property): bool */ protected $hazardousMaterialsIndicator; /** - * Indicates the name of the International Form requested. - - Valid values: - - 01 - Invoice - - 03 - CO - - 04 - NAFTA CO - - 05 - Partial Invoice - - 06 - Packinglist - - 07 - Customer Generated Forms - - 08 – Air Freight Packing List - - 09 - CN22 Form - - 10 – UPS Premium Care Form - - 11 - EEI - - For shipment with return service, 05 or 10 are the only valid values. - - Note: 01 and 05 are mutually exclusive and 05 are only valid for return shipments only. - - * - * @return list - */ + * Indicates the name of the International Form requested. + * + * Valid values: + * - 01 - Invoice + * - 03 - CO + * - 04 - NAFTA CO + * - 05 - Partial Invoice + * - 06 - Packinglist + * - 07 - Customer Generated Forms + * - 08 – Air Freight Packing List + * - 09 - CN22 Form + * - 10 – UPS Premium Care Form + * - 11 - EEI + * + * For shipment with return service, 05 or 10 are the only valid values. + * + * Note: 01 and 05 are mutually exclusive and 05 are only valid for return shipments only. + * + * + * @return list + */ public function getFormType(): array { return $this->formType; @@ -419,15 +417,15 @@ public function setCN22Form(InternationalFormsCN22Form $cN22Form): self return $this; } /** - * Presence of the indicator means user will supply additional document, such as EEI, NAFTA_CO or CO. This indicator should be set when the shipper intends to utilize UPS paperless invoice functionality AND the shipper has SELF-PREPARED other International Forms (EEI, CO, NAFTACO) to accompany the shipment. - It is evaluated only when: - 1. Account is paperless enabled. - 2. Movement requires an invoice. - 3. Destination country or territory accepts paperless invoice. - 4. Invoice data is supplied by the client and the data passes validation. - * - * @return string - */ + * Presence of the indicator means user will supply additional document, such as EEI, NAFTA_CO or CO. This indicator should be set when the shipper intends to utilize UPS paperless invoice functionality AND the shipper has SELF-PREPARED other International Forms (EEI, CO, NAFTACO) to accompany the shipment. + * It is evaluated only when: + * 1. Account is paperless enabled. + * 2. Movement requires an invoice. + * 3. Destination country or territory accepts paperless invoice. + * 4. Invoice data is supplied by the client and the data passes validation. + * + * @return string + */ public function getAdditionalDocumentIndicator(): string { return $this->additionalDocumentIndicator; @@ -517,8 +515,6 @@ public function setContacts(InternationalFormsContacts $contacts): self return $this; } /** - * - * * @return list|null */ public function getProduct(): ?array @@ -526,8 +522,6 @@ public function getProduct(): ?array return $this->product; } /** - * - * * @param list|null $product * * @return self @@ -605,25 +599,25 @@ public function setPurchaseOrderNumber(string $purchaseOrderNumber): self return $this; } /** - * Indicates the rights to the seller from the buyer. Also, it refers to Terms of Sale. Applies to Invoice and Partial Invoice forms only. - - Valid values: - CFR: Cost and Freight - CIF: Cost Insurance and Freight - CIP: Carriage and Insurance Paid - CPT: Carriage Paid To - DAF: Delivered at Frontier - DDP: Delivery Duty Paid - DDU: Delivery Duty Unpaid - DEQ: Delivered Ex Quay - DES: Delivered Ex Ship - EXW: Ex Works - FAS: Free Alongside Ship - FCA: Free Carrier - FOB: Free On Board - * - * @return string - */ + * Indicates the rights to the seller from the buyer. Also, it refers to Terms of Sale. Applies to Invoice and Partial Invoice forms only. + * + * Valid values: + * CFR: Cost and Freight + * CIF: Cost Insurance and Freight + * CIP: Carriage and Insurance Paid + * CPT: Carriage Paid To + * DAF: Delivered at Frontier + * DDP: Delivery Duty Paid + * DDU: Delivery Duty Unpaid + * DEQ: Delivered Ex Quay + * DES: Delivered Ex Ship + * EXW: Ex Works + * FAS: Free Alongside Ship + * FCA: Free Carrier + * FOB: Free On Board + * + * @return string + */ public function getTermsOfShipment(): string { return $this->termsOfShipment; @@ -657,11 +651,11 @@ public function setTermsOfShipment(string $termsOfShipment): self return $this; } /** - * A reason to export the current international shipment. - Valid values: SALE, GIFT, SAMPLE, RETURN, REPAIR, INTERCOMPANYDATA, Any other reason. Applies to Invoice and Partial Invoice forms only. Required for Invoice forms and Optional for Partial Invoice. No validation. - * - * @return string - */ + * A reason to export the current international shipment. + * Valid values: SALE, GIFT, SAMPLE, RETURN, REPAIR, INTERCOMPANYDATA, Any other reason. Applies to Invoice and Partial Invoice forms only. Required for Invoice forms and Optional for Partial Invoice. No validation. + * + * @return string + */ public function getReasonForExport(): string { return $this->reasonForExport; @@ -879,13 +873,13 @@ public function setExportDate(string $exportDate): self return $this; } /** - * The name of the carrier that is exporting the shipment. The vessels flag number should also be entered, if the carrier is a vessel. - - If value is empty, it will be set to default value as 'UPS' for EEI forms. Applies to CO and EEI forms only. Required for CO forms. - - * - * @return string - */ + * The name of the carrier that is exporting the shipment. The vessels flag number should also be entered, if the carrier is a vessel. + * + * If value is empty, it will be set to default value as 'UPS' for EEI forms. Applies to CO and EEI forms only. Required for CO forms. + * + * + * @return string + */ public function getExportingCarrier(): string { return $this->exportingCarrier; @@ -1105,19 +1099,19 @@ public function setLoadingPier(string $loadingPier): self return $this; } /** - * Information about parties to transaction. Use Related, if the parties to the transaction are related. A related party is an export from a U.S. businessperson or business to a foreign business or from a U.S. business to a foreign person or business where the person has at least 10 percent of the voting shares of the business during the fiscal year. If unincorporated, then an equivalent interest in the business. Applies to EEI forms only. - - Valid values: - - R - Related - - N - Non-related. - - Parties to transaction is required if EEIFilingOption Code is 3 and if valid UPSFiled POA Code present in request. - - Default will be set to N - Non-related if invalid code present with length of one. - - * - * @return string - */ + * Information about parties to transaction. Use Related, if the parties to the transaction are related. A related party is an export from a U.S. businessperson or business to a foreign business or from a U.S. business to a foreign person or business where the person has at least 10 percent of the voting shares of the business during the fiscal year. If unincorporated, then an equivalent interest in the business. Applies to EEI forms only. + * + * Valid values: + * - R - Related + * - N - Non-related. + * + * Parties to transaction is required if EEIFilingOption Code is 3 and if valid UPSFiled POA Code present in request. + * + * Default will be set to N - Non-related if invalid code present with length of one. + * + * + * @return string + */ public function getPartiesToTransaction(): string { return $this->partiesToTransaction; diff --git a/src/Api/Model/ShipmentServiceOptionsLabelMethod.php b/src/Api/Model/ShipmentServiceOptionsLabelMethod.php index 5eedd833..5d2b5967 100644 --- a/src/Api/Model/ShipmentServiceOptionsLabelMethod.php +++ b/src/Api/Model/ShipmentServiceOptionsLabelMethod.php @@ -13,15 +13,15 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Valid LabelMethod types are: - 01 = ImportControl Print and Mail - 02 = ImportControl One-Attempt - 03 = ImportControl Three-Attempt - 04 = ImportControl Electronic Label - 05 = ImportControl Print Label - * - * @var string - */ + * Valid LabelMethod types are: + * 01 = ImportControl Print and Mail + * 02 = ImportControl One-Attempt + * 03 = ImportControl Three-Attempt + * 04 = ImportControl Electronic Label + * 05 = ImportControl Print Label + * + * @var string + */ protected $code; /** * LabelMethod description. @@ -30,15 +30,15 @@ public function isInitialized($property): bool */ protected $description; /** - * Valid LabelMethod types are: - 01 = ImportControl Print and Mail - 02 = ImportControl One-Attempt - 03 = ImportControl Three-Attempt - 04 = ImportControl Electronic Label - 05 = ImportControl Print Label - * - * @return string - */ + * Valid LabelMethod types are: + * 01 = ImportControl Print and Mail + * 02 = ImportControl One-Attempt + * 03 = ImportControl Three-Attempt + * 04 = ImportControl Electronic Label + * 05 = ImportControl Print Label + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ShipmentServiceOptionsNotification.php b/src/Api/Model/ShipmentServiceOptionsNotification.php index 480a6500..ecd40d9c 100644 --- a/src/Api/Model/ShipmentServiceOptionsNotification.php +++ b/src/Api/Model/ShipmentServiceOptionsNotification.php @@ -13,25 +13,25 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The type of notification requested. - - Note: - - QVN Exception notification and return notification are not applicable to GFP. - - QV In-transit and Return Notifications are only valid for ImportControl and Return shipment. - - QV In-transit Notification is allowed for return shipments only. - - QV Ship Notification is allowed for forward moving shipments only. - - Valid values: - - 5 - QV In-transit Notification - - 6 - QV Ship Notification - - 7 - QV Exception Notification - - 8 - QV Delivery Notification - - 2 - Return Notification or Label Creation Notification - - 012 - Alternate Delivery Location Notification - - 013 - UAP Shipper Notification. - * - * @var string - */ + * The type of notification requested. + * + * Note: + * - QVN Exception notification and return notification are not applicable to GFP. + * - QV In-transit and Return Notifications are only valid for ImportControl and Return shipment. + * - QV In-transit Notification is allowed for return shipments only. + * - QV Ship Notification is allowed for forward moving shipments only. + * + * Valid values: + * - 5 - QV In-transit Notification + * - 6 - QV Ship Notification + * - 7 - QV Exception Notification + * - 8 - QV Delivery Notification + * - 2 - Return Notification or Label Creation Notification + * - 012 - Alternate Delivery Location Notification + * - 013 - UAP Shipper Notification. + * + * @var string + */ protected $notificationCode; /** * Container for Email Information. @@ -58,25 +58,25 @@ public function isInitialized($property): bool */ protected $locale; /** - * The type of notification requested. - - Note: - - QVN Exception notification and return notification are not applicable to GFP. - - QV In-transit and Return Notifications are only valid for ImportControl and Return shipment. - - QV In-transit Notification is allowed for return shipments only. - - QV Ship Notification is allowed for forward moving shipments only. - - Valid values: - - 5 - QV In-transit Notification - - 6 - QV Ship Notification - - 7 - QV Exception Notification - - 8 - QV Delivery Notification - - 2 - Return Notification or Label Creation Notification - - 012 - Alternate Delivery Location Notification - - 013 - UAP Shipper Notification. - * - * @return string - */ + * The type of notification requested. + * + * Note: + * - QVN Exception notification and return notification are not applicable to GFP. + * - QV In-transit and Return Notifications are only valid for ImportControl and Return shipment. + * - QV In-transit Notification is allowed for return shipments only. + * - QV Ship Notification is allowed for forward moving shipments only. + * + * Valid values: + * - 5 - QV In-transit Notification + * - 6 - QV Ship Notification + * - 7 - QV Exception Notification + * - 8 - QV Delivery Notification + * - 2 - Return Notification or Label Creation Notification + * - 012 - Alternate Delivery Location Notification + * - 013 - UAP Shipper Notification. + * + * @return string + */ public function getNotificationCode(): string { return $this->notificationCode; diff --git a/src/Api/Model/ShipmentShipFrom.php b/src/Api/Model/ShipmentShipFrom.php index cd4c5310..d874fd88 100644 --- a/src/Api/Model/ShipmentShipFrom.php +++ b/src/Api/Model/ShipmentShipFrom.php @@ -13,18 +13,18 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The ship from location's name or company name. - 35 characters are accepted, but for return Shipment only 30 characters will be printed on the label. Required if ShipFrom tag is in the XML. - * - * @var string - */ + * The ship from location's name or company name. + * 35 characters are accepted, but for return Shipment only 30 characters will be printed on the label. Required if ShipFrom tag is in the XML. + * + * @var string + */ protected $name; /** - * The ship from Attention name. - 35 characters are accepted, but for return Shipment only 30 characters will be printed on the label. Required if ShipFrom tag is in the XML and Invoice or CO International forms is requested. If not present, will default to the Shipper Attention Name. - * - * @var string - */ + * The ship from Attention name. + * 35 characters are accepted, but for return Shipment only 30 characters will be printed on the label. Required if ShipFrom tag is in the XML and Invoice or CO International forms is requested. If not present, will default to the Shipper Attention Name. + * + * @var string + */ protected $attentionName; /** * Not applicable for ShipFrom. @@ -33,11 +33,11 @@ public function isInitialized($property): bool */ protected $companyDisplayableName; /** - * Company's Tax Identification Number at the pick up location. Conditionally required if EEI form (International forms) is requested. - Applies to EEI Form only. - * - * @var string - */ + * Company's Tax Identification Number at the pick up location. Conditionally required if EEI form (International forms) is requested. + * Applies to EEI Form only. + * + * @var string + */ protected $taxIdentificationNumber; /** * Tax Identification Container. Applies to EEI form only. @@ -70,11 +70,11 @@ public function isInitialized($property): bool */ protected $vendorInfo; /** - * The ship from location's name or company name. - 35 characters are accepted, but for return Shipment only 30 characters will be printed on the label. Required if ShipFrom tag is in the XML. - * - * @return string - */ + * The ship from location's name or company name. + * 35 characters are accepted, but for return Shipment only 30 characters will be printed on the label. Required if ShipFrom tag is in the XML. + * + * @return string + */ public function getName(): string { return $this->name; @@ -94,11 +94,11 @@ public function setName(string $name): self return $this; } /** - * The ship from Attention name. - 35 characters are accepted, but for return Shipment only 30 characters will be printed on the label. Required if ShipFrom tag is in the XML and Invoice or CO International forms is requested. If not present, will default to the Shipper Attention Name. - * - * @return string - */ + * The ship from Attention name. + * 35 characters are accepted, but for return Shipment only 30 characters will be printed on the label. Required if ShipFrom tag is in the XML and Invoice or CO International forms is requested. If not present, will default to the Shipper Attention Name. + * + * @return string + */ public function getAttentionName(): string { return $this->attentionName; @@ -140,11 +140,11 @@ public function setCompanyDisplayableName(string $companyDisplayableName): self return $this; } /** - * Company's Tax Identification Number at the pick up location. Conditionally required if EEI form (International forms) is requested. - Applies to EEI Form only. - * - * @return string - */ + * Company's Tax Identification Number at the pick up location. Conditionally required if EEI form (International forms) is requested. + * Applies to EEI Form only. + * + * @return string + */ public function getTaxIdentificationNumber(): string { return $this->taxIdentificationNumber; diff --git a/src/Api/Model/ShipmentShipTo.php b/src/Api/Model/ShipmentShipTo.php index c7cc53e3..f9f0dbb5 100644 --- a/src/Api/Model/ShipmentShipTo.php +++ b/src/Api/Model/ShipmentShipTo.php @@ -19,13 +19,13 @@ public function isInitialized($property): bool */ protected $name; /** - * Contact name at the consignee's location. Required for: UPS Next Day Air® Early service, and when ShipTo country or territory is different than ShipFrom country or territory. - - Required if Invoice International form is requested. - - * - * @var string - */ + * Contact name at the consignee's location. Required for: UPS Next Day Air® Early service, and when ShipTo country or territory is different than ShipFrom country or territory. + * + * Required if Invoice International form is requested. + * + * + * @var string + */ protected $attentionName; /** * Not applicable for ShipTo @@ -92,13 +92,13 @@ public function setName(string $name): self return $this; } /** - * Contact name at the consignee's location. Required for: UPS Next Day Air® Early service, and when ShipTo country or territory is different than ShipFrom country or territory. - - Required if Invoice International form is requested. - - * - * @return string - */ + * Contact name at the consignee's location. Required for: UPS Next Day Air® Early service, and when ShipTo country or territory is different than ShipFrom country or territory. + * + * Required if Invoice International form is requested. + * + * + * @return string + */ public function getAttentionName(): string { return $this->attentionName; diff --git a/src/Api/Model/ShipmentShipmentIndicationType.php b/src/Api/Model/ShipmentShipmentIndicationType.php index 8cb314cd..5c0d4021 100644 --- a/src/Api/Model/ShipmentShipmentIndicationType.php +++ b/src/Api/Model/ShipmentShipmentIndicationType.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Valid values: - - '01' - Hold for Pickup at UPS Access Point aka Direct to Retail (D2R) - - '02' - UPS Access Point™ Delivery aka Retail to Retail (R2R) If '01' code is present indicates shipment will be send to Retail location where it is held to consignee to claim. - - * - * @var string - */ + * Valid values: + * - '01' - Hold for Pickup at UPS Access Point aka Direct to Retail (D2R) + * - '02' - UPS Access Point™ Delivery aka Retail to Retail (R2R) If '01' code is present indicates shipment will be send to Retail location where it is held to consignee to claim. + * + * + * @var string + */ protected $code; /** * Description for the code. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $description; /** - * Valid values: - - '01' - Hold for Pickup at UPS Access Point aka Direct to Retail (D2R) - - '02' - UPS Access Point™ Delivery aka Retail to Retail (R2R) If '01' code is present indicates shipment will be send to Retail location where it is held to consignee to claim. - - * - * @return string - */ + * Valid values: + * - '01' - Hold for Pickup at UPS Access Point aka Direct to Retail (D2R) + * - '02' - UPS Access Point™ Delivery aka Retail to Retail (R2R) If '01' code is present indicates shipment will be send to Retail location where it is held to consignee to claim. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ShipmentShipmentRatingOptions.php b/src/Api/Model/ShipmentShipmentRatingOptions.php index bcf7a82e..6817e42c 100644 --- a/src/Api/Model/ShipmentShipmentRatingOptions.php +++ b/src/Api/Model/ShipmentShipmentRatingOptions.php @@ -13,14 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Negotiated Rates option indicator. If the indicator is present and the Shipper is authorized then Negotiated Rates should be returned in the response. Negotiated Rates are of two types Account Based Rates (ABR) and Web Discount Rates. Negotiated Rates are only returned for qualified Shipper Account Numbers. - - Eligibility is determined using the combination of UserId and the Shipper's Shipper Account Number. If the user is qualified, both Published rates and Negotiated rates are returned to the user. If the UserId and Shipper Account - - Number are not qualified for Negotiated rates, a warning message is returned that indicates ineligibility and only the Published rates are returned in the response. As per discount eligibility of user, negotiated rates in the response may contain ABR or Web discount rates. - * - * @var string - */ + * Negotiated Rates option indicator. If the indicator is present and the Shipper is authorized then Negotiated Rates should be returned in the response. Negotiated Rates are of two types Account Based Rates (ABR) and Web Discount Rates. Negotiated Rates are only returned for qualified Shipper Account Numbers. + * + * Eligibility is determined using the combination of UserId and the Shipper's Shipper Account Number. If the user is qualified, both Published rates and Negotiated rates are returned to the user. If the UserId and Shipper Account + * + * Number are not qualified for Negotiated rates, a warning message is returned that indicates ineligibility and only the Published rates are returned in the response. As per discount eligibility of user, negotiated rates in the response may contain ABR or Web discount rates. + * + * @var string + */ protected $negotiatedRatesIndicator; /** * Ground Freight Pricing Rates option indicator. If the Ground Freight Pricing Shipment indicator is enabled and Shipper number is authorized then Ground Freight Pricing rates should be returned in the response. The Shipper account number must be qualified to receive Ground Freight Pricing Density Based Shipment rates. Only the Shipper account number taken from /ShipmentRequest/Shipment/FRSPaymentInformation/AccountNumber is used when checking qualification for Ground Freight Pricing Density Based rates. @@ -35,33 +35,33 @@ public function isInitialized($property): bool */ protected $rateChartIndicator; /** - * This indicator applies for a third party (3P) / Freight collect (FC) shipment only. - - For 3P/FC shipment if the shipper wishes to request for the negotiated rates of the third party then this indicator should be included in the request. - - If authorized the 3P/FC negotiated rates will be applied to the shipment and rates will be returned in response. - * - * @var string - */ + * This indicator applies for a third party (3P) / Freight collect (FC) shipment only. + * + * For 3P/FC shipment if the shipper wishes to request for the negotiated rates of the third party then this indicator should be included in the request. + * + * If authorized the 3P/FC negotiated rates will be applied to the shipment and rates will be returned in response. + * + * @var string + */ protected $tPFCNegotiatedRatesIndicator; /** - * If this indicator is present user level discount will be applied to rates if applicable Conditions checked: - This indicator should be present - Shipper number should not be present - User should be eligible for user level discount - * - * @var string - */ + * If this indicator is present user level discount will be applied to rates if applicable Conditions checked: + * This indicator should be present + * Shipper number should not be present + * User should be eligible for user level discount + * + * @var string + */ protected $userLevelDiscountIndicator; /** - * Negotiated Rates option indicator. If the indicator is present and the Shipper is authorized then Negotiated Rates should be returned in the response. Negotiated Rates are of two types Account Based Rates (ABR) and Web Discount Rates. Negotiated Rates are only returned for qualified Shipper Account Numbers. - - Eligibility is determined using the combination of UserId and the Shipper's Shipper Account Number. If the user is qualified, both Published rates and Negotiated rates are returned to the user. If the UserId and Shipper Account - - Number are not qualified for Negotiated rates, a warning message is returned that indicates ineligibility and only the Published rates are returned in the response. As per discount eligibility of user, negotiated rates in the response may contain ABR or Web discount rates. - * - * @return string - */ + * Negotiated Rates option indicator. If the indicator is present and the Shipper is authorized then Negotiated Rates should be returned in the response. Negotiated Rates are of two types Account Based Rates (ABR) and Web Discount Rates. Negotiated Rates are only returned for qualified Shipper Account Numbers. + * + * Eligibility is determined using the combination of UserId and the Shipper's Shipper Account Number. If the user is qualified, both Published rates and Negotiated rates are returned to the user. If the UserId and Shipper Account + * + * Number are not qualified for Negotiated rates, a warning message is returned that indicates ineligibility and only the Published rates are returned in the response. As per discount eligibility of user, negotiated rates in the response may contain ABR or Web discount rates. + * + * @return string + */ public function getNegotiatedRatesIndicator(): string { return $this->negotiatedRatesIndicator; @@ -128,14 +128,14 @@ public function setRateChartIndicator(string $rateChartIndicator): self return $this; } /** - * This indicator applies for a third party (3P) / Freight collect (FC) shipment only. - - For 3P/FC shipment if the shipper wishes to request for the negotiated rates of the third party then this indicator should be included in the request. - - If authorized the 3P/FC negotiated rates will be applied to the shipment and rates will be returned in response. - * - * @return string - */ + * This indicator applies for a third party (3P) / Freight collect (FC) shipment only. + * + * For 3P/FC shipment if the shipper wishes to request for the negotiated rates of the third party then this indicator should be included in the request. + * + * If authorized the 3P/FC negotiated rates will be applied to the shipment and rates will be returned in response. + * + * @return string + */ public function getTPFCNegotiatedRatesIndicator(): string { return $this->tPFCNegotiatedRatesIndicator; @@ -158,13 +158,13 @@ public function setTPFCNegotiatedRatesIndicator(string $tPFCNegotiatedRatesIndic return $this; } /** - * If this indicator is present user level discount will be applied to rates if applicable Conditions checked: - This indicator should be present - Shipper number should not be present - User should be eligible for user level discount - * - * @return string - */ + * If this indicator is present user level discount will be applied to rates if applicable Conditions checked: + * This indicator should be present + * Shipper number should not be present + * User should be eligible for user level discount + * + * @return string + */ public function getUserLevelDiscountIndicator(): string { return $this->userLevelDiscountIndicator; diff --git a/src/Api/Model/ShipmentShipmentServiceOptions.php b/src/Api/Model/ShipmentShipmentServiceOptions.php index 4bdb14ff..5fdfe39a 100644 --- a/src/Api/Model/ShipmentShipmentServiceOptions.php +++ b/src/Api/Model/ShipmentShipmentServiceOptions.php @@ -31,12 +31,12 @@ public function isInitialized($property): bool */ protected $cOD; /** - * Access Point COD indicates COD is requested for a shipment. Valid only for "01 - Hold For Pickup At UPS Access Point" Shipment Indication type. Shipment Access Point COD is valid only for countries or territories within E.U. - Not valid with (Shipment) COD. - Not available to shipment with return service. - * - * @var ShipmentServiceOptionsAccessPointCOD - */ + * Access Point COD indicates COD is requested for a shipment. Valid only for "01 - Hold For Pickup At UPS Access Point" Shipment Indication type. Shipment Access Point COD is valid only for countries or territories within E.U. + * Not valid with (Shipment) COD. + * Not available to shipment with return service. + * + * @var ShipmentServiceOptionsAccessPointCOD + */ protected $accessPointCOD; /** * Presence/Absence Indicator. Any value inside is ignored. DeliverToAddresseeOnlyIndicator is shipper specified restriction that requires the addressee to be the one who takes final delivery of the "Hold For PickUp at UPS Access Point" package. Presence of indicator means shipper restriction will apply to the shipment. Only valid for Shipment Indication type "01 - Hold For PickUp at UPS Access Point". @@ -51,8 +51,6 @@ public function isInitialized($property): bool */ protected $directDeliveryOnlyIndicator; /** - * - * * @var list */ protected $notification; @@ -69,12 +67,12 @@ public function isInitialized($property): bool */ protected $internationalForms; /** - * Delivery Confirmation container. Valid for forward shipments only. - - Refer to Delivery Confirmation Origin-Destination Pairs in the Appendix for a list of valid values. - * - * @var ShipmentServiceOptionsDeliveryConfirmation - */ + * Delivery Confirmation container. Valid for forward shipments only. + * + * Refer to Delivery Confirmation Origin-Destination Pairs in the Appendix for a list of valid values. + * + * @var ShipmentServiceOptionsDeliveryConfirmation + */ protected $deliveryConfirmation; /** * The flag indicates the ReturnOfDocument accessorial has been requested. Valid for Poland to Poland forward shipment only. @@ -107,8 +105,6 @@ public function isInitialized($property): bool */ protected $uPScarbonneutralIndicator; /** - * - * * @var list */ protected $preAlertNotification; @@ -131,24 +127,24 @@ public function isInitialized($property): bool */ protected $dropoffAtUPSFacilityIndicator; /** - * Lift Gate For Pick Up indicator. The empty tag means indicator is present. Lift Gate for Pickup is not allowed with Drop Off At UPS Facility for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. - - When both Hold for Pickup and Drop Off At Facility are selected, neither of the Lift Gate accessorial (Pick Up or Delivery) are allowed for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. - - This accessorial is only valid for UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday Shipment. - * - * @var string - */ + * Lift Gate For Pick Up indicator. The empty tag means indicator is present. Lift Gate for Pickup is not allowed with Drop Off At UPS Facility for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. + * + * When both Hold for Pickup and Drop Off At Facility are selected, neither of the Lift Gate accessorial (Pick Up or Delivery) are allowed for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. + * + * This accessorial is only valid for UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday Shipment. + * + * @var string + */ protected $liftGateForPickUpIndicator; /** - * Lift Gate For Delivery indicator. The empty tag means indicator is present. Lift Gate for Delivery is not allowed with Hold For Pickup for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. - - When both Hold for Pickup and Drop Off At UPS Facility are selected, neither of the Lift Gate accessorial (Pick Up or Delivery) are allowed for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. - - This accessorial is only valid for UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday Shipment. - * - * @var string - */ + * Lift Gate For Delivery indicator. The empty tag means indicator is present. Lift Gate for Delivery is not allowed with Hold For Pickup for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. + * + * When both Hold for Pickup and Drop Off At UPS Facility are selected, neither of the Lift Gate accessorial (Pick Up or Delivery) are allowed for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. + * + * This accessorial is only valid for UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday Shipment. + * + * @var string + */ protected $liftGateForDeliveryIndicator; /** * The presence of the tag SDLShipmentIndicator indicates Shipment is SDL. SDLShipmentIndicator presence means EEI form/ EEI Filing option required. @@ -169,14 +165,14 @@ public function isInitialized($property): bool */ protected $restrictedArticles; /** - * Inside delivery accessory. Valid values: - 01 - White Glove - 02 - Room of Choice - 03 - Installation - Default is Room of Choice. Shippers account needs to have a valid contract for Heavy Goods Service. - * - * @var string - */ + * Inside delivery accessory. Valid values: + * 01 - White Glove + * 02 - Room of Choice + * 03 - Installation + * Default is Room of Choice. Shippers account needs to have a valid contract for Heavy Goods Service. + * + * @var string + */ protected $insideDelivery; /** * Presence/Absence indicator. True if present; false otherwise. Any value is ignored. If present, indicates that the customer would like items disposed. Shippers account needs to have a valid contract for Heavy Goods Service. @@ -251,12 +247,12 @@ public function setCOD(ShipmentServiceOptionsCOD $cOD): self return $this; } /** - * Access Point COD indicates COD is requested for a shipment. Valid only for "01 - Hold For Pickup At UPS Access Point" Shipment Indication type. Shipment Access Point COD is valid only for countries or territories within E.U. - Not valid with (Shipment) COD. - Not available to shipment with return service. - * - * @return ShipmentServiceOptionsAccessPointCOD - */ + * Access Point COD indicates COD is requested for a shipment. Valid only for "01 - Hold For Pickup At UPS Access Point" Shipment Indication type. Shipment Access Point COD is valid only for countries or territories within E.U. + * Not valid with (Shipment) COD. + * Not available to shipment with return service. + * + * @return ShipmentServiceOptionsAccessPointCOD + */ public function getAccessPointCOD(): ShipmentServiceOptionsAccessPointCOD { return $this->accessPointCOD; @@ -321,8 +317,6 @@ public function setDirectDeliveryOnlyIndicator(string $directDeliveryOnlyIndicat return $this; } /** - * - * * @return list */ public function getNotification(): array @@ -330,8 +324,6 @@ public function getNotification(): array return $this->notification; } /** - * - * * @param list $notification * * @return self @@ -387,12 +379,12 @@ public function setInternationalForms(ShipmentServiceOptionsInternationalForms $ return $this; } /** - * Delivery Confirmation container. Valid for forward shipments only. - - Refer to Delivery Confirmation Origin-Destination Pairs in the Appendix for a list of valid values. - * - * @return ShipmentServiceOptionsDeliveryConfirmation - */ + * Delivery Confirmation container. Valid for forward shipments only. + * + * Refer to Delivery Confirmation Origin-Destination Pairs in the Appendix for a list of valid values. + * + * @return ShipmentServiceOptionsDeliveryConfirmation + */ public function getDeliveryConfirmation(): ShipmentServiceOptionsDeliveryConfirmation { return $this->deliveryConfirmation; @@ -523,8 +515,6 @@ public function setUPScarbonneutralIndicator(string $uPScarbonneutralIndicator): return $this; } /** - * - * * @return list */ public function getPreAlertNotification(): array @@ -532,8 +522,6 @@ public function getPreAlertNotification(): array return $this->preAlertNotification; } /** - * - * * @param list $preAlertNotification * * @return self @@ -611,14 +599,14 @@ public function setDropoffAtUPSFacilityIndicator(string $dropoffAtUPSFacilityInd return $this; } /** - * Lift Gate For Pick Up indicator. The empty tag means indicator is present. Lift Gate for Pickup is not allowed with Drop Off At UPS Facility for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. - - When both Hold for Pickup and Drop Off At Facility are selected, neither of the Lift Gate accessorial (Pick Up or Delivery) are allowed for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. - - This accessorial is only valid for UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday Shipment. - * - * @return string - */ + * Lift Gate For Pick Up indicator. The empty tag means indicator is present. Lift Gate for Pickup is not allowed with Drop Off At UPS Facility for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. + * + * When both Hold for Pickup and Drop Off At Facility are selected, neither of the Lift Gate accessorial (Pick Up or Delivery) are allowed for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. + * + * This accessorial is only valid for UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday Shipment. + * + * @return string + */ public function getLiftGateForPickUpIndicator(): string { return $this->liftGateForPickUpIndicator; @@ -641,14 +629,14 @@ public function setLiftGateForPickUpIndicator(string $liftGateForPickUpIndicator return $this; } /** - * Lift Gate For Delivery indicator. The empty tag means indicator is present. Lift Gate for Delivery is not allowed with Hold For Pickup for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. - - When both Hold for Pickup and Drop Off At UPS Facility are selected, neither of the Lift Gate accessorial (Pick Up or Delivery) are allowed for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. - - This accessorial is only valid for UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday Shipment. - * - * @return string - */ + * Lift Gate For Delivery indicator. The empty tag means indicator is present. Lift Gate for Delivery is not allowed with Hold For Pickup for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. + * + * When both Hold for Pickup and Drop Off At UPS Facility are selected, neither of the Lift Gate accessorial (Pick Up or Delivery) are allowed for a UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday shipment. + * + * This accessorial is only valid for UPS Worldwide Express Freight and UPS Worldwide Express Freight Midday Shipment. + * + * @return string + */ public function getLiftGateForDeliveryIndicator(): string { return $this->liftGateForDeliveryIndicator; @@ -737,14 +725,14 @@ public function setRestrictedArticles(ShipmentServiceOptionsRestrictedArticles $ return $this; } /** - * Inside delivery accessory. Valid values: - 01 - White Glove - 02 - Room of Choice - 03 - Installation - Default is Room of Choice. Shippers account needs to have a valid contract for Heavy Goods Service. - * - * @return string - */ + * Inside delivery accessory. Valid values: + * 01 - White Glove + * 02 - Room of Choice + * 03 - Installation + * Default is Room of Choice. Shippers account needs to have a valid contract for Heavy Goods Service. + * + * @return string + */ public function getInsideDelivery(): string { return $this->insideDelivery; diff --git a/src/Api/Model/ShipmentShipper.php b/src/Api/Model/ShipmentShipper.php index 6746314b..934001a5 100644 --- a/src/Api/Model/ShipmentShipper.php +++ b/src/Api/Model/ShipmentShipper.php @@ -13,29 +13,29 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Shippers company name. - - For forward Shipment 35 characters are accepted, but only 30 characters will be printed on the label. - * - * @var string - */ + * Shippers company name. + * + * For forward Shipment 35 characters are accepted, but only 30 characters will be printed on the label. + * + * @var string + */ protected $name; /** - * Shippers Attention Name. - - For forward Shipment 35 characters are accepted, but only 30 characters will be printed on the label. Required if destination is international. Required if Invoice and CO International forms are requested and the ShipFrom address is not present. - * - * @var string - */ + * Shippers Attention Name. + * + * For forward Shipment 35 characters are accepted, but only 30 characters will be printed on the label. Required if destination is international. Required if Invoice and CO International forms are requested and the ShipFrom address is not present. + * + * @var string + */ protected $attentionName; /** - * Shipper's CompanyDisplayableName. - - The CompanyDisplayableName will be displayed in tracking results and notification messages in place of the name associated with the shipper account. - The original shipper account name will be displayed for all Return Services and Import Control Shipments. This is available for Shipper accounts enabled by UPS and applies to Forward Shipments. - * - * @var string - */ + * Shipper's CompanyDisplayableName. + * + * The CompanyDisplayableName will be displayed in tracking results and notification messages in place of the name associated with the shipper account. + * The original shipper account name will be displayed for all Return Services and Import Control Shipments. This is available for Shipper accounts enabled by UPS and applies to Forward Shipments. + * + * @var string + */ protected $companyDisplayableName; /** * Shipper's Tax Identification Number. Conditionally required if EEI form (International forms) is requested and ship From is not mentioned. @@ -50,20 +50,20 @@ public function isInitialized($property): bool */ protected $phone; /** - * Shipper's six digit alphanumeric account number. - - Must be associated with the UserId specified in the AccessRequest XML. - - The account must be a valid UPS account number that is active. - - For US, PR and CA accounts, the account must be either a daily pickup account, an occasional account, or a customer B.I.N account. - - Drop Shipper accounts are valid for return service shipments only if the account is Trade Direct (TD) enabled. - - All other accounts must be either a daily pickup account or an occasional account. - * - * @var string - */ + * Shipper's six digit alphanumeric account number. + * + * Must be associated with the UserId specified in the AccessRequest XML. + * + * The account must be a valid UPS account number that is active. + * + * For US, PR and CA accounts, the account must be either a daily pickup account, an occasional account, or a customer B.I.N account. + * + * Drop Shipper accounts are valid for return service shipments only if the account is Trade Direct (TD) enabled. + * + * All other accounts must be either a daily pickup account or an occasional account. + * + * @var string + */ protected $shipperNumber; /** * Shipper's Fax Number. @@ -78,23 +78,23 @@ public function isInitialized($property): bool */ protected $eMailAddress; /** - * Address tag Container. The package should be returned to this address if the package is undeliverable. - - This address appears on the upper left hand corner of the label. - - Note: If the ShipFrom container is not present then this address will be used as the ShipFrom address. If this address is used as the ShipFrom the shipment will be rated from this origin address. - - * - * @var ShipperAddress - */ + * Address tag Container. The package should be returned to this address if the package is undeliverable. + * + * This address appears on the upper left hand corner of the label. + * + * Note: If the ShipFrom container is not present then this address will be used as the ShipFrom address. If this address is used as the ShipFrom the shipment will be rated from this origin address. + * + * + * @var ShipperAddress + */ protected $address; /** - * Shippers company name. - - For forward Shipment 35 characters are accepted, but only 30 characters will be printed on the label. - * - * @return string - */ + * Shippers company name. + * + * For forward Shipment 35 characters are accepted, but only 30 characters will be printed on the label. + * + * @return string + */ public function getName(): string { return $this->name; @@ -115,12 +115,12 @@ public function setName(string $name): self return $this; } /** - * Shippers Attention Name. - - For forward Shipment 35 characters are accepted, but only 30 characters will be printed on the label. Required if destination is international. Required if Invoice and CO International forms are requested and the ShipFrom address is not present. - * - * @return string - */ + * Shippers Attention Name. + * + * For forward Shipment 35 characters are accepted, but only 30 characters will be printed on the label. Required if destination is international. Required if Invoice and CO International forms are requested and the ShipFrom address is not present. + * + * @return string + */ public function getAttentionName(): string { return $this->attentionName; @@ -141,13 +141,13 @@ public function setAttentionName(string $attentionName): self return $this; } /** - * Shipper's CompanyDisplayableName. - - The CompanyDisplayableName will be displayed in tracking results and notification messages in place of the name associated with the shipper account. - The original shipper account name will be displayed for all Return Services and Import Control Shipments. This is available for Shipper accounts enabled by UPS and applies to Forward Shipments. - * - * @return string - */ + * Shipper's CompanyDisplayableName. + * + * The CompanyDisplayableName will be displayed in tracking results and notification messages in place of the name associated with the shipper account. + * The original shipper account name will be displayed for all Return Services and Import Control Shipments. This is available for Shipper accounts enabled by UPS and applies to Forward Shipments. + * + * @return string + */ public function getCompanyDisplayableName(): string { return $this->companyDisplayableName; @@ -213,20 +213,20 @@ public function setPhone(ShipperPhone $phone): self return $this; } /** - * Shipper's six digit alphanumeric account number. - - Must be associated with the UserId specified in the AccessRequest XML. - - The account must be a valid UPS account number that is active. - - For US, PR and CA accounts, the account must be either a daily pickup account, an occasional account, or a customer B.I.N account. - - Drop Shipper accounts are valid for return service shipments only if the account is Trade Direct (TD) enabled. - - All other accounts must be either a daily pickup account or an occasional account. - * - * @return string - */ + * Shipper's six digit alphanumeric account number. + * + * Must be associated with the UserId specified in the AccessRequest XML. + * + * The account must be a valid UPS account number that is active. + * + * For US, PR and CA accounts, the account must be either a daily pickup account, an occasional account, or a customer B.I.N account. + * + * Drop Shipper accounts are valid for return service shipments only if the account is Trade Direct (TD) enabled. + * + * All other accounts must be either a daily pickup account or an occasional account. + * + * @return string + */ public function getShipperNumber(): string { return $this->shipperNumber; @@ -299,15 +299,15 @@ public function setEMailAddress(string $eMailAddress): self return $this; } /** - * Address tag Container. The package should be returned to this address if the package is undeliverable. - - This address appears on the upper left hand corner of the label. - - Note: If the ShipFrom container is not present then this address will be used as the ShipFrom address. If this address is used as the ShipFrom the shipment will be rated from this origin address. - - * - * @return ShipperAddress - */ + * Address tag Container. The package should be returned to this address if the package is undeliverable. + * + * This address appears on the upper left hand corner of the label. + * + * Note: If the ShipFrom container is not present then this address will be used as the ShipFrom address. If this address is used as the ShipFrom the shipment will be rated from this origin address. + * + * + * @return ShipperAddress + */ public function getAddress(): ShipperAddress { return $this->address; diff --git a/src/Api/Model/ShipmentTotalWeightUnitOfMeasurement.php b/src/Api/Model/ShipmentTotalWeightUnitOfMeasurement.php index 2637eba8..1ffc3df3 100644 --- a/src/Api/Model/ShipmentTotalWeightUnitOfMeasurement.php +++ b/src/Api/Model/ShipmentTotalWeightUnitOfMeasurement.php @@ -13,15 +13,15 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code representing the unit of measure associated with the package weight. - - Valid values: - - LBS = Pounds - - KGS = Kilograms. - - * - * @var string - */ + * Code representing the unit of measure associated with the package weight. + * + * Valid values: + * - LBS = Pounds + * - KGS = Kilograms. + * + * + * @var string + */ protected $code; /** * Text description of the code representing the unit of measure associated with the shipment weight. @@ -30,15 +30,15 @@ public function isInitialized($property): bool */ protected $description; /** - * Code representing the unit of measure associated with the package weight. - - Valid values: - - LBS = Pounds - - KGS = Kilograms. - - * - * @return string - */ + * Code representing the unit of measure associated with the package weight. + * + * Valid values: + * - LBS = Pounds + * - KGS = Kilograms. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ShipperAccount.php b/src/Api/Model/ShipperAccount.php index 86c196f9..322cdf82 100644 --- a/src/Api/Model/ShipperAccount.php +++ b/src/Api/Model/ShipperAccount.php @@ -19,11 +19,11 @@ public function isInitialized($property): bool */ protected $accountNumber; /** - * Country or territory code as defined by ISO-3166. - Refer to Country or Terriotry Codes in the Appendix for valid values. - * - * @var string - */ + * Country or territory code as defined by ISO-3166. + * Refer to Country or Terriotry Codes in the Appendix for valid values. + * + * @var string + */ protected $accountCountryCode; /** * UPS account number. Shipper's (requester of the pickup) UPS account number @@ -48,11 +48,11 @@ public function setAccountNumber(string $accountNumber): self return $this; } /** - * Country or territory code as defined by ISO-3166. - Refer to Country or Terriotry Codes in the Appendix for valid values. - * - * @return string - */ + * Country or territory code as defined by ISO-3166. + * Refer to Country or Terriotry Codes in the Appendix for valid values. + * + * @return string + */ public function getAccountCountryCode(): string { return $this->accountCountryCode; diff --git a/src/Api/Model/ShipperAddress.php b/src/Api/Model/ShipperAddress.php index bb3147fd..9c2aeb4e 100644 --- a/src/Api/Model/ShipperAddress.php +++ b/src/Api/Model/ShipperAddress.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The Shipper street address including name and number (when applicable). Up to three occurrences are allowed; only the first is printed on the label. - - 35 characters are accepted, but for the first occurrence, only 30 characters will be printed on the label for return shipments. - - * - * @var list - */ + * The Shipper street address including name and number (when applicable). Up to three occurrences are allowed; only the first is printed on the label. + * + * 35 characters are accepted, but for the first occurrence, only 30 characters will be printed on the label for return shipments. + * + * + * @var list + */ protected $addressLine; /** * Shipper's City. For forward Shipment 30 characters are accepted, but only 15 characters will be printed on the label. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $city; /** - * Shipper's state or province code. - - For forward Shipment 5 characters are accepted, but only 2 characters will be printed on the label. For US, PR and CA accounts, the account must be either a daily pickup account, an occasional account, or a customer B.I.N account. - - * - * @var string - */ + * Shipper's state or province code. + * + * For forward Shipment 5 characters are accepted, but only 2 characters will be printed on the label. For US, PR and CA accounts, the account must be either a daily pickup account, an occasional account, or a customer B.I.N account. + * + * + * @var string + */ protected $stateProvinceCode; /** * Shipper's postal code. @@ -43,24 +43,24 @@ public function isInitialized($property): bool */ protected $postalCode; /** - * Shipper's country or territory code. - - Refer to country or territory Codes in the Appendix for valid values. - - Drop Shipper accounts are valid for return service shipments only if the account is Trade Direct (TD) enabled. - - * - * @var string - */ + * Shipper's country or territory code. + * + * Refer to country or territory Codes in the Appendix for valid values. + * + * Drop Shipper accounts are valid for return service shipments only if the account is Trade Direct (TD) enabled. + * + * + * @var string + */ protected $countryCode; /** - * The Shipper street address including name and number (when applicable). Up to three occurrences are allowed; only the first is printed on the label. - - 35 characters are accepted, but for the first occurrence, only 30 characters will be printed on the label for return shipments. - - * - * @return list - */ + * The Shipper street address including name and number (when applicable). Up to three occurrences are allowed; only the first is printed on the label. + * + * 35 characters are accepted, but for the first occurrence, only 30 characters will be printed on the label for return shipments. + * + * + * @return list + */ public function getAddressLine(): array { return $this->addressLine; @@ -104,13 +104,13 @@ public function setCity(string $city): self return $this; } /** - * Shipper's state or province code. - - For forward Shipment 5 characters are accepted, but only 2 characters will be printed on the label. For US, PR and CA accounts, the account must be either a daily pickup account, an occasional account, or a customer B.I.N account. - - * - * @return string - */ + * Shipper's state or province code. + * + * For forward Shipment 5 characters are accepted, but only 2 characters will be printed on the label. For US, PR and CA accounts, the account must be either a daily pickup account, an occasional account, or a customer B.I.N account. + * + * + * @return string + */ public function getStateProvinceCode(): string { return $this->stateProvinceCode; @@ -154,15 +154,15 @@ public function setPostalCode(string $postalCode): self return $this; } /** - * Shipper's country or territory code. - - Refer to country or territory Codes in the Appendix for valid values. - - Drop Shipper accounts are valid for return service shipments only if the account is Trade Direct (TD) enabled. - - * - * @return string - */ + * Shipper's country or territory code. + * + * Refer to country or territory Codes in the Appendix for valid values. + * + * Drop Shipper accounts are valid for return service shipments only if the account is Trade Direct (TD) enabled. + * + * + * @return string + */ public function getCountryCode(): string { return $this->countryCode; diff --git a/src/Api/Model/ShipperChargeCard.php b/src/Api/Model/ShipperChargeCard.php index 031c3e42..757f7576 100644 --- a/src/Api/Model/ShipperChargeCard.php +++ b/src/Api/Model/ShipperChargeCard.php @@ -19,14 +19,14 @@ public function isInitialized($property): bool */ protected $cardHolderName; /** - * Charge card type. Valid values: - - 01 = American Express - - 03 = Discover - - 04 = Mastercard - - 06 = VISA Discover card Pickup country US only. - * - * @var string - */ + * Charge card type. Valid values: + * - 01 = American Express + * - 03 = Discover + * - 04 = Mastercard + * - 06 = VISA Discover card Pickup country US only. + * + * @var string + */ protected $cardType; /** * Charge card number. For Privileged clients, this element must be tokenized card number. @@ -35,21 +35,21 @@ public function isInitialized($property): bool */ protected $cardNumber; /** - * Credit card expiration date. - Format: yyyyMM - yyyy = 4 digit year, valid value current year - 10 years. - MM = 2 digit month, valid values 01-12 - * - * @var string - */ + * Credit card expiration date. + * Format: yyyyMM + * yyyy = 4 digit year, valid value current year - 10 years. + * MM = 2 digit month, valid values 01-12 + * + * @var string + */ protected $expirationDate; /** - * Three or four digits that can be found either on top of credit card number or on the back of credit card. - Number of digits varies for different type of credit card. Valid values are 3 or 4 digits. - Security code is required if credit card information is provided. - * - * @var string - */ + * Three or four digits that can be found either on top of credit card number or on the back of credit card. + * Number of digits varies for different type of credit card. Valid values are 3 or 4 digits. + * Security code is required if credit card information is provided. + * + * @var string + */ protected $securityCode; /** * Container to hold the Charge card address. @@ -80,14 +80,14 @@ public function setCardHolderName(string $cardHolderName): self return $this; } /** - * Charge card type. Valid values: - - 01 = American Express - - 03 = Discover - - 04 = Mastercard - - 06 = VISA Discover card Pickup country US only. - * - * @return string - */ + * Charge card type. Valid values: + * - 01 = American Express + * - 03 = Discover + * - 04 = Mastercard + * - 06 = VISA Discover card Pickup country US only. + * + * @return string + */ public function getCardType(): string { return $this->cardType; @@ -132,13 +132,13 @@ public function setCardNumber(string $cardNumber): self return $this; } /** - * Credit card expiration date. - Format: yyyyMM - yyyy = 4 digit year, valid value current year - 10 years. - MM = 2 digit month, valid values 01-12 - * - * @return string - */ + * Credit card expiration date. + * Format: yyyyMM + * yyyy = 4 digit year, valid value current year - 10 years. + * MM = 2 digit month, valid values 01-12 + * + * @return string + */ public function getExpirationDate(): string { return $this->expirationDate; @@ -160,12 +160,12 @@ public function setExpirationDate(string $expirationDate): self return $this; } /** - * Three or four digits that can be found either on top of credit card number or on the back of credit card. - Number of digits varies for different type of credit card. Valid values are 3 or 4 digits. - Security code is required if credit card information is provided. - * - * @return string - */ + * Three or four digits that can be found either on top of credit card number or on the back of credit card. + * Number of digits varies for different type of credit card. Valid values are 3 or 4 digits. + * Security code is required if credit card information is provided. + * + * @return string + */ public function getSecurityCode(): string { return $this->securityCode; diff --git a/src/Api/Model/ShipperPhone.php b/src/Api/Model/ShipperPhone.php index 583507ef..3c346533 100644 --- a/src/Api/Model/ShipperPhone.php +++ b/src/Api/Model/ShipperPhone.php @@ -13,19 +13,19 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Shipper's phone Number. Valid values are 0 - 9. - - If Shipper country or territory is US, PR, CA, and VI, the layout is: - area code, 7 digit PhoneNumber or - area code, 7 digit PhoneNumber, 4 digit extension number. - - For other countries or territories, the layout is: country or territory code, area code, 7 digit number. - - A phone number is required if destination is international. - - * - * @var string - */ + * Shipper's phone Number. Valid values are 0 - 9. + * + * If Shipper country or territory is US, PR, CA, and VI, the layout is: + * area code, 7 digit PhoneNumber or + * area code, 7 digit PhoneNumber, 4 digit extension number. + * + * For other countries or territories, the layout is: country or territory code, area code, 7 digit number. + * + * A phone number is required if destination is international. + * + * + * @var string + */ protected $number; /** * Shipper's phone extension. @@ -34,19 +34,19 @@ public function isInitialized($property): bool */ protected $extension; /** - * Shipper's phone Number. Valid values are 0 - 9. - - If Shipper country or territory is US, PR, CA, and VI, the layout is: - area code, 7 digit PhoneNumber or - area code, 7 digit PhoneNumber, 4 digit extension number. - - For other countries or territories, the layout is: country or territory code, area code, 7 digit number. - - A phone number is required if destination is international. - - * - * @return string - */ + * Shipper's phone Number. Valid values are 0 - 9. + * + * If Shipper country or territory is US, PR, CA, and VI, the layout is: + * area code, 7 digit PhoneNumber or + * area code, 7 digit PhoneNumber, 4 digit extension number. + * + * For other countries or territories, the layout is: country or territory code, area code, 7 digit number. + * + * A phone number is required if destination is international. + * + * + * @return string + */ public function getNumber(): string { return $this->number; diff --git a/src/Api/Model/ShippingAvailabilityUnavailableReason.php b/src/Api/Model/ShippingAvailabilityUnavailableReason.php index c835b4db..be2d796c 100644 --- a/src/Api/Model/ShippingAvailabilityUnavailableReason.php +++ b/src/Api/Model/ShippingAvailabilityUnavailableReason.php @@ -13,17 +13,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code for shipping unavailability. Code for DCR/DCO unavailability. - - Valid values: - - 01 - Temporarily Unavailable - - 02 - Location Full - - 03 - Unavailable - - 04 - Weather - - * - * @var string - */ + * Code for shipping unavailability. Code for DCR/DCO unavailability. + * + * Valid values: + * - 01 - Temporarily Unavailable + * - 02 - Location Full + * - 03 - Unavailable + * - 04 - Weather + * + * + * @var string + */ protected $code; /** * Description for shipping unavailability. @@ -32,17 +32,17 @@ public function isInitialized($property): bool */ protected $description; /** - * Code for shipping unavailability. Code for DCR/DCO unavailability. - - Valid values: - - 01 - Temporarily Unavailable - - 02 - Location Full - - 03 - Unavailable - - 04 - Weather - - * - * @return string - */ + * Code for shipping unavailability. Code for DCR/DCO unavailability. + * + * Valid values: + * - 01 - Temporarily Unavailable + * - 02 - Location Full + * - 03 - Unavailable + * - 04 - Weather + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/ShippingReceiptImageFormat.php b/src/Api/Model/ShippingReceiptImageFormat.php index ba45567e..5cfed79b 100644 --- a/src/Api/Model/ShippingReceiptImageFormat.php +++ b/src/Api/Model/ShippingReceiptImageFormat.php @@ -13,12 +13,12 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code representing the format in which a receipt is delivered. Valid values: - - HTML = HTML format - - * - * @var string - */ + * Code representing the format in which a receipt is delivered. Valid values: + * - HTML = HTML format + * + * + * @var string + */ protected $code; /** * Description of the image format code. @@ -27,12 +27,12 @@ public function isInitialized($property): bool */ protected $description; /** - * Code representing the format in which a receipt is delivered. Valid values: - - HTML = HTML format - - * - * @return string - */ + * Code representing the format in which a receipt is delivered. Valid values: + * - HTML = HTML format + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/StandardHoursDayOfWeek.php b/src/Api/Model/StandardHoursDayOfWeek.php index 8f560874..d89a8cf1 100644 --- a/src/Api/Model/StandardHoursDayOfWeek.php +++ b/src/Api/Model/StandardHoursDayOfWeek.php @@ -13,18 +13,18 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Day of week. - Valid values: - 1-Sunday - 2-Monday - 3-Tuesday - 4-Wednesday - 5-Thursday - 6-Friday - 7-Saturday. - * - * @var string - */ + * Day of week. + * Valid values: + * 1-Sunday + * 2-Monday + * 3-Tuesday + * 4-Wednesday + * 5-Thursday + * 6-Friday + * 7-Saturday. + * + * @var string + */ protected $day; /** * Open time of a location in military format (HHMM) e.g. 930, 1700, 1845 etc. with exception for midnight. For midnight the time will be returned as 0. @@ -63,18 +63,18 @@ public function isInitialized($property): bool */ protected $open24HoursIndicator; /** - * Day of week. - Valid values: - 1-Sunday - 2-Monday - 3-Tuesday - 4-Wednesday - 5-Thursday - 6-Friday - 7-Saturday. - * - * @return string - */ + * Day of week. + * Valid values: + * 1-Sunday + * 2-Monday + * 3-Tuesday + * 4-Wednesday + * 5-Thursday + * 6-Friday + * 7-Saturday. + * + * @return string + */ public function getDay(): string { return $this->day; diff --git a/src/Api/Model/SubscriptionEventsDateRange.php b/src/Api/Model/SubscriptionEventsDateRange.php index 36151a6f..188f5363 100644 --- a/src/Api/Model/SubscriptionEventsDateRange.php +++ b/src/Api/Model/SubscriptionEventsDateRange.php @@ -13,25 +13,25 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Beginning date time of subscription requested by user. - Format: MM-DD-YYYY-HH-MM - * - * @var string - */ + * Beginning date time of subscription requested by user. + * Format: MM-DD-YYYY-HH-MM + * + * @var string + */ protected $beginDate; /** - * Ending date time of subscription requested by user. - Format: MM-DD-YYYY-HH-MM - * - * @var string - */ + * Ending date time of subscription requested by user. + * Format: MM-DD-YYYY-HH-MM + * + * @var string + */ protected $endDate; /** - * Beginning date time of subscription requested by user. - Format: MM-DD-YYYY-HH-MM - * - * @return string - */ + * Beginning date time of subscription requested by user. + * Format: MM-DD-YYYY-HH-MM + * + * @return string + */ public function getBeginDate(): string { return $this->beginDate; @@ -51,11 +51,11 @@ public function setBeginDate(string $beginDate): self return $this; } /** - * Ending date time of subscription requested by user. - Format: MM-DD-YYYY-HH-MM - * - * @return string - */ + * Ending date time of subscription requested by user. + * Format: MM-DD-YYYY-HH-MM + * + * @return string + */ public function getEndDate(): string { return $this->endDate; diff --git a/src/Api/Model/SubscriptionEventsSubscriptionFile.php b/src/Api/Model/SubscriptionEventsSubscriptionFile.php index b97f6569..b6ba3949 100644 --- a/src/Api/Model/SubscriptionEventsSubscriptionFile.php +++ b/src/Api/Model/SubscriptionEventsSubscriptionFile.php @@ -13,11 +13,11 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * File name belonging to specific subscription requested by user. - Format: YYMMDD_HHmmssnnn - * - * @var string - */ + * File name belonging to specific subscription requested by user. + * Format: YYMMDD_HHmmssnnn + * + * @var string + */ protected $fileName; /** * Container that displays whether the file is read or unread. @@ -27,45 +27,55 @@ public function isInitialized($property): bool protected $statusType; /** * Container represents all data that is relevant for the shipment, such as origin, destination, shipper, payment method etc. It will be returned when available. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $manifest; /** * Information about shipment's origin. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $origin; /** * Shipment exception data. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $exception; /** * Container for delivery information. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $delivery; /** * Container for generic record information. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $generic; /** - * File name belonging to specific subscription requested by user. - Format: YYMMDD_HHmmssnnn - * - * @return string - */ + * File name belonging to specific subscription requested by user. + * Format: YYMMDD_HHmmssnnn + * + * @return string + */ public function getFileName(): string { return $this->fileName; @@ -108,7 +118,9 @@ public function setStatusType(SubscriptionFileStatusType $statusType): self } /** * Container represents all data that is relevant for the shipment, such as origin, destination, shipper, payment method etc. It will be returned when available. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -132,7 +144,9 @@ public function setManifest(array $manifest): self } /** * Information about shipment's origin. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -156,7 +170,9 @@ public function setOrigin(array $origin): self } /** * Shipment exception data. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -180,7 +196,9 @@ public function setException(array $exception): self } /** * Container for delivery information. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -204,7 +222,9 @@ public function setDelivery(array $delivery): self } /** * Container for generic record information. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/SubscriptionEventsSubscriptionStatus.php b/src/Api/Model/SubscriptionEventsSubscriptionStatus.php index 425b093c..10d0b732 100644 --- a/src/Api/Model/SubscriptionEventsSubscriptionStatus.php +++ b/src/Api/Model/SubscriptionEventsSubscriptionStatus.php @@ -13,43 +13,43 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Status types of subscription. Valid values: - - UN – Unknown - - AT – Activate - - P – Pending - - A –Active - - I – Inactive - - S - Suspended - - * - * @var string - */ + * Status types of subscription. Valid values: + * - UN – Unknown + * - AT – Activate + * - P – Pending + * - A –Active + * - I – Inactive + * - S - Suspended + * + * + * @var string + */ protected $code; /** - * Description of a subscription. - Valid values: - - Unknown (Unknown subscription status) - - Activate (Ready for the user to activate the subscription) - - Pending (In the process of waiting for privilege requests authorization) - - Active (The subscription is in good standing and is active.) - - Inactive (The subscriber puts the subscription on hold.) - - Suspended (UPS disables the subscription.) - * - * @var string - */ + * Description of a subscription. + * Valid values: + * - Unknown (Unknown subscription status) + * - Activate (Ready for the user to activate the subscription) + * - Pending (In the process of waiting for privilege requests authorization) + * - Active (The subscription is in good standing and is active.) + * - Inactive (The subscriber puts the subscription on hold.) + * - Suspended (UPS disables the subscription.) + * + * @var string + */ protected $description; /** - * Status types of subscription. Valid values: - - UN – Unknown - - AT – Activate - - P – Pending - - A –Active - - I – Inactive - - S - Suspended - - * - * @return string - */ + * Status types of subscription. Valid values: + * - UN – Unknown + * - AT – Activate + * - P – Pending + * - A –Active + * - I – Inactive + * - S - Suspended + * + * + * @return string + */ public function getCode(): string { return $this->code; @@ -75,17 +75,17 @@ public function setCode(string $code): self return $this; } /** - * Description of a subscription. - Valid values: - - Unknown (Unknown subscription status) - - Activate (Ready for the user to activate the subscription) - - Pending (In the process of waiting for privilege requests authorization) - - Active (The subscription is in good standing and is active.) - - Inactive (The subscriber puts the subscription on hold.) - - Suspended (UPS disables the subscription.) - * - * @return string - */ + * Description of a subscription. + * Valid values: + * - Unknown (Unknown subscription status) + * - Activate (Ready for the user to activate the subscription) + * - Pending (In the process of waiting for privilege requests authorization) + * - Active (The subscription is in good standing and is active.) + * - Inactive (The subscriber puts the subscription on hold.) + * - Suspended (UPS disables the subscription.) + * + * @return string + */ public function getDescription(): string { return $this->description; diff --git a/src/Api/Model/SubscriptionFileDelivery.php b/src/Api/Model/SubscriptionFileDelivery.php index 6b73a495..0660ba70 100644 --- a/src/Api/Model/SubscriptionFileDelivery.php +++ b/src/Api/Model/SubscriptionFileDelivery.php @@ -14,14 +14,18 @@ public function isInitialized($property): bool } /** * Package-level reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $packageReferenceNumber; /** * Container tag for shipment reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -94,7 +98,9 @@ public function isInitialized($property): bool protected $accessPointLocationID; /** * Package-level reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -118,7 +124,9 @@ public function setPackageReferenceNumber(array $packageReferenceNumber): self } /** * Container tag for shipment reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/SubscriptionFileException.php b/src/Api/Model/SubscriptionFileException.php index 06e43f47..4fbc9e66 100644 --- a/src/Api/Model/SubscriptionFileException.php +++ b/src/Api/Model/SubscriptionFileException.php @@ -14,14 +14,18 @@ public function isInitialized($property): bool } /** * Package-level reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $packageReferenceNumber; /** * Container tag for shipment reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -118,7 +122,9 @@ public function isInitialized($property): bool protected $accessPointLocationID; /** * Package-level reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -142,7 +148,9 @@ public function setPackageReferenceNumber(array $packageReferenceNumber): self } /** * Container tag for shipment reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/SubscriptionFileGeneric.php b/src/Api/Model/SubscriptionFileGeneric.php index 566ecefe..aec02d6f 100644 --- a/src/Api/Model/SubscriptionFileGeneric.php +++ b/src/Api/Model/SubscriptionFileGeneric.php @@ -13,26 +13,26 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Unique identifier that defines the type of activity. - - VM = Void for Manifest - - UR = Undeliverable Returns - - IR = Invoice Removal Successful - - TC = Transport Company USPS scan PS = 'Postal Service Possession Scan' - - FN = UPS Access Point/Alternate Delivery Location Email Notification Failure - - DS = Destination Scan - - AG = Package is in transit to a UPS facility - - RE = UPS Returns Exchange - - RP = Retail Pickup - - UD = Updated delivery date - - OD = Out for Delivery - - SD = Scheduled for Delivery - - FM = Tendered to FMP - - PT = UPS Courier Handoff (Package Tendered) DIALS -VX - - PC = UPS Courier Confirmation – XPLD -VX - - * - * @var string - */ + * Unique identifier that defines the type of activity. + * - VM = Void for Manifest + * - UR = Undeliverable Returns + * - IR = Invoice Removal Successful + * - TC = Transport Company USPS scan PS = 'Postal Service Possession Scan' + * - FN = UPS Access Point/Alternate Delivery Location Email Notification Failure + * - DS = Destination Scan + * - AG = Package is in transit to a UPS facility + * - RE = UPS Returns Exchange + * - RP = Retail Pickup + * - UD = Updated delivery date + * - OD = Out for Delivery + * - SD = Scheduled for Delivery + * - FM = Tendered to FMP + * - PT = UPS Courier Handoff (Package Tendered) DIALS -VX + * - PC = UPS Courier Confirmation – XPLD -VX + * + * + * @var string + */ protected $activityType; /** * Package's tracking number. @@ -48,14 +48,18 @@ public function isInitialized($property): bool protected $shipperNumber; /** * Container tag for shipment reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $shipmentReferenceNumber; /** * Package-level reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -85,15 +89,15 @@ public function isInitialized($property): bool */ protected $shipTo; /** - * If Activity Type is "DS" or "UD", this element will contain Rescheduled Delivery Date. Format will be YYYYMMDD. - - If Activity Type is "OD", this element will contain Rescheduled Delivery Date. Format will be YYYYMMDD. - - If Activity Type is "SD", this element will contain agreed upon date with Customer for delivery Date. Format will be YYYYMMDD. - - * - * @var string - */ + * If Activity Type is "DS" or "UD", this element will contain Rescheduled Delivery Date. Format will be YYYYMMDD. + * + * If Activity Type is "OD", this element will contain Rescheduled Delivery Date. Format will be YYYYMMDD. + * + * If Activity Type is "SD", this element will contain agreed upon date with Customer for delivery Date. Format will be YYYYMMDD. + * + * + * @var string + */ protected $rescheduledDeliveryDate; /** * Failure notification information containing email address and Notification code @@ -102,26 +106,26 @@ public function isInitialized($property): bool */ protected $failureNotification; /** - * Unique identifier that defines the type of activity. - - VM = Void for Manifest - - UR = Undeliverable Returns - - IR = Invoice Removal Successful - - TC = Transport Company USPS scan PS = 'Postal Service Possession Scan' - - FN = UPS Access Point/Alternate Delivery Location Email Notification Failure - - DS = Destination Scan - - AG = Package is in transit to a UPS facility - - RE = UPS Returns Exchange - - RP = Retail Pickup - - UD = Updated delivery date - - OD = Out for Delivery - - SD = Scheduled for Delivery - - FM = Tendered to FMP - - PT = UPS Courier Handoff (Package Tendered) DIALS -VX - - PC = UPS Courier Confirmation – XPLD -VX - - * - * @return string - */ + * Unique identifier that defines the type of activity. + * - VM = Void for Manifest + * - UR = Undeliverable Returns + * - IR = Invoice Removal Successful + * - TC = Transport Company USPS scan PS = 'Postal Service Possession Scan' + * - FN = UPS Access Point/Alternate Delivery Location Email Notification Failure + * - DS = Destination Scan + * - AG = Package is in transit to a UPS facility + * - RE = UPS Returns Exchange + * - RP = Retail Pickup + * - UD = Updated delivery date + * - OD = Out for Delivery + * - SD = Scheduled for Delivery + * - FM = Tendered to FMP + * - PT = UPS Courier Handoff (Package Tendered) DIALS -VX + * - PC = UPS Courier Confirmation – XPLD -VX + * + * + * @return string + */ public function getActivityType(): string { return $this->activityType; @@ -201,7 +205,9 @@ public function setShipperNumber(string $shipperNumber): self } /** * Container tag for shipment reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -225,7 +231,9 @@ public function setShipmentReferenceNumber(array $shipmentReferenceNumber): self } /** * Package-level reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -336,15 +344,15 @@ public function setShipTo(GenericShipTo $shipTo): self return $this; } /** - * If Activity Type is "DS" or "UD", this element will contain Rescheduled Delivery Date. Format will be YYYYMMDD. - - If Activity Type is "OD", this element will contain Rescheduled Delivery Date. Format will be YYYYMMDD. - - If Activity Type is "SD", this element will contain agreed upon date with Customer for delivery Date. Format will be YYYYMMDD. - - * - * @return string - */ + * If Activity Type is "DS" or "UD", this element will contain Rescheduled Delivery Date. Format will be YYYYMMDD. + * + * If Activity Type is "OD", this element will contain Rescheduled Delivery Date. Format will be YYYYMMDD. + * + * If Activity Type is "SD", this element will contain agreed upon date with Customer for delivery Date. Format will be YYYYMMDD. + * + * + * @return string + */ public function getRescheduledDeliveryDate(): string { return $this->rescheduledDeliveryDate; diff --git a/src/Api/Model/SubscriptionFileManifest.php b/src/Api/Model/SubscriptionFileManifest.php index fca59695..2ef7a81a 100644 --- a/src/Api/Model/SubscriptionFileManifest.php +++ b/src/Api/Model/SubscriptionFileManifest.php @@ -26,7 +26,9 @@ public function isInitialized($property): bool protected $shipTo; /** * Shipment-level reference numbers. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -56,19 +58,21 @@ public function isInitialized($property): bool */ protected $scheduledDeliveryTime; /** - * If the tag is present then the shipment is a document, otherwise the shipment is a non-document. Valid values: - - 1 = Letter - - 2 = Document (Non-Letter Document) - - 3 = Non-Document - - 4 = Pallet - - * - * @var string - */ + * If the tag is present then the shipment is a document, otherwise the shipment is a non-document. Valid values: + * - 1 = Letter + * - 2 = Document (Non-Letter Document) + * - 3 = Non-Document + * - 4 = Pallet + * + * + * @var string + */ protected $documentsOnly; /** * Defines a package. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -104,20 +108,20 @@ public function isInitialized($property): bool */ protected $specialInstructions; /** - * Shipment charge type. - Valid values: - C/F - Cost and Freight - C/B - Consignee Billed Package - F/C - Freight Collect - DDP - Delivered Duty Paid - VAT Unpaid - FOB - Free On Board - P/P - Prepaid - F/D - Free Domicile - T/P - Third Party Billing - * - * @var string - */ + * Shipment charge type. + * Valid values: + * C/F - Cost and Freight + * C/B - Consignee Billed Package + * F/C - Freight Collect + * DDP - Delivered Duty Paid + * VAT Unpaid + * FOB - Free On Board + * P/P - Prepaid + * F/D - Free Domicile + * T/P - Third Party Billing + * + * @var string + */ protected $shipmentChargeType; /** * The information provided within this container identifies the shipper number and billing option the user specified to view during the subscription process. @@ -324,14 +328,14 @@ public function isInitialized($property): bool */ protected $uPSPremierAccessorialIndicator; /** - * Indicates the UPS Premier category applied to the package Valid values: - - 'PRS' – UPS Premier Silver - - 'PRG' – UPS Premier Gold - - 'PRP' - UPS Premier Platinum - - * - * @var string - */ + * Indicates the UPS Premier category applied to the package Valid values: + * - 'PRS' – UPS Premier Silver + * - 'PRG' – UPS Premier Gold + * - 'PRP' - UPS Premier Platinum + * + * + * @var string + */ protected $uPSPremierCategoryCode; /** * Shipper's record for a shipment. @@ -379,7 +383,9 @@ public function setShipTo(ManifestShipTo $shipTo): self } /** * Shipment-level reference numbers. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -490,15 +496,15 @@ public function setScheduledDeliveryTime(string $scheduledDeliveryTime): self return $this; } /** - * If the tag is present then the shipment is a document, otherwise the shipment is a non-document. Valid values: - - 1 = Letter - - 2 = Document (Non-Letter Document) - - 3 = Non-Document - - 4 = Pallet - - * - * @return string - */ + * If the tag is present then the shipment is a document, otherwise the shipment is a non-document. Valid values: + * - 1 = Letter + * - 2 = Document (Non-Letter Document) + * - 3 = Non-Document + * - 4 = Pallet + * + * + * @return string + */ public function getDocumentsOnly(): string { return $this->documentsOnly; @@ -523,7 +529,9 @@ public function setDocumentsOnly(string $documentsOnly): self } /** * Defines a package. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -656,20 +664,20 @@ public function setSpecialInstructions(string $specialInstructions): self return $this; } /** - * Shipment charge type. - Valid values: - C/F - Cost and Freight - C/B - Consignee Billed Package - F/C - Freight Collect - DDP - Delivered Duty Paid - VAT Unpaid - FOB - Free On Board - P/P - Prepaid - F/D - Free Domicile - T/P - Third Party Billing - * - * @return string - */ + * Shipment charge type. + * Valid values: + * C/F - Cost and Freight + * C/B - Consignee Billed Package + * F/C - Freight Collect + * DDP - Delivered Duty Paid + * VAT Unpaid + * FOB - Free On Board + * P/P - Prepaid + * F/D - Free Domicile + * T/P - Third Party Billing + * + * @return string + */ public function getShipmentChargeType(): string { return $this->shipmentChargeType; @@ -1446,14 +1454,14 @@ public function setUPSPremierAccessorialIndicator(string $uPSPremierAccessorialI return $this; } /** - * Indicates the UPS Premier category applied to the package Valid values: - - 'PRS' – UPS Premier Silver - - 'PRG' – UPS Premier Gold - - 'PRP' - UPS Premier Platinum - - * - * @return string - */ + * Indicates the UPS Premier category applied to the package Valid values: + * - 'PRS' – UPS Premier Silver + * - 'PRG' – UPS Premier Gold + * - 'PRP' - UPS Premier Platinum + * + * + * @return string + */ public function getUPSPremierCategoryCode(): string { return $this->uPSPremierCategoryCode; diff --git a/src/Api/Model/SubscriptionFileOrigin.php b/src/Api/Model/SubscriptionFileOrigin.php index 1af3d603..e08026d7 100644 --- a/src/Api/Model/SubscriptionFileOrigin.php +++ b/src/Api/Model/SubscriptionFileOrigin.php @@ -14,14 +14,18 @@ public function isInitialized($property): bool } /** * Package-level reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $packageReferenceNumber; /** * Container tag for shipment reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -76,7 +80,9 @@ public function isInitialized($property): bool protected $scheduledDeliveryTime; /** * Package-level reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ @@ -100,7 +106,9 @@ public function setPackageReferenceNumber(array $packageReferenceNumber): self } /** * Container tag for shipment reference number. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/SubscriptionFileStatusType.php b/src/Api/Model/SubscriptionFileStatusType.php index 0c585f57..8af0d742 100644 --- a/src/Api/Model/SubscriptionFileStatusType.php +++ b/src/Api/Model/SubscriptionFileStatusType.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Status types of subscription file. Valid values: - - R – Read - - U - Unread - - * - * @var string - */ + * Status types of subscription file. Valid values: + * - R – Read + * - U - Unread + * + * + * @var string + */ protected $code; /** * Description of a subscription file. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $description; /** - * Status types of subscription file. Valid values: - - R – Read - - U - Unread - - * - * @return string - */ + * Status types of subscription file. Valid values: + * - R – Read + * - U - Unread + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/TimeInTransitRequest.php b/src/Api/Model/TimeInTransitRequest.php index 3b488a99..b2846ca3 100644 --- a/src/Api/Model/TimeInTransitRequest.php +++ b/src/Api/Model/TimeInTransitRequest.php @@ -13,19 +13,19 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * The country code of the origin shipment. - Valid Values: - Must conform to the ISO-defined, two-letter country or territory codes. Refer to Country or Territory Codes in the Appendix above for valid values. - * - * @var string - */ + * The country code of the origin shipment. + * Valid Values: + * Must conform to the ISO-defined, two-letter country or territory codes. Refer to Country or Territory Codes in the Appendix above for valid values. + * + * @var string + */ protected $originCountryCode; /** - * The shipment origin state or province. For U.S. addresses, the value must be a valid 2-character value (per U.S. Mail standards) - For non-U.S. addresses the full State or Province name should be provided. - * - * @var string - */ + * The shipment origin state or province. For U.S. addresses, the value must be a valid 2-character value (per U.S. Mail standards) + * For non-U.S. addresses the full State or Province name should be provided. + * + * @var string + */ protected $originStateProvince; /** * The shipment origin city. Required for International requests for those countries that do not utilize postal codes. @@ -40,26 +40,26 @@ public function isInitialized($property): bool */ protected $originTownName; /** - * Required for Domestic requests. The shipment origin postal code. - Either the 5, or 9-digit US zip codes must be used for U.S. addresses. For non-U.S. addresses, this is recommended for all countries that utilize postal codes. - * - * @var string - */ + * Required for Domestic requests. The shipment origin postal code. + * Either the 5, or 9-digit US zip codes must be used for U.S. addresses. For non-U.S. addresses, this is recommended for all countries that utilize postal codes. + * + * @var string + */ protected $originPostalCode; /** - * The country code of the destination. - Valid values: - Must conform to ISO-defined country codes. - * - * @var string - */ + * The country code of the destination. + * Valid values: + * Must conform to ISO-defined country codes. + * + * @var string + */ protected $destinationCountryCode; /** - * The shipment destination state or province. For U.S. addresses, the value must be a valid 2-character value (per U.S. Mail standards). - For non-U.S. addresses the full State or Province name should be provided. - * - * @var string - */ + * The shipment destination state or province. For U.S. addresses, the value must be a valid 2-character value (per U.S. Mail standards). + * For non-U.S. addresses the full State or Province name should be provided. + * + * @var string + */ protected $destinationStateProvince; /** * The shipment destination city. Required for International Requests for those countries that do not utilize postal codes. @@ -74,106 +74,106 @@ public function isInitialized($property): bool */ protected $destinationTownName; /** - * The shipment destination postal code. - Required for Domestic requests. Either 5, or 9-digit U.S. zip codes must be used for U.S. addresses. For non-U.S. addresses, this is recommended for all countries that utilize postal codes. - * - * @var string - */ + * The shipment destination postal code. + * Required for Domestic requests. Either 5, or 9-digit U.S. zip codes must be used for U.S. addresses. For non-U.S. addresses, this is recommended for all countries that utilize postal codes. + * + * @var string + */ protected $destinationPostalCode; /** - * Indicates if address is residential or commercial. Required for Domestic requests. - - Valid values: "01", "02" - - 01 = Residential - 02 = Commercial - - Defaults to commercial for International Requests. - * - * @var string - */ + * Indicates if address is residential or commercial. Required for Domestic requests. + * + * Valid values: "01", "02" + * + * 01 = Residential + * 02 = Commercial + * + * Defaults to commercial for International Requests. + * + * @var string + */ protected $residentialIndicator; /** - * The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). Allowed range is up to 60 days in future and 35 days in past. This date may or may not be the UPS business date. - - Format is YYYY-MM-DD. - - YYYY = 4 digit year; - - MM = 2 digit month, valid values 01-12; - - DD = 2 digit day of month, valid values 01-31 - If no value is provided, defaults to current system date. - * - * @var string - */ + * The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). Allowed range is up to 60 days in future and 35 days in past. This date may or may not be the UPS business date. + * + * Format is YYYY-MM-DD. + * + * YYYY = 4 digit year; + * + * MM = 2 digit month, valid values 01-12; + * + * DD = 2 digit day of month, valid values 01-31 + * If no value is provided, defaults to current system date. + * + * @var string + */ protected $shipDate; /** - * The time the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). - Format is HH:MM:SS - - Defaults to current time if not provided. - * - * @var string - */ + * The time the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). + * Format is HH:MM:SS + * + * Defaults to current time if not provided. + * + * @var string + */ protected $shipTime; /** - * The weight of the shipment. Required for International requests. - - Note: If decimal values are used, valid values will be rounded to the tenths. - - Note: Maximum value is 70 kilograms or 150 pounds. - * - * @var float - */ + * The weight of the shipment. Required for International requests. + * + * Note: If decimal values are used, valid values will be rounded to the tenths. + * + * Note: Maximum value is 70 kilograms or 150 pounds. + * + * @var float + */ protected $weight; /** - * Required for International requests and when weight value is provided. - - Valid Values: "LBS", "KGS" - * - * @var string - */ + * Required for International requests and when weight value is provided. + * + * Valid Values: "LBS", "KGS" + * + * @var string + */ protected $weightUnitOfMeasure; /** - * The monetary value of shipment contents. - - Required when origin country does not equal destination country and BillType is 03 (non-documented) or 04 (WWEF) - - Required when origin country does not equal destination country, and destination country = CA, and BillType = 02 (document). - - Note: If decimal values are used, valid values will be rounded to the tenths. - * - * @var float - */ + * The monetary value of shipment contents. + * + * Required when origin country does not equal destination country and BillType is 03 (non-documented) or 04 (WWEF) + * + * Required when origin country does not equal destination country, and destination country = CA, and BillType = 02 (document). + * + * Note: If decimal values are used, valid values will be rounded to the tenths. + * + * @var float + */ protected $shipmentContentsValue; /** - * The unit of currency used for values. Required if ShipmentContentsValue is populated. - Valid value: must conform to ISO standards. - * - * @var string - */ + * The unit of currency used for values. Required if ShipmentContentsValue is populated. + * Valid value: must conform to ISO standards. + * + * @var string + */ protected $shipmentContentsCurrencyCode; /** - * Required for International Requests. - Valid values: "02","03","04" - 02 - Document - 03 - Non Document - 04 - WWEF (Pallet) - * - * @var string - */ + * Required for International Requests. + * Valid values: "02","03","04" + * 02 - Document + * 03 - Non Document + * 04 - WWEF (Pallet) + * + * @var string + */ protected $billType; /** - * Used to bypass address validation when the address has already been validated by the calling application. - - Valid values: true, false - - Defaults to true - Note: not to be exposed to external customers. - * - * @var bool - */ + * Used to bypass address validation when the address has already been validated by the calling application. + * + * Valid values: true, false + * + * Defaults to true + * Note: not to be exposed to external customers. + * + * @var bool + */ protected $avvFlag; /** * Sets the number of packages in shipment. Default value is 1. @@ -182,54 +182,54 @@ public function isInitialized($property): bool */ protected $numberOfPackages; /** - * Sets the indicator for an international Freight Pallet shipment that is going to be dropped off by shipper to a UPS facility. The indicator is used when the Bill Type is "04". - - Valid values: "0", "1". - - 0 = WWDTProcessIF.PICKUP_BY_UPS - 1 = WWDTProcessIf.DROPOFF_BY_SHIPPER - - The default value is "0" - * - * @var int - */ + * Sets the indicator for an international Freight Pallet shipment that is going to be dropped off by shipper to a UPS facility. The indicator is used when the Bill Type is "04". + * + * Valid values: "0", "1". + * + * 0 = WWDTProcessIF.PICKUP_BY_UPS + * 1 = WWDTProcessIf.DROPOFF_BY_SHIPPER + * + * The default value is "0" + * + * @var int + */ protected $dropOffAtFacilityIndicator; /** - * Sets the indicator for an international Freight Pallet shipment that is going to be pick-up by consignee in a destination facility. The indicator is used when the Bill Type is "04". - - Valid values: "0", "1". - - 0 = WWDTProcessIF.DELIVERY_BY_UPS - 1 = WWDTProcessIf.PICKUP_BY_CONSIGNEE - - The default value is "0" - * - * @var int - */ + * Sets the indicator for an international Freight Pallet shipment that is going to be pick-up by consignee in a destination facility. The indicator is used when the Bill Type is "04". + * + * Valid values: "0", "1". + * + * 0 = WWDTProcessIF.DELIVERY_BY_UPS + * 1 = WWDTProcessIf.PICKUP_BY_CONSIGNEE + * + * The default value is "0" + * + * @var int + */ protected $holdForPickupIndicator; /** - * Used to get back a full list of services - bypassing current WWDT business rules to remove services from the list being returned to clients for US domestic that are slower than UPS Ground. - - Default value is false. - * - * @var bool - */ + * Used to get back a full list of services - bypassing current WWDT business rules to remove services from the list being returned to clients for US domestic that are slower than UPS Ground. + * + * Default value is false. + * + * @var bool + */ protected $returnUnfilterdServices; /** - * Sets the limit for the number of candidates returned in candidate list. - - Default value is 200. - * - * @var int - */ + * Sets the limit for the number of candidates returned in candidate list. + * + * Default value is 200. + * + * @var int + */ protected $maxList; /** - * The country code of the origin shipment. - Valid Values: - Must conform to the ISO-defined, two-letter country or territory codes. Refer to Country or Territory Codes in the Appendix above for valid values. - * - * @return string - */ + * The country code of the origin shipment. + * Valid Values: + * Must conform to the ISO-defined, two-letter country or territory codes. Refer to Country or Territory Codes in the Appendix above for valid values. + * + * @return string + */ public function getOriginCountryCode(): string { return $this->originCountryCode; @@ -250,11 +250,11 @@ public function setOriginCountryCode(string $originCountryCode): self return $this; } /** - * The shipment origin state or province. For U.S. addresses, the value must be a valid 2-character value (per U.S. Mail standards) - For non-U.S. addresses the full State or Province name should be provided. - * - * @return string - */ + * The shipment origin state or province. For U.S. addresses, the value must be a valid 2-character value (per U.S. Mail standards) + * For non-U.S. addresses the full State or Province name should be provided. + * + * @return string + */ public function getOriginStateProvince(): string { return $this->originStateProvince; @@ -318,11 +318,11 @@ public function setOriginTownName(string $originTownName): self return $this; } /** - * Required for Domestic requests. The shipment origin postal code. - Either the 5, or 9-digit US zip codes must be used for U.S. addresses. For non-U.S. addresses, this is recommended for all countries that utilize postal codes. - * - * @return string - */ + * Required for Domestic requests. The shipment origin postal code. + * Either the 5, or 9-digit US zip codes must be used for U.S. addresses. For non-U.S. addresses, this is recommended for all countries that utilize postal codes. + * + * @return string + */ public function getOriginPostalCode(): string { return $this->originPostalCode; @@ -342,12 +342,12 @@ public function setOriginPostalCode(string $originPostalCode): self return $this; } /** - * The country code of the destination. - Valid values: - Must conform to ISO-defined country codes. - * - * @return string - */ + * The country code of the destination. + * Valid values: + * Must conform to ISO-defined country codes. + * + * @return string + */ public function getDestinationCountryCode(): string { return $this->destinationCountryCode; @@ -368,11 +368,11 @@ public function setDestinationCountryCode(string $destinationCountryCode): self return $this; } /** - * The shipment destination state or province. For U.S. addresses, the value must be a valid 2-character value (per U.S. Mail standards). - For non-U.S. addresses the full State or Province name should be provided. - * - * @return string - */ + * The shipment destination state or province. For U.S. addresses, the value must be a valid 2-character value (per U.S. Mail standards). + * For non-U.S. addresses the full State or Province name should be provided. + * + * @return string + */ public function getDestinationStateProvince(): string { return $this->destinationStateProvince; @@ -436,11 +436,11 @@ public function setDestinationTownName(string $destinationTownName): self return $this; } /** - * The shipment destination postal code. - Required for Domestic requests. Either 5, or 9-digit U.S. zip codes must be used for U.S. addresses. For non-U.S. addresses, this is recommended for all countries that utilize postal codes. - * - * @return string - */ + * The shipment destination postal code. + * Required for Domestic requests. Either 5, or 9-digit U.S. zip codes must be used for U.S. addresses. For non-U.S. addresses, this is recommended for all countries that utilize postal codes. + * + * @return string + */ public function getDestinationPostalCode(): string { return $this->destinationPostalCode; @@ -460,17 +460,17 @@ public function setDestinationPostalCode(string $destinationPostalCode): self return $this; } /** - * Indicates if address is residential or commercial. Required for Domestic requests. - - Valid values: "01", "02" - - 01 = Residential - 02 = Commercial - - Defaults to commercial for International Requests. - * - * @return string - */ + * Indicates if address is residential or commercial. Required for Domestic requests. + * + * Valid values: "01", "02" + * + * 01 = Residential + * 02 = Commercial + * + * Defaults to commercial for International Requests. + * + * @return string + */ public function getResidentialIndicator(): string { return $this->residentialIndicator; @@ -496,19 +496,19 @@ public function setResidentialIndicator(string $residentialIndicator): self return $this; } /** - * The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). Allowed range is up to 60 days in future and 35 days in past. This date may or may not be the UPS business date. - - Format is YYYY-MM-DD. - - YYYY = 4 digit year; - - MM = 2 digit month, valid values 01-12; - - DD = 2 digit day of month, valid values 01-31 - If no value is provided, defaults to current system date. - * - * @return string - */ + * The date the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). Allowed range is up to 60 days in future and 35 days in past. This date may or may not be the UPS business date. + * + * Format is YYYY-MM-DD. + * + * YYYY = 4 digit year; + * + * MM = 2 digit month, valid values 01-12; + * + * DD = 2 digit day of month, valid values 01-31 + * If no value is provided, defaults to current system date. + * + * @return string + */ public function getShipDate(): string { return $this->shipDate; @@ -536,13 +536,13 @@ public function setShipDate(string $shipDate): self return $this; } /** - * The time the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). - Format is HH:MM:SS - - Defaults to current time if not provided. - * - * @return string - */ + * The time the shipment is tendered to UPS for shipping (can be dropped off at UPS or picked up by UPS). + * Format is HH:MM:SS + * + * Defaults to current time if not provided. + * + * @return string + */ public function getShipTime(): string { return $this->shipTime; @@ -564,14 +564,14 @@ public function setShipTime(string $shipTime): self return $this; } /** - * The weight of the shipment. Required for International requests. - - Note: If decimal values are used, valid values will be rounded to the tenths. - - Note: Maximum value is 70 kilograms or 150 pounds. - * - * @return float - */ + * The weight of the shipment. Required for International requests. + * + * Note: If decimal values are used, valid values will be rounded to the tenths. + * + * Note: Maximum value is 70 kilograms or 150 pounds. + * + * @return float + */ public function getWeight(): float { return $this->weight; @@ -594,12 +594,12 @@ public function setWeight(float $weight): self return $this; } /** - * Required for International requests and when weight value is provided. - - Valid Values: "LBS", "KGS" - * - * @return string - */ + * Required for International requests and when weight value is provided. + * + * Valid Values: "LBS", "KGS" + * + * @return string + */ public function getWeightUnitOfMeasure(): string { return $this->weightUnitOfMeasure; @@ -620,16 +620,16 @@ public function setWeightUnitOfMeasure(string $weightUnitOfMeasure): self return $this; } /** - * The monetary value of shipment contents. - - Required when origin country does not equal destination country and BillType is 03 (non-documented) or 04 (WWEF) - - Required when origin country does not equal destination country, and destination country = CA, and BillType = 02 (document). - - Note: If decimal values are used, valid values will be rounded to the tenths. - * - * @return float - */ + * The monetary value of shipment contents. + * + * Required when origin country does not equal destination country and BillType is 03 (non-documented) or 04 (WWEF) + * + * Required when origin country does not equal destination country, and destination country = CA, and BillType = 02 (document). + * + * Note: If decimal values are used, valid values will be rounded to the tenths. + * + * @return float + */ public function getShipmentContentsValue(): float { return $this->shipmentContentsValue; @@ -654,11 +654,11 @@ public function setShipmentContentsValue(float $shipmentContentsValue): self return $this; } /** - * The unit of currency used for values. Required if ShipmentContentsValue is populated. - Valid value: must conform to ISO standards. - * - * @return string - */ + * The unit of currency used for values. Required if ShipmentContentsValue is populated. + * Valid value: must conform to ISO standards. + * + * @return string + */ public function getShipmentContentsCurrencyCode(): string { return $this->shipmentContentsCurrencyCode; @@ -678,14 +678,14 @@ public function setShipmentContentsCurrencyCode(string $shipmentContentsCurrency return $this; } /** - * Required for International Requests. - Valid values: "02","03","04" - 02 - Document - 03 - Non Document - 04 - WWEF (Pallet) - * - * @return string - */ + * Required for International Requests. + * Valid values: "02","03","04" + * 02 - Document + * 03 - Non Document + * 04 - WWEF (Pallet) + * + * @return string + */ public function getBillType(): string { return $this->billType; @@ -708,15 +708,15 @@ public function setBillType(string $billType): self return $this; } /** - * Used to bypass address validation when the address has already been validated by the calling application. - - Valid values: true, false - - Defaults to true - Note: not to be exposed to external customers. - * - * @return bool - */ + * Used to bypass address validation when the address has already been validated by the calling application. + * + * Valid values: true, false + * + * Defaults to true + * Note: not to be exposed to external customers. + * + * @return bool + */ public function getAvvFlag(): bool { return $this->avvFlag; @@ -762,17 +762,17 @@ public function setNumberOfPackages(int $numberOfPackages): self return $this; } /** - * Sets the indicator for an international Freight Pallet shipment that is going to be dropped off by shipper to a UPS facility. The indicator is used when the Bill Type is "04". - - Valid values: "0", "1". - - 0 = WWDTProcessIF.PICKUP_BY_UPS - 1 = WWDTProcessIf.DROPOFF_BY_SHIPPER - - The default value is "0" - * - * @return int - */ + * Sets the indicator for an international Freight Pallet shipment that is going to be dropped off by shipper to a UPS facility. The indicator is used when the Bill Type is "04". + * + * Valid values: "0", "1". + * + * 0 = WWDTProcessIF.PICKUP_BY_UPS + * 1 = WWDTProcessIf.DROPOFF_BY_SHIPPER + * + * The default value is "0" + * + * @return int + */ public function getDropOffAtFacilityIndicator(): int { return $this->dropOffAtFacilityIndicator; @@ -798,17 +798,17 @@ public function setDropOffAtFacilityIndicator(int $dropOffAtFacilityIndicator): return $this; } /** - * Sets the indicator for an international Freight Pallet shipment that is going to be pick-up by consignee in a destination facility. The indicator is used when the Bill Type is "04". - - Valid values: "0", "1". - - 0 = WWDTProcessIF.DELIVERY_BY_UPS - 1 = WWDTProcessIf.PICKUP_BY_CONSIGNEE - - The default value is "0" - * - * @return int - */ + * Sets the indicator for an international Freight Pallet shipment that is going to be pick-up by consignee in a destination facility. The indicator is used when the Bill Type is "04". + * + * Valid values: "0", "1". + * + * 0 = WWDTProcessIF.DELIVERY_BY_UPS + * 1 = WWDTProcessIf.PICKUP_BY_CONSIGNEE + * + * The default value is "0" + * + * @return int + */ public function getHoldForPickupIndicator(): int { return $this->holdForPickupIndicator; @@ -834,12 +834,12 @@ public function setHoldForPickupIndicator(int $holdForPickupIndicator): self return $this; } /** - * Used to get back a full list of services - bypassing current WWDT business rules to remove services from the list being returned to clients for US domestic that are slower than UPS Ground. - - Default value is false. - * - * @return bool - */ + * Used to get back a full list of services - bypassing current WWDT business rules to remove services from the list being returned to clients for US domestic that are slower than UPS Ground. + * + * Default value is false. + * + * @return bool + */ public function getReturnUnfilterdServices(): bool { return $this->returnUnfilterdServices; @@ -860,12 +860,12 @@ public function setReturnUnfilterdServices(bool $returnUnfilterdServices): self return $this; } /** - * Sets the limit for the number of candidates returned in candidate list. - - Default value is 200. - * - * @return int - */ + * Sets the limit for the number of candidates returned in candidate list. + * + * Default value is 200. + * + * @return int + */ public function getMaxList(): int { return $this->maxList; diff --git a/src/Api/Model/TimeInTransitResponse.php b/src/Api/Model/TimeInTransitResponse.php index 895edb9c..af94d590 100644 --- a/src/Api/Model/TimeInTransitResponse.php +++ b/src/Api/Model/TimeInTransitResponse.php @@ -13,32 +13,22 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var ValidationList */ protected $validationList; /** - * - * * @var list */ protected $destinationPickList; /** - * - * * @var list */ protected $originPickList; /** - * - * * @var EmsResponse */ protected $emsResponse; /** - * - * * @return ValidationList */ public function getValidationList(): ValidationList @@ -46,8 +36,6 @@ public function getValidationList(): ValidationList return $this->validationList; } /** - * - * * @param ValidationList $validationList * * @return self @@ -59,8 +47,6 @@ public function setValidationList(ValidationList $validationList): self return $this; } /** - * - * * @return list */ public function getDestinationPickList(): array @@ -68,8 +54,6 @@ public function getDestinationPickList(): array return $this->destinationPickList; } /** - * - * * @param list $destinationPickList * * @return self @@ -81,8 +65,6 @@ public function setDestinationPickList(array $destinationPickList): self return $this; } /** - * - * * @return list */ public function getOriginPickList(): array @@ -90,8 +72,6 @@ public function getOriginPickList(): array return $this->originPickList; } /** - * - * * @param list $originPickList * * @return self @@ -103,8 +83,6 @@ public function setOriginPickList(array $originPickList): self return $this; } /** - * - * * @return EmsResponse */ public function getEmsResponse(): EmsResponse @@ -112,8 +90,6 @@ public function getEmsResponse(): EmsResponse return $this->emsResponse; } /** - * - * * @param EmsResponse $emsResponse * * @return self diff --git a/src/Api/Model/TrackApiResponse.php b/src/Api/Model/TrackApiResponse.php index d4f7d246..fbaaa1fa 100644 --- a/src/Api/Model/TrackApiResponse.php +++ b/src/Api/Model/TrackApiResponse.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var TrackResponse */ protected $trackResponse; /** - * - * * @return TrackResponse */ public function getTrackResponse(): TrackResponse @@ -28,8 +24,6 @@ public function getTrackResponse(): TrackResponse return $this->trackResponse; } /** - * - * * @param TrackResponse $trackResponse * * @return self diff --git a/src/Api/Model/TrackResponse.php b/src/Api/Model/TrackResponse.php index 7a56e80a..e4ab7ee3 100644 --- a/src/Api/Model/TrackResponse.php +++ b/src/Api/Model/TrackResponse.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $shipment; /** - * - * * @return list */ public function getShipment(): array @@ -28,8 +24,6 @@ public function getShipment(): array return $this->shipment; } /** - * - * * @param list $shipment * * @return self diff --git a/src/Api/Model/TrackSubsServiceErrorResponse.php b/src/Api/Model/TrackSubsServiceErrorResponse.php index 1bf10c83..1295ecda 100644 --- a/src/Api/Model/TrackSubsServiceErrorResponse.php +++ b/src/Api/Model/TrackSubsServiceErrorResponse.php @@ -13,8 +13,6 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var ErrorResponseWrapper */ protected $response; @@ -25,8 +23,6 @@ public function isInitialized($property): bool */ protected $invalidTrackingNumbers; /** - * - * * @return ErrorResponseWrapper */ public function getResponse(): ErrorResponseWrapper @@ -34,8 +30,6 @@ public function getResponse(): ErrorResponseWrapper return $this->response; } /** - * - * * @param ErrorResponseWrapper $response * * @return self diff --git a/src/Api/Model/TransportationPickUpSchedulePickUp.php b/src/Api/Model/TransportationPickUpSchedulePickUp.php index 85c51e54..d458e944 100644 --- a/src/Api/Model/TransportationPickUpSchedulePickUp.php +++ b/src/Api/Model/TransportationPickUpSchedulePickUp.php @@ -13,18 +13,18 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Day of week. - - 1 - Sunday - - 2 - Monday - - 3 - Tuesday - - 4 - Wednesday - - 5 - Thursday - - 6 - Friday - - 7 - Saturday. - - * - * @var string - */ + * Day of week. + * - 1 - Sunday + * - 2 - Monday + * - 3 - Tuesday + * - 4 - Wednesday + * - 5 - Thursday + * - 6 - Friday + * - 7 - Saturday. + * + * + * @var string + */ protected $dayOfWeek; /** * PickUpDetails container contains either pickup time or NoPickupIndicator. Either PickUpTime or NoPickupIndicator @@ -33,18 +33,18 @@ public function isInitialized($property): bool */ protected $pickUpDetails; /** - * Day of week. - - 1 - Sunday - - 2 - Monday - - 3 - Tuesday - - 4 - Wednesday - - 5 - Thursday - - 6 - Friday - - 7 - Saturday. - - * - * @return string - */ + * Day of week. + * - 1 - Sunday + * - 2 - Monday + * - 3 - Tuesday + * - 4 - Wednesday + * - 5 - Thursday + * - 6 - Friday + * - 7 - Saturday. + * + * + * @return string + */ public function getDayOfWeek(): string { return $this->dayOfWeek; diff --git a/src/Api/Model/UPSPremiumCareFormLanguageForUPSPremiumCare.php b/src/Api/Model/UPSPremiumCareFormLanguageForUPSPremiumCare.php index f768c8de..b23a4e1d 100644 --- a/src/Api/Model/UPSPremiumCareFormLanguageForUPSPremiumCare.php +++ b/src/Api/Model/UPSPremiumCareFormLanguageForUPSPremiumCare.php @@ -13,20 +13,20 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Languages for UPS Premium Care Form. Two languages are required for UPS Premium Care Form. Valid values: - eng = US English - fra = Canadian French - * - * @var list - */ + * Languages for UPS Premium Care Form. Two languages are required for UPS Premium Care Form. Valid values: + * eng = US English + * fra = Canadian French + * + * @var list + */ protected $language; /** - * Languages for UPS Premium Care Form. Two languages are required for UPS Premium Care Form. Valid values: - eng = US English - fra = Canadian French - * - * @return list - */ + * Languages for UPS Premium Care Form. Two languages are required for UPS Premium Care Form. Valid values: + * eng = US English + * fra = Canadian French + * + * @return list + */ public function getLanguage(): array { return $this->language; diff --git a/src/Api/Model/UltimateConsigneeUltimateConsigneeType.php b/src/Api/Model/UltimateConsigneeUltimateConsigneeType.php index a02c0845..7843f6e4 100644 --- a/src/Api/Model/UltimateConsigneeUltimateConsigneeType.php +++ b/src/Api/Model/UltimateConsigneeUltimateConsigneeType.php @@ -13,16 +13,16 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Ultimate Consignee Type Code. Applicable for EEI form only. - - Valid values: - D = Direct Consumer - G = Government Entity - R = Reseller - O = Other/Unknown - * - * @var string - */ + * Ultimate Consignee Type Code. Applicable for EEI form only. + * + * Valid values: + * D = Direct Consumer + * G = Government Entity + * R = Reseller + * O = Other/Unknown + * + * @var string + */ protected $code; /** * Ultimate Consignee Type Description. Applicable for EEI form only. @@ -31,16 +31,16 @@ public function isInitialized($property): bool */ protected $description; /** - * Ultimate Consignee Type Code. Applicable for EEI form only. - - Valid values: - D = Direct Consumer - G = Government Entity - R = Reseller - O = Other/Unknown - * - * @return string - */ + * Ultimate Consignee Type Code. Applicable for EEI form only. + * + * Valid values: + * D = Direct Consumer + * G = Government Entity + * R = Reseller + * O = Other/Unknown + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/UnitUnitOfMeasurement.php b/src/Api/Model/UnitUnitOfMeasurement.php index 7374473b..ad341a35 100644 --- a/src/Api/Model/UnitUnitOfMeasurement.php +++ b/src/Api/Model/UnitUnitOfMeasurement.php @@ -13,13 +13,13 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Code for the Unit of measurement of the commodity units. Required for Invoice forms and optional for Partial Invoice. - - Refer to Product Unit of Measure Codes in the Appendix for valid values. - - * - * @var string - */ + * Code for the Unit of measurement of the commodity units. Required for Invoice forms and optional for Partial Invoice. + * + * Refer to Product Unit of Measure Codes in the Appendix for valid values. + * + * + * @var string + */ protected $code; /** * The Unit of Measure if OTH (Other) is entered as the UnitOfMeasurement code. Applies to Invoice and Partial Invoice forms. Conditionally Required for the Invoice and Partial Invoice form if OTH is entered as the units UnitOfMeasurement Code. @@ -28,13 +28,13 @@ public function isInitialized($property): bool */ protected $description; /** - * Code for the Unit of measurement of the commodity units. Required for Invoice forms and optional for Partial Invoice. - - Refer to Product Unit of Measure Codes in the Appendix for valid values. - - * - * @return string - */ + * Code for the Unit of measurement of the commodity units. Required for Invoice forms and optional for Partial Invoice. + * + * Refer to Product Unit of Measure Codes in the Appendix for valid values. + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/UploadRequest.php b/src/Api/Model/UploadRequest.php index 7816303e..f56674fb 100644 --- a/src/Api/Model/UploadRequest.php +++ b/src/Api/Model/UploadRequest.php @@ -25,8 +25,6 @@ public function isInitialized($property): bool */ protected $shipperNumber; /** - * - * * @var list */ protected $userCreatedForm; @@ -75,8 +73,6 @@ public function setShipperNumber(string $shipperNumber): self return $this; } /** - * - * * @return list */ public function getUserCreatedForm(): array @@ -84,8 +80,6 @@ public function getUserCreatedForm(): array return $this->userCreatedForm; } /** - * - * * @param list $userCreatedForm * * @return self diff --git a/src/Api/Model/UploadRequestUserCreatedForm.php b/src/Api/Model/UploadRequestUserCreatedForm.php index 647f4f68..1c361f54 100644 --- a/src/Api/Model/UploadRequestUserCreatedForm.php +++ b/src/Api/Model/UploadRequestUserCreatedForm.php @@ -19,13 +19,13 @@ public function isInitialized($property): bool */ protected $userCreatedFormFileName; /** - * The user created form file. The maximum allowable size of each file is restricted to 10 MB. Should be a base64 encoded string. - - Note: The maximum allowable size of each file is restriced to 1MB in CIE (Customer Integration Environment). - - * - * @var string - */ + * The user created form file. The maximum allowable size of each file is restricted to 10 MB. Should be a base64 encoded string. + * + * Note: The maximum allowable size of each file is restriced to 1MB in CIE (Customer Integration Environment). + * + * + * @var string + */ protected $userCreatedFormFile; /** * The UserCreatedForm file format. The allowed file formats are bmp, doc, gif, jpg, pdf, png, rtf, tif, txt and xls. The only exceptions for having file format of length 4 character are docx and xlsx. All other file formats needs to be of length 3. @@ -62,13 +62,13 @@ public function setUserCreatedFormFileName(string $userCreatedFormFileName): sel return $this; } /** - * The user created form file. The maximum allowable size of each file is restricted to 10 MB. Should be a base64 encoded string. - - Note: The maximum allowable size of each file is restriced to 1MB in CIE (Customer Integration Environment). - - * - * @return string - */ + * The user created form file. The maximum allowable size of each file is restricted to 10 MB. Should be a base64 encoded string. + * + * Note: The maximum allowable size of each file is restriced to 1MB in CIE (Customer Integration Environment). + * + * + * @return string + */ public function getUserCreatedFormFile(): string { return $this->userCreatedFormFile; diff --git a/src/Api/Model/UploadResponseFormsHistoryDocumentID.php b/src/Api/Model/UploadResponseFormsHistoryDocumentID.php index 8a902cf1..49e57c1a 100644 --- a/src/Api/Model/UploadResponseFormsHistoryDocumentID.php +++ b/src/Api/Model/UploadResponseFormsHistoryDocumentID.php @@ -14,14 +14,18 @@ public function isInitialized($property): bool } /** * DocumentID represents a document uploaded to Forms History. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ protected $documentID; /** * DocumentID represents a document uploaded to Forms History. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/UploadResponseResponse.php b/src/Api/Model/UploadResponseResponse.php index 90a1854a..61d116d2 100644 --- a/src/Api/Model/UploadResponseResponse.php +++ b/src/Api/Model/UploadResponseResponse.php @@ -20,7 +20,9 @@ public function isInitialized($property): bool protected $responseStatus; /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -55,7 +57,9 @@ public function setResponseStatus(ResponseResponseStatus $responseStatus): self } /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/ValidationList.php b/src/Api/Model/ValidationList.php index 2d81dae2..3a3aabbf 100644 --- a/src/Api/Model/ValidationList.php +++ b/src/Api/Model/ValidationList.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var list */ protected $invalidFieldList; /** - * - * * @var list */ protected $invalidFieldListCodes; @@ -37,8 +33,6 @@ public function isInitialized($property): bool */ protected $originAmbiguous; /** - * - * * @return list */ public function getInvalidFieldList(): array @@ -46,8 +40,6 @@ public function getInvalidFieldList(): array return $this->invalidFieldList; } /** - * - * * @param list $invalidFieldList * * @return self @@ -59,8 +51,6 @@ public function setInvalidFieldList(array $invalidFieldList): self return $this; } /** - * - * * @return list */ public function getInvalidFieldListCodes(): array @@ -68,8 +58,6 @@ public function getInvalidFieldListCodes(): array return $this->invalidFieldListCodes; } /** - * - * * @param list $invalidFieldListCodes * * @return self diff --git a/src/Api/Model/ValueCWT.php b/src/Api/Model/ValueCWT.php index 44bb701f..81516484 100644 --- a/src/Api/Model/ValueCWT.php +++ b/src/Api/Model/ValueCWT.php @@ -13,31 +13,31 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Currency code type for Price per CWT. - Valid value: USD - United States Dollar - * - * @var string - */ + * Currency code type for Price per CWT. + * Valid value: USD - United States Dollar + * + * @var string + */ protected $currencyCode; /** - * Price per CWT. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @var string - */ + * Price per CWT. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @var string + */ protected $monetaryValue; /** - * Currency code type for Price per CWT. - Valid value: USD - United States Dollar - * - * @return string - */ + * Currency code type for Price per CWT. + * Valid value: USD - United States Dollar + * + * @return string + */ public function getCurrencyCode(): string { return $this->currencyCode; @@ -57,17 +57,17 @@ public function setCurrencyCode(string $currencyCode): self return $this; } /** - * Price per CWT. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @return string - */ + * Price per CWT. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @return string + */ public function getMonetaryValue(): string { return $this->monetaryValue; diff --git a/src/Api/Model/ValueCube.php b/src/Api/Model/ValueCube.php index 77a8df67..ec763c59 100644 --- a/src/Api/Model/ValueCube.php +++ b/src/Api/Model/ValueCube.php @@ -13,31 +13,31 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Currency code type for Price per cubic feet. - Valid value: USD - United States Dollar - * - * @var string - */ + * Currency code type for Price per cubic feet. + * Valid value: USD - United States Dollar + * + * @var string + */ protected $currencyCode; /** - * Price per cubic feet. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @var string - */ + * Price per cubic feet. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @var string + */ protected $monetaryValue; /** - * Currency code type for Price per cubic feet. - Valid value: USD - United States Dollar - * - * @return string - */ + * Currency code type for Price per cubic feet. + * Valid value: USD - United States Dollar + * + * @return string + */ public function getCurrencyCode(): string { return $this->currencyCode; @@ -57,17 +57,17 @@ public function setCurrencyCode(string $currencyCode): self return $this; } /** - * Price per cubic feet. - Valid characters: 0-9 and "." (Decimal). - Maximum of 2 digits after the decimal. - Maximum field length: 16 characters. The decimal ".", does not count as a character. - Examples: - ##############.## - ###############.# - ################ - * - * @return string - */ + * Price per cubic feet. + * Valid characters: 0-9 and "." (Decimal). + * Maximum of 2 digits after the decimal. + * Maximum field length: 16 characters. The decimal ".", does not count as a character. + * Examples: + * ##############.## + * ###############.# + * ################ + * + * @return string + */ public function getMonetaryValue(): string { return $this->monetaryValue; diff --git a/src/Api/Model/VoidShipmentResponse.php b/src/Api/Model/VoidShipmentResponse.php index e1b55554..6ef8b3e8 100644 --- a/src/Api/Model/VoidShipmentResponse.php +++ b/src/Api/Model/VoidShipmentResponse.php @@ -26,7 +26,9 @@ public function isInitialized($property): bool protected $summaryResult; /** * Contains the Package Level Results. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -77,7 +79,9 @@ public function setSummaryResult(VoidShipmentResponseSummaryResult $summaryResul } /** * Contains the Package Level Results. - **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2403, this element will always be returned as an array. For requests using versions < v2403, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Model/Warning.php b/src/Api/Model/Warning.php index ecbc742c..09cf8f36 100644 --- a/src/Api/Model/Warning.php +++ b/src/Api/Model/Warning.php @@ -13,20 +13,14 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var string */ protected $code; /** - * - * * @var string */ protected $message; /** - * - * * @return string */ public function getCode(): string @@ -34,8 +28,6 @@ public function getCode(): string return $this->code; } /** - * - * * @param string $code * * @return self @@ -47,8 +39,6 @@ public function setCode(string $code): self return $this; } /** - * - * * @return string */ public function getMessage(): string @@ -56,8 +46,6 @@ public function getMessage(): string return $this->message; } /** - * - * * @param string $message * * @return self diff --git a/src/Api/Model/XAVRequest.php b/src/Api/Model/XAVRequest.php index c7c372d8..37e62a37 100644 --- a/src/Api/Model/XAVRequest.php +++ b/src/Api/Model/XAVRequest.php @@ -20,23 +20,22 @@ public function isInitialized($property): bool protected $request; /** * If this indicator is present then either the region element or any combination of Political Division 1, Political Division 2, PostcodePrimaryLow and the PostcodeExtendedLow fields will be recognized for validation in addition to the urbanization element. If this tag is present, US and PR street level address validation will not occur. The default is to provide street level address validation. Not valid with the address classification request option. + * * * @var string */ protected $regionalRequestIndicator; /** - * The maximum number of Candidates to return for this request. - - - Valid values: 0 - 50 - - Default: 15 - - * - * @var string - */ - protected $maximumCandidateListSize; - /** + * The maximum number of Candidates to return for this request. + * + * - Valid values: 0 - 50 + * - Default: 15 * * + * @var string + */ + protected $maximumCandidateListSize; + /** * @var list */ protected $addressKeyFormat; @@ -64,6 +63,7 @@ public function setRequest(XAVRequestRequest $request): self } /** * If this indicator is present then either the region element or any combination of Political Division 1, Political Division 2, PostcodePrimaryLow and the PostcodeExtendedLow fields will be recognized for validation in addition to the urbanization element. If this tag is present, US and PR street level address validation will not occur. The default is to provide street level address validation. Not valid with the address classification request option. + * * * @return string */ @@ -85,14 +85,14 @@ public function setRegionalRequestIndicator(string $regionalRequestIndicator): s return $this; } /** - * The maximum number of Candidates to return for this request. - - - Valid values: 0 - 50 - - Default: 15 - - * - * @return string - */ + * The maximum number of Candidates to return for this request. + * + * - Valid values: 0 - 50 + * - Default: 15 + * + * + * @return string + */ public function getMaximumCandidateListSize(): string { return $this->maximumCandidateListSize; @@ -115,8 +115,6 @@ public function setMaximumCandidateListSize(string $maximumCandidateListSize): s return $this; } /** - * - * * @return list */ public function getAddressKeyFormat(): array @@ -124,8 +122,6 @@ public function getAddressKeyFormat(): array return $this->addressKeyFormat; } /** - * - * * @param list $addressKeyFormat * * @return self diff --git a/src/Api/Model/XAVRequestAddressKeyFormat.php b/src/Api/Model/XAVRequestAddressKeyFormat.php index c98d37ff..1696c71e 100644 --- a/src/Api/Model/XAVRequestAddressKeyFormat.php +++ b/src/Api/Model/XAVRequestAddressKeyFormat.php @@ -31,18 +31,18 @@ public function isInitialized($property): bool */ protected $addressLine; /** - * If this node is present the following tags will be ignored: - - - Political Division 2 - - Political Division 1 - - PostcodePrimaryLow - - PostcodeExtendedLow - - Valid only for US or PR origins only. Using this tag for non US/PR origins may cause address format errors. - - * - * @var string - */ + * If this node is present the following tags will be ignored: + * + * - Political Division 2 + * - Political Division 1 + * - PostcodePrimaryLow + * - PostcodeExtendedLow + * + * Valid only for US or PR origins only. Using this tag for non US/PR origins may cause address format errors. + * + * + * @var string + */ protected $region; /** * City or Town name. @@ -147,18 +147,18 @@ public function setAddressLine(array $addressLine): self return $this; } /** - * If this node is present the following tags will be ignored: - - - Political Division 2 - - Political Division 1 - - PostcodePrimaryLow - - PostcodeExtendedLow - - Valid only for US or PR origins only. Using this tag for non US/PR origins may cause address format errors. - - * - * @return string - */ + * If this node is present the following tags will be ignored: + * + * - Political Division 2 + * - Political Division 1 + * - PostcodePrimaryLow + * - PostcodeExtendedLow + * + * Valid only for US or PR origins only. Using this tag for non US/PR origins may cause address format errors. + * + * + * @return string + */ public function getRegion(): string { return $this->region; diff --git a/src/Api/Model/XAVRequestRequest.php b/src/Api/Model/XAVRequestRequest.php index 4d369372..2358df54 100644 --- a/src/Api/Model/XAVRequestRequest.php +++ b/src/Api/Model/XAVRequestRequest.php @@ -19,19 +19,19 @@ public function isInitialized($property): bool */ protected $subVersion; /** - * Identifies the optional processing to be performed. If not present or invalid value then an error will be sent back. - - Valid values: - - - 1 - Address Validation - - 2 - Address Classification - - 3 - Address Validation and Address Classification. - - For a list of valid values, refer to Address Validation API Supported Countries or Territories in the Appendix. - - * - * @var string - */ + * Identifies the optional processing to be performed. If not present or invalid value then an error will be sent back. + * + * Valid values: + * + * - 1 - Address Validation + * - 2 - Address Classification + * - 3 - Address Validation and Address Classification. + * + * For a list of valid values, refer to Address Validation API Supported Countries or Territories in the Appendix. + * + * + * @var string + */ protected $requestOption; /** * TransactionReference identifies transactions between client and server. @@ -62,19 +62,19 @@ public function setSubVersion(string $subVersion): self return $this; } /** - * Identifies the optional processing to be performed. If not present or invalid value then an error will be sent back. - - Valid values: - - - 1 - Address Validation - - 2 - Address Classification - - 3 - Address Validation and Address Classification. - - For a list of valid values, refer to Address Validation API Supported Countries or Territories in the Appendix. - - * - * @return string - */ + * Identifies the optional processing to be performed. If not present or invalid value then an error will be sent back. + * + * Valid values: + * + * - 1 - Address Validation + * - 2 - Address Classification + * - 3 - Address Validation and Address Classification. + * + * For a list of valid values, refer to Address Validation API Supported Countries or Territories in the Appendix. + * + * + * @return string + */ public function getRequestOption(): string { return $this->requestOption; diff --git a/src/Api/Model/XAVRequestWrapper.php b/src/Api/Model/XAVRequestWrapper.php index b7a1a93d..bcc5b92f 100644 --- a/src/Api/Model/XAVRequestWrapper.php +++ b/src/Api/Model/XAVRequestWrapper.php @@ -13,14 +13,10 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * - * * @var XAVRequest */ protected $xAVRequest; /** - * - * * @return XAVRequest */ public function getXAVRequest(): XAVRequest @@ -28,8 +24,6 @@ public function getXAVRequest(): XAVRequest return $this->xAVRequest; } /** - * - * * @param XAVRequest $xAVRequest * * @return self diff --git a/src/Api/Model/XAVResponse.php b/src/Api/Model/XAVResponse.php index ac944ad5..2a9a694d 100644 --- a/src/Api/Model/XAVResponse.php +++ b/src/Api/Model/XAVResponse.php @@ -44,7 +44,9 @@ public function isInitialized($property): bool protected $addressClassification; /** * Candidate Container. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list|null */ @@ -161,7 +163,9 @@ public function setAddressClassification(?XAVResponseAddressClassification $addr } /** * Candidate Container. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list|null */ diff --git a/src/Api/Model/XAVResponseAddressClassification.php b/src/Api/Model/XAVResponseAddressClassification.php index 499d63ed..d903f22f 100644 --- a/src/Api/Model/XAVResponseAddressClassification.php +++ b/src/Api/Model/XAVResponseAddressClassification.php @@ -13,17 +13,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } /** - * Contains the classification code of the input address. - - Valid values: - - - 0 - UnClassified - - 1 - Commercial - - 2 - Residential - - * - * @var string - */ + * Contains the classification code of the input address. + * + * Valid values: + * + * - 0 - UnClassified + * - 1 - Commercial + * - 2 - Residential + * + * + * @var string + */ protected $code; /** * Contains the text description of the address classification code: UnClassified, Commercial, Residential @@ -32,17 +32,17 @@ public function isInitialized($property): bool */ protected $description; /** - * Contains the classification code of the input address. - - Valid values: - - - 0 - UnClassified - - 1 - Commercial - - 2 - Residential - - * - * @return string - */ + * Contains the classification code of the input address. + * + * Valid values: + * + * - 0 - UnClassified + * - 1 - Commercial + * - 2 - Residential + * + * + * @return string + */ public function getCode(): string { return $this->code; diff --git a/src/Api/Model/XAVResponseCandidate.php b/src/Api/Model/XAVResponseCandidate.php index 7d886fe0..9006f284 100644 --- a/src/Api/Model/XAVResponseCandidate.php +++ b/src/Api/Model/XAVResponseCandidate.php @@ -19,8 +19,6 @@ public function isInitialized($property): bool */ protected $addressClassification; /** - * - * * @var list */ protected $addressKeyFormat; @@ -47,8 +45,6 @@ public function setAddressClassification(?CandidateAddressClassification $addres return $this; } /** - * - * * @return list */ public function getAddressKeyFormat(): array @@ -56,8 +52,6 @@ public function getAddressKeyFormat(): array return $this->addressKeyFormat; } /** - * - * * @param list $addressKeyFormat * * @return self diff --git a/src/Api/Model/XAVResponseResponse.php b/src/Api/Model/XAVResponseResponse.php index 377abb58..58fddc7a 100644 --- a/src/Api/Model/XAVResponseResponse.php +++ b/src/Api/Model/XAVResponseResponse.php @@ -20,7 +20,9 @@ public function isInitialized($property): bool protected $responseStatus; /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @var list */ @@ -55,7 +57,9 @@ public function setResponseStatus(ResponseResponseStatus $responseStatus): self } /** * Alert Container. There can be zero to many alert containers with code and description. - **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * + * **NOTE:** For versions >= v2, this element will always be returned as an array. For requests using version = v1, this element will be returned as an array if there is more than one object and a single object if there is only 1. + * * * @return list */ diff --git a/src/Api/Normalizer/AcceptanceAuditPreCheckRequestNormalizer.php b/src/Api/Normalizer/AcceptanceAuditPreCheckRequestNormalizer.php index b6327cd3..4006836a 100644 --- a/src/Api/Normalizer/AcceptanceAuditPreCheckRequestNormalizer.php +++ b/src/Api/Normalizer/AcceptanceAuditPreCheckRequestNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AcceptanceAuditPreCheckRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AcceptanceAuditPreCheckRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class; + return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('OriginRecordTransactionTimestamp', $data)) { - $object->setOriginRecordTransactionTimestamp($data['OriginRecordTransactionTimestamp']); - unset($data['OriginRecordTransactionTimestamp']); - } - if (\array_key_exists('Shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class, 'json', $context)); - unset($data['Shipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('originRecordTransactionTimestamp') && null !== $object->getOriginRecordTransactionTimestamp()) { - $data['OriginRecordTransactionTimestamp'] = $object->getOriginRecordTransactionTimestamp(); - } - $data['Shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class => false]; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class, 'json', $context)); + unset($data['Request']); } - } -} else { - class AcceptanceAuditPreCheckRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class; + if (\array_key_exists('OriginRecordTransactionTimestamp', $data)) { + $object->setOriginRecordTransactionTimestamp($data['OriginRecordTransactionTimestamp']); + unset($data['OriginRecordTransactionTimestamp']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class; + if (\array_key_exists('Shipment', $data)) { + $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class, 'json', $context)); + unset($data['Shipment']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class, 'json', $context)); - unset($data['Request']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('OriginRecordTransactionTimestamp', $data)) { - $object->setOriginRecordTransactionTimestamp($data['OriginRecordTransactionTimestamp']); - unset($data['OriginRecordTransactionTimestamp']); - } - if (\array_key_exists('Shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class, 'json', $context)); - unset($data['Shipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('originRecordTransactionTimestamp') && null !== $object->getOriginRecordTransactionTimestamp()) { - $data['OriginRecordTransactionTimestamp'] = $object->getOriginRecordTransactionTimestamp(); - } - $data['Shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + if ($data->isInitialized('originRecordTransactionTimestamp') && null !== $data->getOriginRecordTransactionTimestamp()) { + $dataArray['OriginRecordTransactionTimestamp'] = $data->getOriginRecordTransactionTimestamp(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class => false]; + $dataArray['Shipment'] = $this->normalizer->normalize($data->getShipment(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AcceptanceAuditPreCheckRequestRequestNormalizer.php b/src/Api/Normalizer/AcceptanceAuditPreCheckRequestRequestNormalizer.php index 58a2512f..78b76df8 100644 --- a/src/Api/Normalizer/AcceptanceAuditPreCheckRequestRequestNormalizer.php +++ b/src/Api/Normalizer/AcceptanceAuditPreCheckRequestRequestNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AcceptanceAuditPreCheckRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AcceptanceAuditPreCheckRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); + } + if (\array_key_exists('SubVersion', $data)) { + $object->setSubVersion($data['SubVersion']); + unset($data['SubVersion']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class => false]; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class AcceptanceAuditPreCheckRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('requestOption') && null !== $data->getRequestOption()) { + $dataArray['RequestOption'] = $data->getRequestOption(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class; + if ($data->isInitialized('subVersion') && null !== $data->getSubVersion()) { + $dataArray['SubVersion'] = $data->getSubVersion(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AcceptanceAuditPreCheckRequestShipmentNormalizer.php b/src/Api/Normalizer/AcceptanceAuditPreCheckRequestShipmentNormalizer.php index 6981af11..2ba91d46 100644 --- a/src/Api/Normalizer/AcceptanceAuditPreCheckRequestShipmentNormalizer.php +++ b/src/Api/Normalizer/AcceptanceAuditPreCheckRequestShipmentNormalizer.php @@ -5,196 +5,97 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AcceptanceAuditPreCheckRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AcceptanceAuditPreCheckRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class; + return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('ShipFromAddress', $data)) { - $object->setShipFromAddress($this->denormalizer->denormalize($data['ShipFromAddress'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class, 'json', $context)); - unset($data['ShipFromAddress']); - } - if (\array_key_exists('ShipToAddress', $data)) { - $object->setShipToAddress($this->denormalizer->denormalize($data['ShipToAddress'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class, 'json', $context)); - unset($data['ShipToAddress']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('Package', $data)) { - $values = []; - foreach ($data['Package'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class, 'json', $context); - } - $object->setPackage($values); - unset($data['Package']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['ShipFromAddress'] = $this->normalizer->normalize($object->getShipFromAddress(), 'json', $context); - $data['ShipToAddress'] = $this->normalizer->normalize($object->getShipToAddress(), 'json', $context); - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - if ($object->isInitialized('regulationSet') && null !== $object->getRegulationSet()) { - $data['RegulationSet'] = $object->getRegulationSet(); - } - $values = []; - foreach ($object->getPackage() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Package'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class => false]; + if (\array_key_exists('ShipFromAddress', $data)) { + $object->setShipFromAddress($this->denormalizer->denormalize($data['ShipFromAddress'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class, 'json', $context)); + unset($data['ShipFromAddress']); } - } -} else { - class AcceptanceAuditPreCheckRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class; + if (\array_key_exists('ShipToAddress', $data)) { + $object->setShipToAddress($this->denormalizer->denormalize($data['ShipToAddress'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class, 'json', $context)); + unset($data['ShipToAddress']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class; + if (\array_key_exists('Service', $data)) { + $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); + unset($data['Service']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('ShipFromAddress', $data)) { - $object->setShipFromAddress($this->denormalizer->denormalize($data['ShipFromAddress'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class, 'json', $context)); - unset($data['ShipFromAddress']); - } - if (\array_key_exists('ShipToAddress', $data)) { - $object->setShipToAddress($this->denormalizer->denormalize($data['ShipToAddress'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class, 'json', $context)); - unset($data['ShipToAddress']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('Package', $data)) { - $values = []; - foreach ($data['Package'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class, 'json', $context); - } - $object->setPackage($values); - unset($data['Package']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if (\array_key_exists('RegulationSet', $data)) { + $object->setRegulationSet($data['RegulationSet']); + unset($data['RegulationSet']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['ShipFromAddress'] = $this->normalizer->normalize($object->getShipFromAddress(), 'json', $context); - $data['ShipToAddress'] = $this->normalizer->normalize($object->getShipToAddress(), 'json', $context); - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - if ($object->isInitialized('regulationSet') && null !== $object->getRegulationSet()) { - $data['RegulationSet'] = $object->getRegulationSet(); - } + if (\array_key_exists('Package', $data)) { $values = []; - foreach ($object->getPackage() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['Package'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class, 'json', $context); } - $data['Package'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + $object->setPackage($values); + unset($data['Package']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + $dataArray['ShipFromAddress'] = $this->normalizer->normalize($data->getShipFromAddress(), 'json', $context); + $dataArray['ShipToAddress'] = $this->normalizer->normalize($data->getShipToAddress(), 'json', $context); + $dataArray['Service'] = $this->normalizer->normalize($data->getService(), 'json', $context); + if ($data->isInitialized('regulationSet') && null !== $data->getRegulationSet()) { + $dataArray['RegulationSet'] = $data->getRegulationSet(); + } + $values = []; + foreach ($data->getPackage() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Package'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AcceptanceAuditPreCheckResponseNormalizer.php b/src/Api/Normalizer/AcceptanceAuditPreCheckResponseNormalizer.php index f12b361e..3cfd1949 100644 --- a/src/Api/Normalizer/AcceptanceAuditPreCheckResponseNormalizer.php +++ b/src/Api/Normalizer/AcceptanceAuditPreCheckResponseNormalizer.php @@ -5,198 +5,98 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AcceptanceAuditPreCheckResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AcceptanceAuditPreCheckResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class; + return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('PackageResults', $data)) { - $values = []; - foreach ($data['PackageResults'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class, 'json', $context); - } - $object->setPackageResults($values); - unset($data['PackageResults']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('shipperNumber') && null !== $object->getShipperNumber()) { - $data['ShipperNumber'] = $object->getShipperNumber(); - } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - } - if ($object->isInitialized('regulationSet') && null !== $object->getRegulationSet()) { - $data['RegulationSet'] = $object->getRegulationSet(); - } - if ($object->isInitialized('packageResults') && null !== $object->getPackageResults()) { - $values = []; - foreach ($object->getPackageResults() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PackageResults'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class, 'json', $context)); + unset($data['Response']); + } + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); + } + if (\array_key_exists('Service', $data)) { + $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class, 'json', $context)); + unset($data['Service']); + } + if (\array_key_exists('RegulationSet', $data)) { + $object->setRegulationSet($data['RegulationSet']); + unset($data['RegulationSet']); + } + if (\array_key_exists('PackageResults', $data)) { + $values = []; + foreach ($data['PackageResults'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class, 'json', $context); } - return $data; + $object->setPackageResults($values); + unset($data['PackageResults']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class AcceptanceAuditPreCheckResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + if ($data->isInitialized('shipperNumber') && null !== $data->getShipperNumber()) { + $dataArray['ShipperNumber'] = $data->getShipperNumber(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class; + if ($data->isInitialized('service') && null !== $data->getService()) { + $dataArray['Service'] = $this->normalizer->normalize($data->getService(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('PackageResults', $data)) { - $values = []; - foreach ($data['PackageResults'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class, 'json', $context); - } - $object->setPackageResults($values); - unset($data['PackageResults']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('regulationSet') && null !== $data->getRegulationSet()) { + $dataArray['RegulationSet'] = $data->getRegulationSet(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('shipperNumber') && null !== $object->getShipperNumber()) { - $data['ShipperNumber'] = $object->getShipperNumber(); - } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - } - if ($object->isInitialized('regulationSet') && null !== $object->getRegulationSet()) { - $data['RegulationSet'] = $object->getRegulationSet(); - } - if ($object->isInitialized('packageResults') && null !== $object->getPackageResults()) { - $values = []; - foreach ($object->getPackageResults() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PackageResults'] = $values; + if ($data->isInitialized('packageResults') && null !== $data->getPackageResults()) { + $values = []; + foreach ($data->getPackageResults() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $dataArray['PackageResults'] = $values; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AcceptanceAuditPreCheckResponsePackageResultsNormalizer.php b/src/Api/Normalizer/AcceptanceAuditPreCheckResponsePackageResultsNormalizer.php index 0a442968..f81708db 100644 --- a/src/Api/Normalizer/AcceptanceAuditPreCheckResponsePackageResultsNormalizer.php +++ b/src/Api/Normalizer/AcceptanceAuditPreCheckResponsePackageResultsNormalizer.php @@ -5,184 +5,91 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AcceptanceAuditPreCheckResponsePackageResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AcceptanceAuditPreCheckResponsePackageResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class; + return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageIdentifier', $data)) { - $object->setPackageIdentifier($data['PackageIdentifier']); - unset($data['PackageIdentifier']); - } - if (\array_key_exists('AccessibleIndicator', $data)) { - $object->setAccessibleIndicator($data['AccessibleIndicator']); - unset($data['AccessibleIndicator']); - } - if (\array_key_exists('EuropeBUIndicator', $data)) { - $object->setEuropeBUIndicator($data['EuropeBUIndicator']); - unset($data['EuropeBUIndicator']); - } - if (\array_key_exists('ChemicalRecordResults', $data)) { - $values = []; - foreach ($data['ChemicalRecordResults'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class, 'json', $context); - } - $object->setChemicalRecordResults($values); - unset($data['ChemicalRecordResults']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PackageIdentifier'] = $object->getPackageIdentifier(); - if ($object->isInitialized('accessibleIndicator') && null !== $object->getAccessibleIndicator()) { - $data['AccessibleIndicator'] = $object->getAccessibleIndicator(); - } - if ($object->isInitialized('europeBUIndicator') && null !== $object->getEuropeBUIndicator()) { - $data['EuropeBUIndicator'] = $object->getEuropeBUIndicator(); - } - if ($object->isInitialized('chemicalRecordResults') && null !== $object->getChemicalRecordResults()) { - $values = []; - foreach ($object->getChemicalRecordResults() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ChemicalRecordResults'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('PackageIdentifier', $data)) { + $object->setPackageIdentifier($data['PackageIdentifier']); + unset($data['PackageIdentifier']); + } + if (\array_key_exists('AccessibleIndicator', $data)) { + $object->setAccessibleIndicator($data['AccessibleIndicator']); + unset($data['AccessibleIndicator']); + } + if (\array_key_exists('EuropeBUIndicator', $data)) { + $object->setEuropeBUIndicator($data['EuropeBUIndicator']); + unset($data['EuropeBUIndicator']); + } + if (\array_key_exists('ChemicalRecordResults', $data)) { + $values = []; + foreach ($data['ChemicalRecordResults'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class, 'json', $context); } - return $data; + $object->setChemicalRecordResults($values); + unset($data['ChemicalRecordResults']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class AcceptanceAuditPreCheckResponsePackageResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class; + $dataArray = []; + $dataArray['PackageIdentifier'] = $data->getPackageIdentifier(); + if ($data->isInitialized('accessibleIndicator') && null !== $data->getAccessibleIndicator()) { + $dataArray['AccessibleIndicator'] = $data->getAccessibleIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class; + if ($data->isInitialized('europeBUIndicator') && null !== $data->getEuropeBUIndicator()) { + $dataArray['EuropeBUIndicator'] = $data->getEuropeBUIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageIdentifier', $data)) { - $object->setPackageIdentifier($data['PackageIdentifier']); - unset($data['PackageIdentifier']); - } - if (\array_key_exists('AccessibleIndicator', $data)) { - $object->setAccessibleIndicator($data['AccessibleIndicator']); - unset($data['AccessibleIndicator']); - } - if (\array_key_exists('EuropeBUIndicator', $data)) { - $object->setEuropeBUIndicator($data['EuropeBUIndicator']); - unset($data['EuropeBUIndicator']); - } - if (\array_key_exists('ChemicalRecordResults', $data)) { - $values = []; - foreach ($data['ChemicalRecordResults'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class, 'json', $context); - } - $object->setChemicalRecordResults($values); - unset($data['ChemicalRecordResults']); + if ($data->isInitialized('chemicalRecordResults') && null !== $data->getChemicalRecordResults()) { + $values = []; + foreach ($data->getChemicalRecordResults() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray['ChemicalRecordResults'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PackageIdentifier'] = $object->getPackageIdentifier(); - if ($object->isInitialized('accessibleIndicator') && null !== $object->getAccessibleIndicator()) { - $data['AccessibleIndicator'] = $object->getAccessibleIndicator(); - } - if ($object->isInitialized('europeBUIndicator') && null !== $object->getEuropeBUIndicator()) { - $data['EuropeBUIndicator'] = $object->getEuropeBUIndicator(); - } - if ($object->isInitialized('chemicalRecordResults') && null !== $object->getChemicalRecordResults()) { - $values = []; - foreach ($object->getChemicalRecordResults() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ChemicalRecordResults'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AcceptanceAuditPreCheckResponseResponseNormalizer.php b/src/Api/Normalizer/AcceptanceAuditPreCheckResponseResponseNormalizer.php index d911152c..6d1d873b 100644 --- a/src/Api/Normalizer/AcceptanceAuditPreCheckResponseResponseNormalizer.php +++ b/src/Api/Normalizer/AcceptanceAuditPreCheckResponseResponseNormalizer.php @@ -5,200 +5,99 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AcceptanceAuditPreCheckResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AcceptanceAuditPreCheckResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('AlertDetail', $data)) { - $values_1 = []; - foreach ($data['AlertDetail'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ResponseAlertDetail::class, 'json', $context); - } - $object->setAlertDetail($values_1); - unset($data['AlertDetail']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('alertDetail') && null !== $object->getAlertDetail()) { - $values_1 = []; - foreach ($object->getAlertDetail() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['AlertDetail'] = $values_1; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); + } + if (\array_key_exists('Alert', $data)) { + $values = []; + foreach ($data['Alert'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setAlert($values); + unset($data['Alert']); + } + if (\array_key_exists('AlertDetail', $data)) { + $values_1 = []; + foreach ($data['AlertDetail'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ResponseAlertDetail::class, 'json', $context); } - return $data; + $object->setAlertDetail($values_1); + unset($data['AlertDetail']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } } + return $object; } -} else { - class AcceptanceAuditPreCheckResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $values = []; + foreach ($data->getAlert() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Alert'] = $values; } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('AlertDetail', $data)) { - $values_1 = []; - foreach ($data['AlertDetail'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ResponseAlertDetail::class, 'json', $context); - } - $object->setAlertDetail($values_1); - unset($data['AlertDetail']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } + if ($data->isInitialized('alertDetail') && null !== $data->getAlertDetail()) { + $values_1 = []; + foreach ($data->getAlertDetail() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $object; + $dataArray['AlertDetail'] = $values_1; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('alertDetail') && null !== $object->getAlertDetail()) { - $values_1 = []; - foreach ($object->getAlertDetail() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['AlertDetail'] = $values_1; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AcceptanceAuditPreCheckResponseServiceNormalizer.php b/src/Api/Normalizer/AcceptanceAuditPreCheckResponseServiceNormalizer.php index 4ae3abb0..5a63210d 100644 --- a/src/Api/Normalizer/AcceptanceAuditPreCheckResponseServiceNormalizer.php +++ b/src/Api/Normalizer/AcceptanceAuditPreCheckResponseServiceNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AcceptanceAuditPreCheckResponseServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AcceptanceAuditPreCheckResponseServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class; + return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class AcceptanceAuditPreCheckResponseServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AcceptanceAuditPreCheckShipmentPackageNormalizer.php b/src/Api/Normalizer/AcceptanceAuditPreCheckShipmentPackageNormalizer.php index bff346c9..5932cc22 100644 --- a/src/Api/Normalizer/AcceptanceAuditPreCheckShipmentPackageNormalizer.php +++ b/src/Api/Normalizer/AcceptanceAuditPreCheckShipmentPackageNormalizer.php @@ -5,232 +5,115 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AcceptanceAuditPreCheckShipmentPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AcceptanceAuditPreCheckShipmentPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageIdentifier', $data)) { - $object->setPackageIdentifier($data['PackageIdentifier']); - unset($data['PackageIdentifier']); - } - if (\array_key_exists('PackageWeight', $data)) { - $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\PackagePackageWeight::class, 'json', $context)); - unset($data['PackageWeight']); - } - if (\array_key_exists('QValue', $data)) { - $object->setQValue($data['QValue']); - unset($data['QValue']); - } - if (\array_key_exists('OverPackedIndicator', $data)) { - $object->setOverPackedIndicator($data['OverPackedIndicator']); - unset($data['OverPackedIndicator']); - } - if (\array_key_exists('TransportationMode', $data)) { - $object->setTransportationMode($data['TransportationMode']); - unset($data['TransportationMode']); - } - if (\array_key_exists('EmergencyPhone', $data)) { - $object->setEmergencyPhone($data['EmergencyPhone']); - unset($data['EmergencyPhone']); - } - if (\array_key_exists('EmergencyContact', $data)) { - $object->setEmergencyContact($data['EmergencyContact']); - unset($data['EmergencyContact']); - } - if (\array_key_exists('ChemicalRecord', $data)) { - $values = []; - foreach ($data['ChemicalRecord'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageChemicalRecord::class, 'json', $context); - } - $object->setChemicalRecord($values); - unset($data['ChemicalRecord']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PackageIdentifier'] = $object->getPackageIdentifier(); - $data['PackageWeight'] = $this->normalizer->normalize($object->getPackageWeight(), 'json', $context); - if ($object->isInitialized('qValue') && null !== $object->getQValue()) { - $data['QValue'] = $object->getQValue(); - } - if ($object->isInitialized('overPackedIndicator') && null !== $object->getOverPackedIndicator()) { - $data['OverPackedIndicator'] = $object->getOverPackedIndicator(); - } - if ($object->isInitialized('transportationMode') && null !== $object->getTransportationMode()) { - $data['TransportationMode'] = $object->getTransportationMode(); - } - if ($object->isInitialized('emergencyPhone') && null !== $object->getEmergencyPhone()) { - $data['EmergencyPhone'] = $object->getEmergencyPhone(); - } - if ($object->isInitialized('emergencyContact') && null !== $object->getEmergencyContact()) { - $data['EmergencyContact'] = $object->getEmergencyContact(); - } + if (\array_key_exists('PackageIdentifier', $data)) { + $object->setPackageIdentifier($data['PackageIdentifier']); + unset($data['PackageIdentifier']); + } + if (\array_key_exists('PackageWeight', $data)) { + $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\PackagePackageWeight::class, 'json', $context)); + unset($data['PackageWeight']); + } + if (\array_key_exists('QValue', $data)) { + $object->setQValue($data['QValue']); + unset($data['QValue']); + } + if (\array_key_exists('OverPackedIndicator', $data)) { + $object->setOverPackedIndicator($data['OverPackedIndicator']); + unset($data['OverPackedIndicator']); + } + if (\array_key_exists('TransportationMode', $data)) { + $object->setTransportationMode($data['TransportationMode']); + unset($data['TransportationMode']); + } + if (\array_key_exists('EmergencyPhone', $data)) { + $object->setEmergencyPhone($data['EmergencyPhone']); + unset($data['EmergencyPhone']); + } + if (\array_key_exists('EmergencyContact', $data)) { + $object->setEmergencyContact($data['EmergencyContact']); + unset($data['EmergencyContact']); + } + if (\array_key_exists('ChemicalRecord', $data)) { $values = []; - foreach ($object->getChemicalRecord() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['ChemicalRecord'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageChemicalRecord::class, 'json', $context); } - $data['ChemicalRecord'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setChemicalRecord($values); + unset($data['ChemicalRecord']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class AcceptanceAuditPreCheckShipmentPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageIdentifier', $data)) { - $object->setPackageIdentifier($data['PackageIdentifier']); - unset($data['PackageIdentifier']); - } - if (\array_key_exists('PackageWeight', $data)) { - $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\PackagePackageWeight::class, 'json', $context)); - unset($data['PackageWeight']); - } - if (\array_key_exists('QValue', $data)) { - $object->setQValue($data['QValue']); - unset($data['QValue']); - } - if (\array_key_exists('OverPackedIndicator', $data)) { - $object->setOverPackedIndicator($data['OverPackedIndicator']); - unset($data['OverPackedIndicator']); - } - if (\array_key_exists('TransportationMode', $data)) { - $object->setTransportationMode($data['TransportationMode']); - unset($data['TransportationMode']); - } - if (\array_key_exists('EmergencyPhone', $data)) { - $object->setEmergencyPhone($data['EmergencyPhone']); - unset($data['EmergencyPhone']); - } - if (\array_key_exists('EmergencyContact', $data)) { - $object->setEmergencyContact($data['EmergencyContact']); - unset($data['EmergencyContact']); - } - if (\array_key_exists('ChemicalRecord', $data)) { - $values = []; - foreach ($data['ChemicalRecord'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageChemicalRecord::class, 'json', $context); - } - $object->setChemicalRecord($values); - unset($data['ChemicalRecord']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray = []; + $dataArray['PackageIdentifier'] = $data->getPackageIdentifier(); + $dataArray['PackageWeight'] = $this->normalizer->normalize($data->getPackageWeight(), 'json', $context); + if ($data->isInitialized('qValue') && null !== $data->getQValue()) { + $dataArray['QValue'] = $data->getQValue(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PackageIdentifier'] = $object->getPackageIdentifier(); - $data['PackageWeight'] = $this->normalizer->normalize($object->getPackageWeight(), 'json', $context); - if ($object->isInitialized('qValue') && null !== $object->getQValue()) { - $data['QValue'] = $object->getQValue(); - } - if ($object->isInitialized('overPackedIndicator') && null !== $object->getOverPackedIndicator()) { - $data['OverPackedIndicator'] = $object->getOverPackedIndicator(); - } - if ($object->isInitialized('transportationMode') && null !== $object->getTransportationMode()) { - $data['TransportationMode'] = $object->getTransportationMode(); - } - if ($object->isInitialized('emergencyPhone') && null !== $object->getEmergencyPhone()) { - $data['EmergencyPhone'] = $object->getEmergencyPhone(); - } - if ($object->isInitialized('emergencyContact') && null !== $object->getEmergencyContact()) { - $data['EmergencyContact'] = $object->getEmergencyContact(); - } - $values = []; - foreach ($object->getChemicalRecord() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ChemicalRecord'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('overPackedIndicator') && null !== $data->getOverPackedIndicator()) { + $dataArray['OverPackedIndicator'] = $data->getOverPackedIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class => false]; + if ($data->isInitialized('transportationMode') && null !== $data->getTransportationMode()) { + $dataArray['TransportationMode'] = $data->getTransportationMode(); } + if ($data->isInitialized('emergencyPhone') && null !== $data->getEmergencyPhone()) { + $dataArray['EmergencyPhone'] = $data->getEmergencyPhone(); + } + if ($data->isInitialized('emergencyContact') && null !== $data->getEmergencyContact()) { + $dataArray['EmergencyContact'] = $data->getEmergencyContact(); + } + $values = []; + foreach ($data->getChemicalRecord() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['ChemicalRecord'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AcceptanceAuditPreCheckShipmentShipFromAddressNormalizer.php b/src/Api/Normalizer/AcceptanceAuditPreCheckShipmentShipFromAddressNormalizer.php index 71446f2b..8b5a83b7 100644 --- a/src/Api/Normalizer/AcceptanceAuditPreCheckShipmentShipFromAddressNormalizer.php +++ b/src/Api/Normalizer/AcceptanceAuditPreCheckShipmentShipFromAddressNormalizer.php @@ -5,182 +5,90 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AcceptanceAuditPreCheckShipmentShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AcceptanceAuditPreCheckShipmentShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class; + return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $data['AddressLine'] = $object->getAddressLine(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressLine', $data)) { + $object->setAddressLine($data['AddressLine']); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class => false]; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class AcceptanceAuditPreCheckShipmentShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class; + $dataArray = []; + if ($data->isInitialized('addressLine') && null !== $data->getAddressLine()) { + $dataArray['AddressLine'] = $data->getAddressLine(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class; + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $data['AddressLine'] = $object->getAddressLine(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AcceptanceAuditPreCheckShipmentShipToAddressNormalizer.php b/src/Api/Normalizer/AcceptanceAuditPreCheckShipmentShipToAddressNormalizer.php index 0a2bf8f3..d6754030 100644 --- a/src/Api/Normalizer/AcceptanceAuditPreCheckShipmentShipToAddressNormalizer.php +++ b/src/Api/Normalizer/AcceptanceAuditPreCheckShipmentShipToAddressNormalizer.php @@ -5,182 +5,90 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AcceptanceAuditPreCheckShipmentShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AcceptanceAuditPreCheckShipmentShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class; + return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $data['AddressLine'] = $object->getAddressLine(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressLine', $data)) { + $object->setAddressLine($data['AddressLine']); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class => false]; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class AcceptanceAuditPreCheckShipmentShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class; + $dataArray = []; + if ($data->isInitialized('addressLine') && null !== $data->getAddressLine()) { + $dataArray['AddressLine'] = $data->getAddressLine(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class; + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $data['AddressLine'] = $object->getAddressLine(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AccessPointInformationAccessPointStatusNormalizer.php b/src/Api/Normalizer/AccessPointInformationAccessPointStatusNormalizer.php index b04db844..97691091 100644 --- a/src/Api/Normalizer/AccessPointInformationAccessPointStatusNormalizer.php +++ b/src/Api/Normalizer/AccessPointInformationAccessPointStatusNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AccessPointInformationAccessPointStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AccessPointInformationAccessPointStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class; + return $type === \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class => false]; - } - } -} else { - class AccessPointInformationAccessPointStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AccessPointInformationAvailabilityNormalizer.php b/src/Api/Normalizer/AccessPointInformationAvailabilityNormalizer.php index 6ff61023..4d0ca85b 100644 --- a/src/Api/Normalizer/AccessPointInformationAvailabilityNormalizer.php +++ b/src/Api/Normalizer/AccessPointInformationAvailabilityNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AccessPointInformationAvailabilityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AccessPointInformationAvailabilityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class; + return $type === \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AccessPointInformationAvailability(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShippingAvailability', $data)) { - $object->setShippingAvailability($this->denormalizer->denormalize($data['ShippingAvailability'], \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class, 'json', $context)); - unset($data['ShippingAvailability']); - } - if (\array_key_exists('DCRAvailability', $data)) { - $object->setDCRAvailability($this->denormalizer->denormalize($data['DCRAvailability'], \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class, 'json', $context)); - unset($data['DCRAvailability']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AccessPointInformationAvailability(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('shippingAvailability') && null !== $object->getShippingAvailability()) { - $data['ShippingAvailability'] = $this->normalizer->normalize($object->getShippingAvailability(), 'json', $context); - } - if ($object->isInitialized('dCRAvailability') && null !== $object->getDCRAvailability()) { - $data['DCRAvailability'] = $this->normalizer->normalize($object->getDCRAvailability(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ShippingAvailability', $data)) { + $object->setShippingAvailability($this->denormalizer->denormalize($data['ShippingAvailability'], \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class, 'json', $context)); + unset($data['ShippingAvailability']); + } + if (\array_key_exists('DCRAvailability', $data)) { + $object->setDCRAvailability($this->denormalizer->denormalize($data['DCRAvailability'], \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class, 'json', $context)); + unset($data['DCRAvailability']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class AccessPointInformationAvailabilityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class; + $dataArray = []; + if ($data->isInitialized('shippingAvailability') && null !== $data->getShippingAvailability()) { + $dataArray['ShippingAvailability'] = $this->normalizer->normalize($data->getShippingAvailability(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AccessPointInformationAvailability(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShippingAvailability', $data)) { - $object->setShippingAvailability($this->denormalizer->denormalize($data['ShippingAvailability'], \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class, 'json', $context)); - unset($data['ShippingAvailability']); - } - if (\array_key_exists('DCRAvailability', $data)) { - $object->setDCRAvailability($this->denormalizer->denormalize($data['DCRAvailability'], \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class, 'json', $context)); - unset($data['DCRAvailability']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('dCRAvailability') && null !== $data->getDCRAvailability()) { + $dataArray['DCRAvailability'] = $this->normalizer->normalize($data->getDCRAvailability(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('shippingAvailability') && null !== $object->getShippingAvailability()) { - $data['ShippingAvailability'] = $this->normalizer->normalize($object->getShippingAvailability(), 'json', $context); - } - if ($object->isInitialized('dCRAvailability') && null !== $object->getDCRAvailability()) { - $data['DCRAvailability'] = $this->normalizer->normalize($object->getDCRAvailability(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AccessPointInformationBusinessClassificationListNormalizer.php b/src/Api/Normalizer/AccessPointInformationBusinessClassificationListNormalizer.php index 171c4ead..c4d2d979 100644 --- a/src/Api/Normalizer/AccessPointInformationBusinessClassificationListNormalizer.php +++ b/src/Api/Normalizer/AccessPointInformationBusinessClassificationListNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AccessPointInformationBusinessClassificationListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AccessPointInformationBusinessClassificationListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class; + return $type === \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BusinessClassification', $data)) { - $values = []; - foreach ($data['BusinessClassification'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class, 'json', $context); - } - $object->setBusinessClassification($values); - unset($data['BusinessClassification']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('BusinessClassification', $data)) { $values = []; - foreach ($object->getBusinessClassification() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['BusinessClassification'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class, 'json', $context); } - $data['BusinessClassification'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setBusinessClassification($values); + unset($data['BusinessClassification']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class AccessPointInformationBusinessClassificationListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class; + $dataArray = []; + $values = []; + foreach ($data->getBusinessClassification() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['BusinessClassification'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BusinessClassification', $data)) { - $values = []; - foreach ($data['BusinessClassification'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class, 'json', $context); - } - $object->setBusinessClassification($values); - unset($data['BusinessClassification']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getBusinessClassification() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['BusinessClassification'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AccessPointInformationNormalizer.php b/src/Api/Normalizer/AccessPointInformationNormalizer.php index 8148ec85..1ff92c63 100644 --- a/src/Api/Normalizer/AccessPointInformationNormalizer.php +++ b/src/Api/Normalizer/AccessPointInformationNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AccessPointInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AccessPointInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointInformation::class; + return $type === \ShipStream\Ups\Api\Model\AccessPointInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AccessPointInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('pickupByDate', $data)) { - $object->setPickupByDate($data['pickupByDate']); - unset($data['pickupByDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AccessPointInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('pickupByDate') && null !== $object->getPickupByDate()) { - $data['pickupByDate'] = $object->getPickupByDate(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('pickupByDate', $data)) { + $object->setPickupByDate($data['pickupByDate']); + unset($data['pickupByDate']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointInformation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class AccessPointInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointInformation::class; + $dataArray = []; + if ($data->isInitialized('pickupByDate') && null !== $data->getPickupByDate()) { + $dataArray['pickupByDate'] = $data->getPickupByDate(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AccessPointInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('pickupByDate', $data)) { - $object->setPickupByDate($data['pickupByDate']); - unset($data['pickupByDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('pickupByDate') && null !== $object->getPickupByDate()) { - $data['pickupByDate'] = $object->getPickupByDate(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AccessPointInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AccessPointInformationPrivateNetworkListNormalizer.php b/src/Api/Normalizer/AccessPointInformationPrivateNetworkListNormalizer.php index 0e14d49e..42af1002 100644 --- a/src/Api/Normalizer/AccessPointInformationPrivateNetworkListNormalizer.php +++ b/src/Api/Normalizer/AccessPointInformationPrivateNetworkListNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AccessPointInformationPrivateNetworkListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AccessPointInformationPrivateNetworkListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class; + return $type === \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PrivateNetwork', $data)) { - $values = []; - foreach ($data['PrivateNetwork'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class, 'json', $context); - } - $object->setPrivateNetwork($values); - unset($data['PrivateNetwork']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('PrivateNetwork', $data)) { $values = []; - foreach ($object->getPrivateNetwork() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['PrivateNetwork'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class, 'json', $context); } - $data['PrivateNetwork'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setPrivateNetwork($values); + unset($data['PrivateNetwork']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class AccessPointInformationPrivateNetworkListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class; + $dataArray = []; + $values = []; + foreach ($data->getPrivateNetwork() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['PrivateNetwork'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PrivateNetwork', $data)) { - $values = []; - foreach ($data['PrivateNetwork'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class, 'json', $context); - } - $object->setPrivateNetwork($values); - unset($data['PrivateNetwork']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getPrivateNetwork() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PrivateNetwork'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AccessPointSearchExcludeFromResultNormalizer.php b/src/Api/Normalizer/AccessPointSearchExcludeFromResultNormalizer.php index b290674d..afe429c6 100644 --- a/src/Api/Normalizer/AccessPointSearchExcludeFromResultNormalizer.php +++ b/src/Api/Normalizer/AccessPointSearchExcludeFromResultNormalizer.php @@ -5,188 +5,93 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AccessPointSearchExcludeFromResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AccessPointSearchExcludeFromResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class; + return $type === \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BusinessClassificationCode', $data)) { - $values = []; - foreach ($data['BusinessClassificationCode'] as $value) { - $values[] = $value; - } - $object->setBusinessClassificationCode($values); - unset($data['BusinessClassificationCode']); - } - if (\array_key_exists('BusinessName', $data)) { - $object->setBusinessName($data['BusinessName']); - unset($data['BusinessName']); - } - if (\array_key_exists('Radius', $data)) { - $object->setRadius($data['Radius']); - unset($data['Radius']); - } - if (\array_key_exists('PostalCodeList', $data)) { - $object->setPostalCodeList($this->denormalizer->denormalize($data['PostalCodeList'], \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class, 'json', $context)); - unset($data['PostalCodeList']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('businessClassificationCode') && null !== $object->getBusinessClassificationCode()) { - $values = []; - foreach ($object->getBusinessClassificationCode() as $value) { - $values[] = $value; - } - $data['BusinessClassificationCode'] = $values; - } - if ($object->isInitialized('businessName') && null !== $object->getBusinessName()) { - $data['BusinessName'] = $object->getBusinessName(); - } - if ($object->isInitialized('radius') && null !== $object->getRadius()) { - $data['Radius'] = $object->getRadius(); - } - if ($object->isInitialized('postalCodeList') && null !== $object->getPostalCodeList()) { - $data['PostalCodeList'] = $this->normalizer->normalize($object->getPostalCodeList(), 'json', $context); + if (\array_key_exists('BusinessClassificationCode', $data)) { + $values = []; + foreach ($data['BusinessClassificationCode'] as $value) { + $values[] = $value; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setBusinessClassificationCode($values); + unset($data['BusinessClassificationCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class => false]; + if (\array_key_exists('BusinessName', $data)) { + $object->setBusinessName($data['BusinessName']); + unset($data['BusinessName']); } - } -} else { - class AccessPointSearchExcludeFromResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class; + if (\array_key_exists('Radius', $data)) { + $object->setRadius($data['Radius']); + unset($data['Radius']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class; + if (\array_key_exists('PostalCodeList', $data)) { + $object->setPostalCodeList($this->denormalizer->denormalize($data['PostalCodeList'], \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class, 'json', $context)); + unset($data['PostalCodeList']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; } - $object = new \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BusinessClassificationCode', $data)) { - $values = []; - foreach ($data['BusinessClassificationCode'] as $value) { - $values[] = $value; - } - $object->setBusinessClassificationCode($values); - unset($data['BusinessClassificationCode']); - } - if (\array_key_exists('BusinessName', $data)) { - $object->setBusinessName($data['BusinessName']); - unset($data['BusinessName']); - } - if (\array_key_exists('Radius', $data)) { - $object->setRadius($data['Radius']); - unset($data['Radius']); - } - if (\array_key_exists('PostalCodeList', $data)) { - $object->setPostalCodeList($this->denormalizer->denormalize($data['PostalCodeList'], \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class, 'json', $context)); - unset($data['PostalCodeList']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('businessClassificationCode') && null !== $object->getBusinessClassificationCode()) { - $values = []; - foreach ($object->getBusinessClassificationCode() as $value) { - $values[] = $value; - } - $data['BusinessClassificationCode'] = $values; - } - if ($object->isInitialized('businessName') && null !== $object->getBusinessName()) { - $data['BusinessName'] = $object->getBusinessName(); - } - if ($object->isInitialized('radius') && null !== $object->getRadius()) { - $data['Radius'] = $object->getRadius(); - } - if ($object->isInitialized('postalCodeList') && null !== $object->getPostalCodeList()) { - $data['PostalCodeList'] = $this->normalizer->normalize($object->getPostalCodeList(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('businessClassificationCode') && null !== $data->getBusinessClassificationCode()) { + $values = []; + foreach ($data->getBusinessClassificationCode() as $value) { + $values[] = $value; } - return $data; + $dataArray['BusinessClassificationCode'] = $values; + } + if ($data->isInitialized('businessName') && null !== $data->getBusinessName()) { + $dataArray['BusinessName'] = $data->getBusinessName(); + } + if ($data->isInitialized('radius') && null !== $data->getRadius()) { + $dataArray['Radius'] = $data->getRadius(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class => false]; + if ($data->isInitialized('postalCodeList') && null !== $data->getPostalCodeList()) { + $dataArray['PostalCodeList'] = $this->normalizer->normalize($data->getPostalCodeList(), 'json', $context); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AccessPointSearchIncludeCriteriaNormalizer.php b/src/Api/Normalizer/AccessPointSearchIncludeCriteriaNormalizer.php index 629d3cec..cb6a92b5 100644 --- a/src/Api/Normalizer/AccessPointSearchIncludeCriteriaNormalizer.php +++ b/src/Api/Normalizer/AccessPointSearchIncludeCriteriaNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AccessPointSearchIncludeCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AccessPointSearchIncludeCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class; + return $type === \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('MerchantAccountNumberList', $data)) { - $object->setMerchantAccountNumberList($this->denormalizer->denormalize($data['MerchantAccountNumberList'], \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class, 'json', $context)); - unset($data['MerchantAccountNumberList']); - } - if (\array_key_exists('SearchFilter', $data)) { - $object->setSearchFilter($this->denormalizer->denormalize($data['SearchFilter'], \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class, 'json', $context)); - unset($data['SearchFilter']); - } - if (\array_key_exists('ServiceOfferingList', $data)) { - $object->setServiceOfferingList($this->denormalizer->denormalize($data['ServiceOfferingList'], \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class, 'json', $context)); - unset($data['ServiceOfferingList']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('merchantAccountNumberList') && null !== $object->getMerchantAccountNumberList()) { - $data['MerchantAccountNumberList'] = $this->normalizer->normalize($object->getMerchantAccountNumberList(), 'json', $context); - } - if ($object->isInitialized('searchFilter') && null !== $object->getSearchFilter()) { - $data['SearchFilter'] = $this->normalizer->normalize($object->getSearchFilter(), 'json', $context); - } - if ($object->isInitialized('serviceOfferingList') && null !== $object->getServiceOfferingList()) { - $data['ServiceOfferingList'] = $this->normalizer->normalize($object->getServiceOfferingList(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('MerchantAccountNumberList', $data)) { + $object->setMerchantAccountNumberList($this->denormalizer->denormalize($data['MerchantAccountNumberList'], \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class, 'json', $context)); + unset($data['MerchantAccountNumberList']); + } + if (\array_key_exists('SearchFilter', $data)) { + $object->setSearchFilter($this->denormalizer->denormalize($data['SearchFilter'], \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class, 'json', $context)); + unset($data['SearchFilter']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class => false]; + if (\array_key_exists('ServiceOfferingList', $data)) { + $object->setServiceOfferingList($this->denormalizer->denormalize($data['ServiceOfferingList'], \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class, 'json', $context)); + unset($data['ServiceOfferingList']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class AccessPointSearchIncludeCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class; + $dataArray = []; + if ($data->isInitialized('merchantAccountNumberList') && null !== $data->getMerchantAccountNumberList()) { + $dataArray['MerchantAccountNumberList'] = $this->normalizer->normalize($data->getMerchantAccountNumberList(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class; + if ($data->isInitialized('searchFilter') && null !== $data->getSearchFilter()) { + $dataArray['SearchFilter'] = $this->normalizer->normalize($data->getSearchFilter(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('MerchantAccountNumberList', $data)) { - $object->setMerchantAccountNumberList($this->denormalizer->denormalize($data['MerchantAccountNumberList'], \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class, 'json', $context)); - unset($data['MerchantAccountNumberList']); - } - if (\array_key_exists('SearchFilter', $data)) { - $object->setSearchFilter($this->denormalizer->denormalize($data['SearchFilter'], \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class, 'json', $context)); - unset($data['SearchFilter']); - } - if (\array_key_exists('ServiceOfferingList', $data)) { - $object->setServiceOfferingList($this->denormalizer->denormalize($data['ServiceOfferingList'], \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class, 'json', $context)); - unset($data['ServiceOfferingList']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('serviceOfferingList') && null !== $data->getServiceOfferingList()) { + $dataArray['ServiceOfferingList'] = $this->normalizer->normalize($data->getServiceOfferingList(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('merchantAccountNumberList') && null !== $object->getMerchantAccountNumberList()) { - $data['MerchantAccountNumberList'] = $this->normalizer->normalize($object->getMerchantAccountNumberList(), 'json', $context); - } - if ($object->isInitialized('searchFilter') && null !== $object->getSearchFilter()) { - $data['SearchFilter'] = $this->normalizer->normalize($object->getSearchFilter(), 'json', $context); - } - if ($object->isInitialized('serviceOfferingList') && null !== $object->getServiceOfferingList()) { - $data['ServiceOfferingList'] = $this->normalizer->normalize($object->getServiceOfferingList(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ActivityLocationAddressArtifactFormatNormalizer.php b/src/Api/Normalizer/ActivityLocationAddressArtifactFormatNormalizer.php index d02e3640..7fec5100 100644 --- a/src/Api/Normalizer/ActivityLocationAddressArtifactFormatNormalizer.php +++ b/src/Api/Normalizer/ActivityLocationAddressArtifactFormatNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ActivityLocationAddressArtifactFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ActivityLocationAddressArtifactFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class; + return $type === \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('politicalDivision2') && null !== $object->getPoliticalDivision2()) { - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - } - if ($object->isInitialized('politicalDivision1') && null !== $object->getPoliticalDivision1()) { - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PoliticalDivision2', $data)) { + $object->setPoliticalDivision2($data['PoliticalDivision2']); + unset($data['PoliticalDivision2']); + } + if (\array_key_exists('PoliticalDivision1', $data)) { + $object->setPoliticalDivision1($data['PoliticalDivision1']); + unset($data['PoliticalDivision1']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class => false]; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ActivityLocationAddressArtifactFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class; + $dataArray = []; + if ($data->isInitialized('politicalDivision2') && null !== $data->getPoliticalDivision2()) { + $dataArray['PoliticalDivision2'] = $data->getPoliticalDivision2(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class; + if ($data->isInitialized('politicalDivision1') && null !== $data->getPoliticalDivision1()) { + $dataArray['PoliticalDivision1'] = $data->getPoliticalDivision1(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('countryCode') && null !== $data->getCountryCode()) { + $dataArray['CountryCode'] = $data->getCountryCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('politicalDivision2') && null !== $object->getPoliticalDivision2()) { - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - } - if ($object->isInitialized('politicalDivision1') && null !== $object->getPoliticalDivision1()) { - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ActivityNormalizer.php b/src/Api/Normalizer/ActivityNormalizer.php index 534d2cca..1d63e4fe 100644 --- a/src/Api/Normalizer/ActivityNormalizer.php +++ b/src/Api/Normalizer/ActivityNormalizer.php @@ -5,214 +5,106 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ActivityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ActivityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Activity::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Activity::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Activity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('date', $data)) { - $object->setDate($data['date']); - unset($data['date']); - } - if (\array_key_exists('gmtDate', $data)) { - $object->setGmtDate($data['gmtDate']); - unset($data['gmtDate']); - } - if (\array_key_exists('gmtOffset', $data)) { - $object->setGmtOffset($data['gmtOffset']); - unset($data['gmtOffset']); - } - if (\array_key_exists('gmtTime', $data)) { - $object->setGmtTime($data['gmtTime']); - unset($data['gmtTime']); - } - if (\array_key_exists('location', $data)) { - $object->setLocation($this->denormalizer->denormalize($data['location'], \ShipStream\Ups\Api\Model\Location::class, 'json', $context)); - unset($data['location']); - } - if (\array_key_exists('status', $data)) { - $object->setStatus($this->denormalizer->denormalize($data['status'], \ShipStream\Ups\Api\Model\Status::class, 'json', $context)); - unset($data['status']); - } - if (\array_key_exists('time', $data)) { - $object->setTime($data['time']); - unset($data['time']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\Activity::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Activity::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\Activity(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('date') && null !== $object->getDate()) { - $data['date'] = $object->getDate(); - } - if ($object->isInitialized('gmtDate') && null !== $object->getGmtDate()) { - $data['gmtDate'] = $object->getGmtDate(); - } - if ($object->isInitialized('gmtOffset') && null !== $object->getGmtOffset()) { - $data['gmtOffset'] = $object->getGmtOffset(); - } - if ($object->isInitialized('gmtTime') && null !== $object->getGmtTime()) { - $data['gmtTime'] = $object->getGmtTime(); - } - if ($object->isInitialized('location') && null !== $object->getLocation()) { - $data['location'] = $this->normalizer->normalize($object->getLocation(), 'json', $context); - } - if ($object->isInitialized('status') && null !== $object->getStatus()) { - $data['status'] = $this->normalizer->normalize($object->getStatus(), 'json', $context); - } - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['time'] = $object->getTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('date', $data)) { + $object->setDate($data['date']); + unset($data['date']); + } + if (\array_key_exists('gmtDate', $data)) { + $object->setGmtDate($data['gmtDate']); + unset($data['gmtDate']); + } + if (\array_key_exists('gmtOffset', $data)) { + $object->setGmtOffset($data['gmtOffset']); + unset($data['gmtOffset']); + } + if (\array_key_exists('gmtTime', $data)) { + $object->setGmtTime($data['gmtTime']); + unset($data['gmtTime']); + } + if (\array_key_exists('location', $data)) { + $object->setLocation($this->denormalizer->denormalize($data['location'], \ShipStream\Ups\Api\Model\Location::class, 'json', $context)); + unset($data['location']); + } + if (\array_key_exists('status', $data)) { + $object->setStatus($this->denormalizer->denormalize($data['status'], \ShipStream\Ups\Api\Model\Status::class, 'json', $context)); + unset($data['status']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Activity::class => false]; + if (\array_key_exists('time', $data)) { + $object->setTime($data['time']); + unset($data['time']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ActivityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Activity::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Activity::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Activity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('date', $data)) { - $object->setDate($data['date']); - unset($data['date']); - } - if (\array_key_exists('gmtDate', $data)) { - $object->setGmtDate($data['gmtDate']); - unset($data['gmtDate']); - } - if (\array_key_exists('gmtOffset', $data)) { - $object->setGmtOffset($data['gmtOffset']); - unset($data['gmtOffset']); - } - if (\array_key_exists('gmtTime', $data)) { - $object->setGmtTime($data['gmtTime']); - unset($data['gmtTime']); - } - if (\array_key_exists('location', $data)) { - $object->setLocation($this->denormalizer->denormalize($data['location'], \ShipStream\Ups\Api\Model\Location::class, 'json', $context)); - unset($data['location']); - } - if (\array_key_exists('status', $data)) { - $object->setStatus($this->denormalizer->denormalize($data['status'], \ShipStream\Ups\Api\Model\Status::class, 'json', $context)); - unset($data['status']); - } - if (\array_key_exists('time', $data)) { - $object->setTime($data['time']); - unset($data['time']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('date') && null !== $data->getDate()) { + $dataArray['date'] = $data->getDate(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('date') && null !== $object->getDate()) { - $data['date'] = $object->getDate(); - } - if ($object->isInitialized('gmtDate') && null !== $object->getGmtDate()) { - $data['gmtDate'] = $object->getGmtDate(); - } - if ($object->isInitialized('gmtOffset') && null !== $object->getGmtOffset()) { - $data['gmtOffset'] = $object->getGmtOffset(); - } - if ($object->isInitialized('gmtTime') && null !== $object->getGmtTime()) { - $data['gmtTime'] = $object->getGmtTime(); - } - if ($object->isInitialized('location') && null !== $object->getLocation()) { - $data['location'] = $this->normalizer->normalize($object->getLocation(), 'json', $context); - } - if ($object->isInitialized('status') && null !== $object->getStatus()) { - $data['status'] = $this->normalizer->normalize($object->getStatus(), 'json', $context); - } - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['time'] = $object->getTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('gmtDate') && null !== $data->getGmtDate()) { + $dataArray['gmtDate'] = $data->getGmtDate(); + } + if ($data->isInitialized('gmtOffset') && null !== $data->getGmtOffset()) { + $dataArray['gmtOffset'] = $data->getGmtOffset(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Activity::class => false]; + if ($data->isInitialized('gmtTime') && null !== $data->getGmtTime()) { + $dataArray['gmtTime'] = $data->getGmtTime(); } + if ($data->isInitialized('location') && null !== $data->getLocation()) { + $dataArray['location'] = $this->normalizer->normalize($data->getLocation(), 'json', $context); + } + if ($data->isInitialized('status') && null !== $data->getStatus()) { + $dataArray['status'] = $this->normalizer->normalize($data->getStatus(), 'json', $context); + } + if ($data->isInitialized('time') && null !== $data->getTime()) { + $dataArray['time'] = $data->getTime(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Activity::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AdditionalCommentsCommentTypeNormalizer.php b/src/Api/Normalizer/AdditionalCommentsCommentTypeNormalizer.php index fe072e67..78181983 100644 --- a/src/Api/Normalizer/AdditionalCommentsCommentTypeNormalizer.php +++ b/src/Api/Normalizer/AdditionalCommentsCommentTypeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AdditionalCommentsCommentTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AdditionalCommentsCommentTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class; + return $type === \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Text', $data)) { - $object->setText($data['Text']); - unset($data['Text']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Text'] = $object->getText(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class => false]; - } - } -} else { - class AdditionalCommentsCommentTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class; + if (\array_key_exists('Text', $data)) { + $object->setText($data['Text']); + unset($data['Text']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Text', $data)) { - $object->setText($data['Text']); - unset($data['Text']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Text'] = $object->getText(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Text'] = $data->getText(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AddressArtifactFormatAddressExtendedInformationNormalizer.php b/src/Api/Normalizer/AddressArtifactFormatAddressExtendedInformationNormalizer.php index f88978e0..1bab7f93 100644 --- a/src/Api/Normalizer/AddressArtifactFormatAddressExtendedInformationNormalizer.php +++ b/src/Api/Normalizer/AddressArtifactFormatAddressExtendedInformationNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AddressArtifactFormatAddressExtendedInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AddressArtifactFormatAddressExtendedInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class; + return $type === \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('Low', $data)) { - $object->setLow($data['Low']); - unset($data['Low']); - } - if (\array_key_exists('High', $data)) { - $object->setHigh($data['High']); - unset($data['High']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['Type'] = $object->getType(); - } - if ($object->isInitialized('low') && null !== $object->getLow()) { - $data['Low'] = $object->getLow(); - } - if ($object->isInitialized('high') && null !== $object->getHigh()) { - $data['High'] = $object->getHigh(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Type', $data)) { + $object->setType($data['Type']); + unset($data['Type']); + } + if (\array_key_exists('Low', $data)) { + $object->setLow($data['Low']); + unset($data['Low']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class => false]; + if (\array_key_exists('High', $data)) { + $object->setHigh($data['High']); + unset($data['High']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class AddressArtifactFormatAddressExtendedInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class; + $dataArray = []; + if ($data->isInitialized('type') && null !== $data->getType()) { + $dataArray['Type'] = $data->getType(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class; + if ($data->isInitialized('low') && null !== $data->getLow()) { + $dataArray['Low'] = $data->getLow(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('Low', $data)) { - $object->setLow($data['Low']); - unset($data['Low']); - } - if (\array_key_exists('High', $data)) { - $object->setHigh($data['High']); - unset($data['High']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('high') && null !== $data->getHigh()) { + $dataArray['High'] = $data->getHigh(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['Type'] = $object->getType(); - } - if ($object->isInitialized('low') && null !== $object->getLow()) { - $data['Low'] = $object->getLow(); - } - if ($object->isInitialized('high') && null !== $object->getHigh()) { - $data['High'] = $object->getHigh(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AddressNormalizer.php b/src/Api/Normalizer/AddressNormalizer.php index 39471675..607ef0a7 100644 --- a/src/Api/Normalizer/AddressNormalizer.php +++ b/src/Api/Normalizer/AddressNormalizer.php @@ -5,264 +5,131 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Address::class; + return $type === \ShipStream\Ups\Api\Model\Address::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Address::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Address::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Address(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('addressLine1', $data) && $data['addressLine1'] !== null) { - $object->setAddressLine1($data['addressLine1']); - unset($data['addressLine1']); - } - elseif (\array_key_exists('addressLine1', $data) && $data['addressLine1'] === null) { - $object->setAddressLine1(null); - } - if (\array_key_exists('addressLine2', $data) && $data['addressLine2'] !== null) { - $object->setAddressLine2($data['addressLine2']); - unset($data['addressLine2']); - } - elseif (\array_key_exists('addressLine2', $data) && $data['addressLine2'] === null) { - $object->setAddressLine2(null); - } - if (\array_key_exists('addressLine3', $data) && $data['addressLine3'] !== null) { - $object->setAddressLine3($data['addressLine3']); - unset($data['addressLine3']); - } - elseif (\array_key_exists('addressLine3', $data) && $data['addressLine3'] === null) { - $object->setAddressLine3(null); - } - if (\array_key_exists('city', $data) && $data['city'] !== null) { - $object->setCity($data['city']); - unset($data['city']); - } - elseif (\array_key_exists('city', $data) && $data['city'] === null) { - $object->setCity(null); - } - if (\array_key_exists('country', $data)) { - $object->setCountry($data['country']); - unset($data['country']); - } - if (\array_key_exists('countryCode', $data)) { - $object->setCountryCode($data['countryCode']); - unset($data['countryCode']); - } - if (\array_key_exists('postalCode', $data) && $data['postalCode'] !== null) { - $object->setPostalCode($data['postalCode']); - unset($data['postalCode']); - } - elseif (\array_key_exists('postalCode', $data) && $data['postalCode'] === null) { - $object->setPostalCode(null); - } - if (\array_key_exists('stateProvince', $data) && $data['stateProvince'] !== null) { - $object->setStateProvince($data['stateProvince']); - unset($data['stateProvince']); - } - elseif (\array_key_exists('stateProvince', $data) && $data['stateProvince'] === null) { - $object->setStateProvince(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\Address(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('addressLine1') && null !== $object->getAddressLine1()) { - $data['addressLine1'] = $object->getAddressLine1(); - } - if ($object->isInitialized('addressLine2') && null !== $object->getAddressLine2()) { - $data['addressLine2'] = $object->getAddressLine2(); - } - if ($object->isInitialized('addressLine3') && null !== $object->getAddressLine3()) { - $data['addressLine3'] = $object->getAddressLine3(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['city'] = $object->getCity(); - } - if ($object->isInitialized('country') && null !== $object->getCountry()) { - $data['country'] = $object->getCountry(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['countryCode'] = $object->getCountryCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['postalCode'] = $object->getPostalCode(); - } - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['stateProvince'] = $object->getStateProvince(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('addressLine1', $data) && $data['addressLine1'] !== null) { + $object->setAddressLine1($data['addressLine1']); + unset($data['addressLine1']); + } + elseif (\array_key_exists('addressLine1', $data) && $data['addressLine1'] === null) { + $object->setAddressLine1(null); + } + if (\array_key_exists('addressLine2', $data) && $data['addressLine2'] !== null) { + $object->setAddressLine2($data['addressLine2']); + unset($data['addressLine2']); + } + elseif (\array_key_exists('addressLine2', $data) && $data['addressLine2'] === null) { + $object->setAddressLine2(null); + } + if (\array_key_exists('addressLine3', $data) && $data['addressLine3'] !== null) { + $object->setAddressLine3($data['addressLine3']); + unset($data['addressLine3']); + } + elseif (\array_key_exists('addressLine3', $data) && $data['addressLine3'] === null) { + $object->setAddressLine3(null); + } + if (\array_key_exists('city', $data) && $data['city'] !== null) { + $object->setCity($data['city']); + unset($data['city']); + } + elseif (\array_key_exists('city', $data) && $data['city'] === null) { + $object->setCity(null); + } + if (\array_key_exists('country', $data)) { + $object->setCountry($data['country']); + unset($data['country']); + } + if (\array_key_exists('countryCode', $data)) { + $object->setCountryCode($data['countryCode']); + unset($data['countryCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Address::class => false]; + if (\array_key_exists('postalCode', $data) && $data['postalCode'] !== null) { + $object->setPostalCode($data['postalCode']); + unset($data['postalCode']); } + elseif (\array_key_exists('postalCode', $data) && $data['postalCode'] === null) { + $object->setPostalCode(null); + } + if (\array_key_exists('stateProvince', $data) && $data['stateProvince'] !== null) { + $object->setStateProvince($data['stateProvince']); + unset($data['stateProvince']); + } + elseif (\array_key_exists('stateProvince', $data) && $data['stateProvince'] === null) { + $object->setStateProvince(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class AddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Address::class; + $dataArray = []; + if ($data->isInitialized('addressLine1')) { + $dataArray['addressLine1'] = $data->getAddressLine1(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Address::class; + if ($data->isInitialized('addressLine2')) { + $dataArray['addressLine2'] = $data->getAddressLine2(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Address(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('addressLine1', $data) && $data['addressLine1'] !== null) { - $object->setAddressLine1($data['addressLine1']); - unset($data['addressLine1']); - } - elseif (\array_key_exists('addressLine1', $data) && $data['addressLine1'] === null) { - $object->setAddressLine1(null); - } - if (\array_key_exists('addressLine2', $data) && $data['addressLine2'] !== null) { - $object->setAddressLine2($data['addressLine2']); - unset($data['addressLine2']); - } - elseif (\array_key_exists('addressLine2', $data) && $data['addressLine2'] === null) { - $object->setAddressLine2(null); - } - if (\array_key_exists('addressLine3', $data) && $data['addressLine3'] !== null) { - $object->setAddressLine3($data['addressLine3']); - unset($data['addressLine3']); - } - elseif (\array_key_exists('addressLine3', $data) && $data['addressLine3'] === null) { - $object->setAddressLine3(null); - } - if (\array_key_exists('city', $data) && $data['city'] !== null) { - $object->setCity($data['city']); - unset($data['city']); - } - elseif (\array_key_exists('city', $data) && $data['city'] === null) { - $object->setCity(null); - } - if (\array_key_exists('country', $data)) { - $object->setCountry($data['country']); - unset($data['country']); - } - if (\array_key_exists('countryCode', $data)) { - $object->setCountryCode($data['countryCode']); - unset($data['countryCode']); - } - if (\array_key_exists('postalCode', $data) && $data['postalCode'] !== null) { - $object->setPostalCode($data['postalCode']); - unset($data['postalCode']); - } - elseif (\array_key_exists('postalCode', $data) && $data['postalCode'] === null) { - $object->setPostalCode(null); - } - if (\array_key_exists('stateProvince', $data) && $data['stateProvince'] !== null) { - $object->setStateProvince($data['stateProvince']); - unset($data['stateProvince']); - } - elseif (\array_key_exists('stateProvince', $data) && $data['stateProvince'] === null) { - $object->setStateProvince(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('addressLine3')) { + $dataArray['addressLine3'] = $data->getAddressLine3(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('addressLine1') && null !== $object->getAddressLine1()) { - $data['addressLine1'] = $object->getAddressLine1(); - } - if ($object->isInitialized('addressLine2') && null !== $object->getAddressLine2()) { - $data['addressLine2'] = $object->getAddressLine2(); - } - if ($object->isInitialized('addressLine3') && null !== $object->getAddressLine3()) { - $data['addressLine3'] = $object->getAddressLine3(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['city'] = $object->getCity(); - } - if ($object->isInitialized('country') && null !== $object->getCountry()) { - $data['country'] = $object->getCountry(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['countryCode'] = $object->getCountryCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['postalCode'] = $object->getPostalCode(); - } - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['stateProvince'] = $object->getStateProvince(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('city')) { + $dataArray['city'] = $data->getCity(); + } + if ($data->isInitialized('country') && null !== $data->getCountry()) { + $dataArray['country'] = $data->getCountry(); + } + if ($data->isInitialized('countryCode') && null !== $data->getCountryCode()) { + $dataArray['countryCode'] = $data->getCountryCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Address::class => false]; + if ($data->isInitialized('postalCode')) { + $dataArray['postalCode'] = $data->getPostalCode(); } + if ($data->isInitialized('stateProvince')) { + $dataArray['stateProvince'] = $data->getStateProvince(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Address::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AdjustedHeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/AdjustedHeightUnitOfMeasurementNormalizer.php index ecddb96c..97815541 100644 --- a/src/Api/Normalizer/AdjustedHeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/AdjustedHeightUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AdjustedHeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AdjustedHeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class AdjustedHeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AdjustedWeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/AdjustedWeightUnitOfMeasurementNormalizer.php index 8770e088..fb12a88b 100644 --- a/src/Api/Normalizer/AdjustedWeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/AdjustedWeightUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AdjustedWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AdjustedWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class AdjustedWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AlertDetailElementLevelInformationNormalizer.php b/src/Api/Normalizer/AlertDetailElementLevelInformationNormalizer.php index 68ce12a3..67b057be 100644 --- a/src/Api/Normalizer/AlertDetailElementLevelInformationNormalizer.php +++ b/src/Api/Normalizer/AlertDetailElementLevelInformationNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AlertDetailElementLevelInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AlertDetailElementLevelInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class; + return $type === \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Level', $data)) { - $object->setLevel($data['Level']); - unset($data['Level']); - } - if (\array_key_exists('ElementIdentifier', $data)) { - $values = []; - foreach ($data['ElementIdentifier'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class, 'json', $context); - } - $object->setElementIdentifier($values); - unset($data['ElementIdentifier']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Level'] = $object->getLevel(); - if ($object->isInitialized('elementIdentifier') && null !== $object->getElementIdentifier()) { - $values = []; - foreach ($object->getElementIdentifier() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ElementIdentifier'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('Level', $data)) { + $object->setLevel($data['Level']); + unset($data['Level']); + } + if (\array_key_exists('ElementIdentifier', $data)) { + $values = []; + foreach ($data['ElementIdentifier'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class, 'json', $context); } - return $data; + $object->setElementIdentifier($values); + unset($data['ElementIdentifier']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class AlertDetailElementLevelInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class; + $dataArray = []; + $dataArray['Level'] = $data->getLevel(); + if ($data->isInitialized('elementIdentifier') && null !== $data->getElementIdentifier()) { + $values = []; + foreach ($data->getElementIdentifier() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['ElementIdentifier'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Level', $data)) { - $object->setLevel($data['Level']); - unset($data['Level']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('ElementIdentifier', $data)) { - $values = []; - foreach ($data['ElementIdentifier'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class, 'json', $context); - } - $object->setElementIdentifier($values); - unset($data['ElementIdentifier']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Level'] = $object->getLevel(); - if ($object->isInitialized('elementIdentifier') && null !== $object->getElementIdentifier()) { - $values = []; - foreach ($object->getElementIdentifier() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ElementIdentifier'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AlternateDeliveryAddressAddressNormalizer.php b/src/Api/Normalizer/AlternateDeliveryAddressAddressNormalizer.php index 6663b679..18320fb3 100644 --- a/src/Api/Normalizer/AlternateDeliveryAddressAddressNormalizer.php +++ b/src/Api/Normalizer/AlternateDeliveryAddressAddressNormalizer.php @@ -5,190 +5,94 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AlternateDeliveryAddressAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AlternateDeliveryAddressAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class; + return $type === \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class => false]; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class AlternateDeliveryAddressAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class; + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AlternateRatesResponseAlternateRateTypeNormalizer.php b/src/Api/Normalizer/AlternateRatesResponseAlternateRateTypeNormalizer.php index 65beab64..d3af7f2d 100644 --- a/src/Api/Normalizer/AlternateRatesResponseAlternateRateTypeNormalizer.php +++ b/src/Api/Normalizer/AlternateRatesResponseAlternateRateTypeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AlternateRatesResponseAlternateRateTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AlternateRatesResponseAlternateRateTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class; + return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class AlternateRatesResponseAlternateRateTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AlternateRatesResponseBillableShipmentWeightNormalizer.php b/src/Api/Normalizer/AlternateRatesResponseBillableShipmentWeightNormalizer.php index 93258bae..a2517ef2 100644 --- a/src/Api/Normalizer/AlternateRatesResponseBillableShipmentWeightNormalizer.php +++ b/src/Api/Normalizer/AlternateRatesResponseBillableShipmentWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AlternateRatesResponseBillableShipmentWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AlternateRatesResponseBillableShipmentWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class; + return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class => false]; - } - } -} else { - class AlternateRatesResponseBillableShipmentWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Value'] = $data->getValue(); + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AlternateRatesResponseFreightDensityRateNormalizer.php b/src/Api/Normalizer/AlternateRatesResponseFreightDensityRateNormalizer.php index fa90398b..b7ad72b2 100644 --- a/src/Api/Normalizer/AlternateRatesResponseFreightDensityRateNormalizer.php +++ b/src/Api/Normalizer/AlternateRatesResponseFreightDensityRateNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AlternateRatesResponseFreightDensityRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AlternateRatesResponseFreightDensityRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class; + return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Density', $data)) { - $object->setDensity($data['Density']); - unset($data['Density']); - } - if (\array_key_exists('TotalCubicFeet', $data)) { - $object->setTotalCubicFeet($data['TotalCubicFeet']); - unset($data['TotalCubicFeet']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Density'] = $object->getDensity(); - $data['TotalCubicFeet'] = $object->getTotalCubicFeet(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class => false]; - } - } -} else { - class AlternateRatesResponseFreightDensityRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class; + if (\array_key_exists('Density', $data)) { + $object->setDensity($data['Density']); + unset($data['Density']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class; + if (\array_key_exists('TotalCubicFeet', $data)) { + $object->setTotalCubicFeet($data['TotalCubicFeet']); + unset($data['TotalCubicFeet']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Density', $data)) { - $object->setDensity($data['Density']); - unset($data['Density']); - } - if (\array_key_exists('TotalCubicFeet', $data)) { - $object->setTotalCubicFeet($data['TotalCubicFeet']); - unset($data['TotalCubicFeet']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Density'] = $object->getDensity(); - $data['TotalCubicFeet'] = $object->getTotalCubicFeet(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Density'] = $data->getDensity(); + $dataArray['TotalCubicFeet'] = $data->getTotalCubicFeet(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AlternateRatesResponseRateNormalizer.php b/src/Api/Normalizer/AlternateRatesResponseRateNormalizer.php index 931e62d6..c357abb0 100644 --- a/src/Api/Normalizer/AlternateRatesResponseRateNormalizer.php +++ b/src/Api/Normalizer/AlternateRatesResponseRateNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AlternateRatesResponseRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AlternateRatesResponseRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class; + return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\RateType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('SubTypeCode', $data)) { - $object->setSubTypeCode($data['SubTypeCode']); - unset($data['SubTypeCode']); - } - if (\array_key_exists('Factor', $data)) { - $object->setFactor($this->denormalizer->denormalize($data['Factor'], \ShipStream\Ups\Api\Model\RateFactor::class, 'json', $context)); - unset($data['Factor']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseRate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - if ($object->isInitialized('subTypeCode') && null !== $object->getSubTypeCode()) { - $data['SubTypeCode'] = $object->getSubTypeCode(); - } - $data['Factor'] = $this->normalizer->normalize($object->getFactor(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class => false]; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\RateType::class, 'json', $context)); + unset($data['Type']); } - } -} else { - class AlternateRatesResponseRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class; + if (\array_key_exists('SubTypeCode', $data)) { + $object->setSubTypeCode($data['SubTypeCode']); + unset($data['SubTypeCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class; + if (\array_key_exists('Factor', $data)) { + $object->setFactor($this->denormalizer->denormalize($data['Factor'], \ShipStream\Ups\Api\Model\RateFactor::class, 'json', $context)); + unset($data['Factor']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\RateType::class, 'json', $context)); - unset($data['Type']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('SubTypeCode', $data)) { - $object->setSubTypeCode($data['SubTypeCode']); - unset($data['SubTypeCode']); - } - if (\array_key_exists('Factor', $data)) { - $object->setFactor($this->denormalizer->denormalize($data['Factor'], \ShipStream\Ups\Api\Model\RateFactor::class, 'json', $context)); - unset($data['Factor']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - if ($object->isInitialized('subTypeCode') && null !== $object->getSubTypeCode()) { - $data['SubTypeCode'] = $object->getSubTypeCode(); - } - $data['Factor'] = $this->normalizer->normalize($object->getFactor(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + if ($data->isInitialized('subTypeCode') && null !== $data->getSubTypeCode()) { + $dataArray['SubTypeCode'] = $data->getSubTypeCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class => false]; + $dataArray['Factor'] = $this->normalizer->normalize($data->getFactor(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AlternateRatesResponseTimeInTransitNormalizer.php b/src/Api/Normalizer/AlternateRatesResponseTimeInTransitNormalizer.php index 088208b2..a882ba92 100644 --- a/src/Api/Normalizer/AlternateRatesResponseTimeInTransitNormalizer.php +++ b/src/Api/Normalizer/AlternateRatesResponseTimeInTransitNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AlternateRatesResponseTimeInTransitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AlternateRatesResponseTimeInTransitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class; + return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DaysInTransit', $data)) { - $object->setDaysInTransit($data['DaysInTransit']); - unset($data['DaysInTransit']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['DaysInTransit'] = $object->getDaysInTransit(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DaysInTransit', $data)) { + $object->setDaysInTransit($data['DaysInTransit']); + unset($data['DaysInTransit']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class AlternateRatesResponseTimeInTransitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['DaysInTransit'] = $data->getDaysInTransit(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('DaysInTransit', $data)) { - $object->setDaysInTransit($data['DaysInTransit']); - unset($data['DaysInTransit']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['DaysInTransit'] = $object->getDaysInTransit(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AlternateTrackingNumberNormalizer.php b/src/Api/Normalizer/AlternateTrackingNumberNormalizer.php index ff8d8339..083746cb 100644 --- a/src/Api/Normalizer/AlternateTrackingNumberNormalizer.php +++ b/src/Api/Normalizer/AlternateTrackingNumberNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AlternateTrackingNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AlternateTrackingNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class; + return $type === \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateTrackingNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('number', $data)) { - $object->setNumber($data['number']); - unset($data['number']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AlternateTrackingNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['number'] = $object->getNumber(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('number', $data)) { + $object->setNumber($data['number']); + unset($data['number']); + } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateTrackingNumber::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class AlternateTrackingNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class; + $dataArray = []; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['number'] = $data->getNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AlternateTrackingNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('number', $data)) { - $object->setNumber($data['number']); - unset($data['number']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('type') && null !== $data->getType()) { + $dataArray['type'] = $data->getType(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['number'] = $object->getNumber(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AlternateTrackingNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AlternateTrackingNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AvailabilityDCRAvailabilityNormalizer.php b/src/Api/Normalizer/AvailabilityDCRAvailabilityNormalizer.php index d0e61524..e0fbbd8b 100644 --- a/src/Api/Normalizer/AvailabilityDCRAvailabilityNormalizer.php +++ b/src/Api/Normalizer/AvailabilityDCRAvailabilityNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AvailabilityDCRAvailabilityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AvailabilityDCRAvailabilityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class; + return $type === \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AvailableIndicator', $data)) { - $object->setAvailableIndicator($data['AvailableIndicator']); - unset($data['AvailableIndicator']); - } - if (\array_key_exists('UnavailableReason', $data)) { - $object->setUnavailableReason($this->denormalizer->denormalize($data['UnavailableReason'], \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class, 'json', $context)); - unset($data['UnavailableReason']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('availableIndicator') && null !== $object->getAvailableIndicator()) { - $data['AvailableIndicator'] = $object->getAvailableIndicator(); - } - if ($object->isInitialized('unavailableReason') && null !== $object->getUnavailableReason()) { - $data['UnavailableReason'] = $this->normalizer->normalize($object->getUnavailableReason(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AvailableIndicator', $data)) { + $object->setAvailableIndicator($data['AvailableIndicator']); + unset($data['AvailableIndicator']); + } + if (\array_key_exists('UnavailableReason', $data)) { + $object->setUnavailableReason($this->denormalizer->denormalize($data['UnavailableReason'], \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class, 'json', $context)); + unset($data['UnavailableReason']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class AvailabilityDCRAvailabilityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class; + $dataArray = []; + if ($data->isInitialized('availableIndicator') && null !== $data->getAvailableIndicator()) { + $dataArray['AvailableIndicator'] = $data->getAvailableIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AvailableIndicator', $data)) { - $object->setAvailableIndicator($data['AvailableIndicator']); - unset($data['AvailableIndicator']); - } - if (\array_key_exists('UnavailableReason', $data)) { - $object->setUnavailableReason($this->denormalizer->denormalize($data['UnavailableReason'], \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class, 'json', $context)); - unset($data['UnavailableReason']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('unavailableReason') && null !== $data->getUnavailableReason()) { + $dataArray['UnavailableReason'] = $this->normalizer->normalize($data->getUnavailableReason(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('availableIndicator') && null !== $object->getAvailableIndicator()) { - $data['AvailableIndicator'] = $object->getAvailableIndicator(); - } - if ($object->isInitialized('unavailableReason') && null !== $object->getUnavailableReason()) { - $data['UnavailableReason'] = $this->normalizer->normalize($object->getUnavailableReason(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AvailabilityShippingAvailabilityNormalizer.php b/src/Api/Normalizer/AvailabilityShippingAvailabilityNormalizer.php index 710b35bf..179ec235 100644 --- a/src/Api/Normalizer/AvailabilityShippingAvailabilityNormalizer.php +++ b/src/Api/Normalizer/AvailabilityShippingAvailabilityNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AvailabilityShippingAvailabilityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AvailabilityShippingAvailabilityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class; + return $type === \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AvailableIndicator', $data)) { - $object->setAvailableIndicator($data['AvailableIndicator']); - unset($data['AvailableIndicator']); - } - if (\array_key_exists('UnavailableReason', $data)) { - $object->setUnavailableReason($this->denormalizer->denormalize($data['UnavailableReason'], \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class, 'json', $context)); - unset($data['UnavailableReason']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('availableIndicator') && null !== $object->getAvailableIndicator()) { - $data['AvailableIndicator'] = $object->getAvailableIndicator(); - } - if ($object->isInitialized('unavailableReason') && null !== $object->getUnavailableReason()) { - $data['UnavailableReason'] = $this->normalizer->normalize($object->getUnavailableReason(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AvailableIndicator', $data)) { + $object->setAvailableIndicator($data['AvailableIndicator']); + unset($data['AvailableIndicator']); + } + if (\array_key_exists('UnavailableReason', $data)) { + $object->setUnavailableReason($this->denormalizer->denormalize($data['UnavailableReason'], \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class, 'json', $context)); + unset($data['UnavailableReason']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class AvailabilityShippingAvailabilityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class; + $dataArray = []; + if ($data->isInitialized('availableIndicator') && null !== $data->getAvailableIndicator()) { + $dataArray['AvailableIndicator'] = $data->getAvailableIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AvailableIndicator', $data)) { - $object->setAvailableIndicator($data['AvailableIndicator']); - unset($data['AvailableIndicator']); - } - if (\array_key_exists('UnavailableReason', $data)) { - $object->setUnavailableReason($this->denormalizer->denormalize($data['UnavailableReason'], \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class, 'json', $context)); - unset($data['UnavailableReason']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('unavailableReason') && null !== $data->getUnavailableReason()) { + $dataArray['UnavailableReason'] = $this->normalizer->normalize($data->getUnavailableReason(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('availableIndicator') && null !== $object->getAvailableIndicator()) { - $data['AvailableIndicator'] = $object->getAvailableIndicator(); - } - if ($object->isInitialized('unavailableReason') && null !== $object->getUnavailableReason()) { - $data['UnavailableReason'] = $this->normalizer->normalize($object->getUnavailableReason(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AvailableLocationAttributesOptionCodeNormalizer.php b/src/Api/Normalizer/AvailableLocationAttributesOptionCodeNormalizer.php index 458ce576..ea263e90 100644 --- a/src/Api/Normalizer/AvailableLocationAttributesOptionCodeNormalizer.php +++ b/src/Api/Normalizer/AvailableLocationAttributesOptionCodeNormalizer.php @@ -5,178 +5,88 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AvailableLocationAttributesOptionCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AvailableLocationAttributesOptionCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class; + return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Category', $data)) { - $object->setCategory($data['Category']); - unset($data['Category']); - } - if (\array_key_exists('TransportationPickUpSchedule', $data)) { - $object->setTransportationPickUpSchedule($this->denormalizer->denormalize($data['TransportationPickUpSchedule'], \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class, 'json', $context)); - unset($data['TransportationPickUpSchedule']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('category') && null !== $object->getCategory()) { - $data['Category'] = $object->getCategory(); - } - if ($object->isInitialized('transportationPickUpSchedule') && null !== $object->getTransportationPickUpSchedule()) { - $data['TransportationPickUpSchedule'] = $this->normalizer->normalize($object->getTransportationPickUpSchedule(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); + } + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class => false]; + if (\array_key_exists('Category', $data)) { + $object->setCategory($data['Category']); + unset($data['Category']); } + if (\array_key_exists('TransportationPickUpSchedule', $data)) { + $object->setTransportationPickUpSchedule($this->denormalizer->denormalize($data['TransportationPickUpSchedule'], \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class, 'json', $context)); + unset($data['TransportationPickUpSchedule']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class AvailableLocationAttributesOptionCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + if ($data->isInitialized('name') && null !== $data->getName()) { + $dataArray['Name'] = $data->getName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class; + if ($data->isInitialized('category') && null !== $data->getCategory()) { + $dataArray['Category'] = $data->getCategory(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Category', $data)) { - $object->setCategory($data['Category']); - unset($data['Category']); - } - if (\array_key_exists('TransportationPickUpSchedule', $data)) { - $object->setTransportationPickUpSchedule($this->denormalizer->denormalize($data['TransportationPickUpSchedule'], \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class, 'json', $context)); - unset($data['TransportationPickUpSchedule']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('transportationPickUpSchedule') && null !== $data->getTransportationPickUpSchedule()) { + $dataArray['TransportationPickUpSchedule'] = $this->normalizer->normalize($data->getTransportationPickUpSchedule(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('category') && null !== $object->getCategory()) { - $data['Category'] = $object->getCategory(); - } - if ($object->isInitialized('transportationPickUpSchedule') && null !== $object->getTransportationPickUpSchedule()) { - $data['TransportationPickUpSchedule'] = $this->normalizer->normalize($object->getTransportationPickUpSchedule(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AvailableLocationAttributesOptionCodeTransportationPickUpScheduleNormalizer.php b/src/Api/Normalizer/AvailableLocationAttributesOptionCodeTransportationPickUpScheduleNormalizer.php index 30e989fa..fb19c97a 100644 --- a/src/Api/Normalizer/AvailableLocationAttributesOptionCodeTransportationPickUpScheduleNormalizer.php +++ b/src/Api/Normalizer/AvailableLocationAttributesOptionCodeTransportationPickUpScheduleNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AvailableLocationAttributesOptionCodeTransportationPickUpScheduleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AvailableLocationAttributesOptionCodeTransportationPickUpScheduleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class; + return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickUp', $data)) { - $values = []; - foreach ($data['PickUp'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class, 'json', $context); - } - $object->setPickUp($values); - unset($data['PickUp']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('PickUp', $data)) { $values = []; - foreach ($object->getPickUp() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['PickUp'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class, 'json', $context); } - $data['PickUp'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setPickUp($values); + unset($data['PickUp']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class AvailableLocationAttributesOptionCodeTransportationPickUpScheduleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class; + $dataArray = []; + $values = []; + foreach ($data->getPickUp() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['PickUp'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickUp', $data)) { - $values = []; - foreach ($data['PickUp'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class, 'json', $context); - } - $object->setPickUp($values); - unset($data['PickUp']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getPickUp() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PickUp'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AvailableLocationAttributesOptionTypeNormalizer.php b/src/Api/Normalizer/AvailableLocationAttributesOptionTypeNormalizer.php index c7a111b5..2898bf97 100644 --- a/src/Api/Normalizer/AvailableLocationAttributesOptionTypeNormalizer.php +++ b/src/Api/Normalizer/AvailableLocationAttributesOptionTypeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AvailableLocationAttributesOptionTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AvailableLocationAttributesOptionTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class; + return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class => false]; - } - } -} else { - class AvailableLocationAttributesOptionTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AvailableLocationAttributesPickUpPickUpDetailsNormalizer.php b/src/Api/Normalizer/AvailableLocationAttributesPickUpPickUpDetailsNormalizer.php index bd247df0..9092a276 100644 --- a/src/Api/Normalizer/AvailableLocationAttributesPickUpPickUpDetailsNormalizer.php +++ b/src/Api/Normalizer/AvailableLocationAttributesPickUpPickUpDetailsNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AvailableLocationAttributesPickUpPickUpDetailsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AvailableLocationAttributesPickUpPickUpDetailsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class; + return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickUpTime', $data)) { - $object->setPickUpTime($data['PickUpTime']); - unset($data['PickUpTime']); - } - if (\array_key_exists('NoPickUpIndicator', $data)) { - $object->setNoPickUpIndicator($data['NoPickUpIndicator']); - unset($data['NoPickUpIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('pickUpTime') && null !== $object->getPickUpTime()) { - $data['PickUpTime'] = $object->getPickUpTime(); - } - $data['NoPickUpIndicator'] = $object->getNoPickUpIndicator(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickUpTime', $data)) { + $object->setPickUpTime($data['PickUpTime']); + unset($data['PickUpTime']); + } + if (\array_key_exists('NoPickUpIndicator', $data)) { + $object->setNoPickUpIndicator($data['NoPickUpIndicator']); + unset($data['NoPickUpIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class AvailableLocationAttributesPickUpPickUpDetailsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class; + $dataArray = []; + if ($data->isInitialized('pickUpTime') && null !== $data->getPickUpTime()) { + $dataArray['PickUpTime'] = $data->getPickUpTime(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickUpTime', $data)) { - $object->setPickUpTime($data['PickUpTime']); - unset($data['PickUpTime']); + $dataArray['NoPickUpIndicator'] = $data->getNoPickUpIndicator(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('NoPickUpIndicator', $data)) { - $object->setNoPickUpIndicator($data['NoPickUpIndicator']); - unset($data['NoPickUpIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('pickUpTime') && null !== $object->getPickUpTime()) { - $data['PickUpTime'] = $object->getPickUpTime(); - } - $data['NoPickUpIndicator'] = $object->getNoPickUpIndicator(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/AvailableLocationAttributesTransportationPickUpSchedulePickUpNormalizer.php b/src/Api/Normalizer/AvailableLocationAttributesTransportationPickUpSchedulePickUpNormalizer.php index 6d629b2d..9e7a9a26 100644 --- a/src/Api/Normalizer/AvailableLocationAttributesTransportationPickUpSchedulePickUpNormalizer.php +++ b/src/Api/Normalizer/AvailableLocationAttributesTransportationPickUpSchedulePickUpNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AvailableLocationAttributesTransportationPickUpSchedulePickUpNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AvailableLocationAttributesTransportationPickUpSchedulePickUpNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class; + return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DayOfWeek', $data)) { - $object->setDayOfWeek($data['DayOfWeek']); - unset($data['DayOfWeek']); - } - if (\array_key_exists('PickUpDetails', $data)) { - $object->setPickUpDetails($this->denormalizer->denormalize($data['PickUpDetails'], \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class, 'json', $context)); - unset($data['PickUpDetails']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['DayOfWeek'] = $object->getDayOfWeek(); - $data['PickUpDetails'] = $this->normalizer->normalize($object->getPickUpDetails(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class => false]; - } - } -} else { - class AvailableLocationAttributesTransportationPickUpSchedulePickUpNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class; + if (\array_key_exists('DayOfWeek', $data)) { + $object->setDayOfWeek($data['DayOfWeek']); + unset($data['DayOfWeek']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class; + if (\array_key_exists('PickUpDetails', $data)) { + $object->setPickUpDetails($this->denormalizer->denormalize($data['PickUpDetails'], \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class, 'json', $context)); + unset($data['PickUpDetails']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DayOfWeek', $data)) { - $object->setDayOfWeek($data['DayOfWeek']); - unset($data['DayOfWeek']); - } - if (\array_key_exists('PickUpDetails', $data)) { - $object->setPickUpDetails($this->denormalizer->denormalize($data['PickUpDetails'], \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class, 'json', $context)); - unset($data['PickUpDetails']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['DayOfWeek'] = $object->getDayOfWeek(); - $data['PickUpDetails'] = $this->normalizer->normalize($object->getPickUpDetails(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['DayOfWeek'] = $data->getDayOfWeek(); + $dataArray['PickUpDetails'] = $this->normalizer->normalize($data->getPickUpDetails(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/BillReceiverAddressNormalizer.php b/src/Api/Normalizer/BillReceiverAddressNormalizer.php index 5af38462..a951fa8d 100644 --- a/src/Api/Normalizer/BillReceiverAddressNormalizer.php +++ b/src/Api/Normalizer/BillReceiverAddressNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class BillReceiverAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class BillReceiverAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BillReceiverAddress::class; + return $type === \ShipStream\Ups\Api\Model\BillReceiverAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillReceiverAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillReceiverAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BillReceiverAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\BillReceiverAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BillReceiverAddress::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class BillReceiverAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BillReceiverAddress::class; + $dataArray = []; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillReceiverAddress::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BillReceiverAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BillReceiverAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\BillReceiverAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/BillShipperCreditCardNormalizer.php b/src/Api/Normalizer/BillShipperCreditCardNormalizer.php index 718c358e..bc49626c 100644 --- a/src/Api/Normalizer/BillShipperCreditCardNormalizer.php +++ b/src/Api/Normalizer/BillShipperCreditCardNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class BillShipperCreditCardNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class BillShipperCreditCardNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BillShipperCreditCard::class; + return $type === \ShipStream\Ups\Api\Model\BillShipperCreditCard::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillShipperCreditCard::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillShipperCreditCard::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BillShipperCreditCard(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('ExpirationDate', $data)) { - $object->setExpirationDate($data['ExpirationDate']); - unset($data['ExpirationDate']); - } - if (\array_key_exists('SecurityCode', $data)) { - $object->setSecurityCode($data['SecurityCode']); - unset($data['SecurityCode']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\CreditCardAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\BillShipperCreditCard(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $object->getType(); - $data['Number'] = $object->getNumber(); - $data['ExpirationDate'] = $object->getExpirationDate(); - $data['SecurityCode'] = $object->getSecurityCode(); - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Type', $data)) { + $object->setType($data['Type']); + unset($data['Type']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BillShipperCreditCard::class => false]; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); } - } -} else { - class BillShipperCreditCardNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BillShipperCreditCard::class; + if (\array_key_exists('ExpirationDate', $data)) { + $object->setExpirationDate($data['ExpirationDate']); + unset($data['ExpirationDate']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillShipperCreditCard::class; + if (\array_key_exists('SecurityCode', $data)) { + $object->setSecurityCode($data['SecurityCode']); + unset($data['SecurityCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BillShipperCreditCard(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('ExpirationDate', $data)) { - $object->setExpirationDate($data['ExpirationDate']); - unset($data['ExpirationDate']); - } - if (\array_key_exists('SecurityCode', $data)) { - $object->setSecurityCode($data['SecurityCode']); - unset($data['SecurityCode']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\CreditCardAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\CreditCardAddress::class, 'json', $context)); + unset($data['Address']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $object->getType(); - $data['Number'] = $object->getNumber(); - $data['ExpirationDate'] = $object->getExpirationDate(); - $data['SecurityCode'] = $object->getSecurityCode(); - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BillShipperCreditCard::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Type'] = $data->getType(); + $dataArray['Number'] = $data->getNumber(); + $dataArray['ExpirationDate'] = $data->getExpirationDate(); + $dataArray['SecurityCode'] = $data->getSecurityCode(); + if ($data->isInitialized('address') && null !== $data->getAddress()) { + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\BillShipperCreditCard::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/BillThirdPartyAddressNormalizer.php b/src/Api/Normalizer/BillThirdPartyAddressNormalizer.php index 67bd6025..9364e433 100644 --- a/src/Api/Normalizer/BillThirdPartyAddressNormalizer.php +++ b/src/Api/Normalizer/BillThirdPartyAddressNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class BillThirdPartyAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class BillThirdPartyAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class; + return $type === \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BillThirdPartyAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\BillThirdPartyAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BillThirdPartyAddress::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class BillThirdPartyAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class; + $dataArray = []; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BillThirdPartyAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BillThirdPartyAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\BillThirdPartyAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/BillableShipmentWeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/BillableShipmentWeightUnitOfMeasurementNormalizer.php index 4bc84514..c34b08d5 100644 --- a/src/Api/Normalizer/BillableShipmentWeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/BillableShipmentWeightUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class BillableShipmentWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class BillableShipmentWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class BillableShipmentWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/BillingWeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/BillingWeightUnitOfMeasurementNormalizer.php index cea33cf8..34fef79c 100644 --- a/src/Api/Normalizer/BillingWeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/BillingWeightUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class BillingWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class BillingWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class BillingWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/BrokerageFeeItemsNormalizer.php b/src/Api/Normalizer/BrokerageFeeItemsNormalizer.php index d44c1e1e..5f4d3ee5 100644 --- a/src/Api/Normalizer/BrokerageFeeItemsNormalizer.php +++ b/src/Api/Normalizer/BrokerageFeeItemsNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class BrokerageFeeItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class BrokerageFeeItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BrokerageFeeItems::class; + return $type === \ShipStream\Ups\Api\Model\BrokerageFeeItems::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BrokerageFeeItems::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BrokerageFeeItems::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BrokerageFeeItems(); - if (\array_key_exists('chargeAmount', $data) && \is_int($data['chargeAmount'])) { - $data['chargeAmount'] = (double) $data['chargeAmount']; - } - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('chargeName', $data)) { - $object->setChargeName($data['chargeName']); - unset($data['chargeName']); - } - if (\array_key_exists('chargeAmount', $data)) { - $object->setChargeAmount($data['chargeAmount']); - unset($data['chargeAmount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\BrokerageFeeItems(); + if (\array_key_exists('chargeAmount', $data) && \is_int($data['chargeAmount'])) { + $data['chargeAmount'] = (double) $data['chargeAmount']; + } + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('chargeName') && null !== $object->getChargeName()) { - $data['chargeName'] = $object->getChargeName(); - } - if ($object->isInitialized('chargeAmount') && null !== $object->getChargeAmount()) { - $data['chargeAmount'] = $object->getChargeAmount(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('chargeName', $data)) { + $object->setChargeName($data['chargeName']); + unset($data['chargeName']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BrokerageFeeItems::class => false]; + if (\array_key_exists('chargeAmount', $data)) { + $object->setChargeAmount($data['chargeAmount']); + unset($data['chargeAmount']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class BrokerageFeeItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BrokerageFeeItems::class; + $dataArray = []; + if ($data->isInitialized('chargeName') && null !== $data->getChargeName()) { + $dataArray['chargeName'] = $data->getChargeName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BrokerageFeeItems::class; + if ($data->isInitialized('chargeAmount') && null !== $data->getChargeAmount()) { + $dataArray['chargeAmount'] = $data->getChargeAmount(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BrokerageFeeItems(); - if (\array_key_exists('chargeAmount', $data) && \is_int($data['chargeAmount'])) { - $data['chargeAmount'] = (double) $data['chargeAmount']; - } - if (null === $data || false === \is_array($data)) { - return $object; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('chargeName', $data)) { - $object->setChargeName($data['chargeName']); - unset($data['chargeName']); - } - if (\array_key_exists('chargeAmount', $data)) { - $object->setChargeAmount($data['chargeAmount']); - unset($data['chargeAmount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('chargeName') && null !== $object->getChargeName()) { - $data['chargeName'] = $object->getChargeName(); - } - if ($object->isInitialized('chargeAmount') && null !== $object->getChargeAmount()) { - $data['chargeAmount'] = $object->getChargeAmount(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BrokerageFeeItems::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\BrokerageFeeItems::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/BusinessClassificationListBusinessClassificationNormalizer.php b/src/Api/Normalizer/BusinessClassificationListBusinessClassificationNormalizer.php index 265a2957..9abbf69c 100644 --- a/src/Api/Normalizer/BusinessClassificationListBusinessClassificationNormalizer.php +++ b/src/Api/Normalizer/BusinessClassificationListBusinessClassificationNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class BusinessClassificationListBusinessClassificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class BusinessClassificationListBusinessClassificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class; + return $type === \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class => false]; - } - } -} else { - class BusinessClassificationListBusinessClassificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CN22ContentCN22ContentWeightNormalizer.php b/src/Api/Normalizer/CN22ContentCN22ContentWeightNormalizer.php index 1073f654..952e6ee1 100644 --- a/src/Api/Normalizer/CN22ContentCN22ContentWeightNormalizer.php +++ b/src/Api/Normalizer/CN22ContentCN22ContentWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CN22ContentCN22ContentWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CN22ContentCN22ContentWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class; + return $type === \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class => false]; - } - } -} else { - class CN22ContentCN22ContentWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Weight'] = $data->getWeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CN22ContentWeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/CN22ContentWeightUnitOfMeasurementNormalizer.php index b78fe55c..dcb7c3d2 100644 --- a/src/Api/Normalizer/CN22ContentWeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/CN22ContentWeightUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CN22ContentWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CN22ContentWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class CN22ContentWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CN22FormCN22ContentNormalizer.php b/src/Api/Normalizer/CN22FormCN22ContentNormalizer.php index 05e702fd..d3302b44 100644 --- a/src/Api/Normalizer/CN22FormCN22ContentNormalizer.php +++ b/src/Api/Normalizer/CN22FormCN22ContentNormalizer.php @@ -5,194 +5,96 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CN22FormCN22ContentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CN22FormCN22ContentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CN22FormCN22Content::class; + return $type === \ShipStream\Ups\Api\Model\CN22FormCN22Content::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CN22FormCN22Content::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CN22FormCN22Content::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CN22FormCN22Content(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CN22ContentQuantity', $data)) { - $object->setCN22ContentQuantity($data['CN22ContentQuantity']); - unset($data['CN22ContentQuantity']); - } - if (\array_key_exists('CN22ContentDescription', $data)) { - $object->setCN22ContentDescription($data['CN22ContentDescription']); - unset($data['CN22ContentDescription']); - } - if (\array_key_exists('CN22ContentWeight', $data)) { - $object->setCN22ContentWeight($this->denormalizer->denormalize($data['CN22ContentWeight'], \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class, 'json', $context)); - unset($data['CN22ContentWeight']); - } - if (\array_key_exists('CN22ContentTotalValue', $data)) { - $object->setCN22ContentTotalValue($data['CN22ContentTotalValue']); - unset($data['CN22ContentTotalValue']); - } - if (\array_key_exists('CN22ContentCurrencyCode', $data)) { - $object->setCN22ContentCurrencyCode($data['CN22ContentCurrencyCode']); - unset($data['CN22ContentCurrencyCode']); - } - if (\array_key_exists('CN22ContentCountryOfOrigin', $data)) { - $object->setCN22ContentCountryOfOrigin($data['CN22ContentCountryOfOrigin']); - unset($data['CN22ContentCountryOfOrigin']); - } - if (\array_key_exists('CN22ContentTariffNumber', $data)) { - $object->setCN22ContentTariffNumber($data['CN22ContentTariffNumber']); - unset($data['CN22ContentTariffNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CN22FormCN22Content(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CN22ContentQuantity'] = $object->getCN22ContentQuantity(); - $data['CN22ContentDescription'] = $object->getCN22ContentDescription(); - $data['CN22ContentWeight'] = $this->normalizer->normalize($object->getCN22ContentWeight(), 'json', $context); - $data['CN22ContentTotalValue'] = $object->getCN22ContentTotalValue(); - $data['CN22ContentCurrencyCode'] = $object->getCN22ContentCurrencyCode(); - if ($object->isInitialized('cN22ContentCountryOfOrigin') && null !== $object->getCN22ContentCountryOfOrigin()) { - $data['CN22ContentCountryOfOrigin'] = $object->getCN22ContentCountryOfOrigin(); - } - if ($object->isInitialized('cN22ContentTariffNumber') && null !== $object->getCN22ContentTariffNumber()) { - $data['CN22ContentTariffNumber'] = $object->getCN22ContentTariffNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CN22ContentQuantity', $data)) { + $object->setCN22ContentQuantity($data['CN22ContentQuantity']); + unset($data['CN22ContentQuantity']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CN22FormCN22Content::class => false]; + if (\array_key_exists('CN22ContentDescription', $data)) { + $object->setCN22ContentDescription($data['CN22ContentDescription']); + unset($data['CN22ContentDescription']); } - } -} else { - class CN22FormCN22ContentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CN22FormCN22Content::class; + if (\array_key_exists('CN22ContentWeight', $data)) { + $object->setCN22ContentWeight($this->denormalizer->denormalize($data['CN22ContentWeight'], \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class, 'json', $context)); + unset($data['CN22ContentWeight']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CN22FormCN22Content::class; + if (\array_key_exists('CN22ContentTotalValue', $data)) { + $object->setCN22ContentTotalValue($data['CN22ContentTotalValue']); + unset($data['CN22ContentTotalValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CN22FormCN22Content(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CN22ContentQuantity', $data)) { - $object->setCN22ContentQuantity($data['CN22ContentQuantity']); - unset($data['CN22ContentQuantity']); - } - if (\array_key_exists('CN22ContentDescription', $data)) { - $object->setCN22ContentDescription($data['CN22ContentDescription']); - unset($data['CN22ContentDescription']); - } - if (\array_key_exists('CN22ContentWeight', $data)) { - $object->setCN22ContentWeight($this->denormalizer->denormalize($data['CN22ContentWeight'], \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class, 'json', $context)); - unset($data['CN22ContentWeight']); - } - if (\array_key_exists('CN22ContentTotalValue', $data)) { - $object->setCN22ContentTotalValue($data['CN22ContentTotalValue']); - unset($data['CN22ContentTotalValue']); - } - if (\array_key_exists('CN22ContentCurrencyCode', $data)) { - $object->setCN22ContentCurrencyCode($data['CN22ContentCurrencyCode']); - unset($data['CN22ContentCurrencyCode']); - } - if (\array_key_exists('CN22ContentCountryOfOrigin', $data)) { - $object->setCN22ContentCountryOfOrigin($data['CN22ContentCountryOfOrigin']); - unset($data['CN22ContentCountryOfOrigin']); - } - if (\array_key_exists('CN22ContentTariffNumber', $data)) { - $object->setCN22ContentTariffNumber($data['CN22ContentTariffNumber']); - unset($data['CN22ContentTariffNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('CN22ContentCurrencyCode', $data)) { + $object->setCN22ContentCurrencyCode($data['CN22ContentCurrencyCode']); + unset($data['CN22ContentCurrencyCode']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CN22ContentQuantity'] = $object->getCN22ContentQuantity(); - $data['CN22ContentDescription'] = $object->getCN22ContentDescription(); - $data['CN22ContentWeight'] = $this->normalizer->normalize($object->getCN22ContentWeight(), 'json', $context); - $data['CN22ContentTotalValue'] = $object->getCN22ContentTotalValue(); - $data['CN22ContentCurrencyCode'] = $object->getCN22ContentCurrencyCode(); - if ($object->isInitialized('cN22ContentCountryOfOrigin') && null !== $object->getCN22ContentCountryOfOrigin()) { - $data['CN22ContentCountryOfOrigin'] = $object->getCN22ContentCountryOfOrigin(); - } - if ($object->isInitialized('cN22ContentTariffNumber') && null !== $object->getCN22ContentTariffNumber()) { - $data['CN22ContentTariffNumber'] = $object->getCN22ContentTariffNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + if (\array_key_exists('CN22ContentCountryOfOrigin', $data)) { + $object->setCN22ContentCountryOfOrigin($data['CN22ContentCountryOfOrigin']); + unset($data['CN22ContentCountryOfOrigin']); + } + if (\array_key_exists('CN22ContentTariffNumber', $data)) { + $object->setCN22ContentTariffNumber($data['CN22ContentTariffNumber']); + unset($data['CN22ContentTariffNumber']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CN22FormCN22Content::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CN22ContentQuantity'] = $data->getCN22ContentQuantity(); + $dataArray['CN22ContentDescription'] = $data->getCN22ContentDescription(); + $dataArray['CN22ContentWeight'] = $this->normalizer->normalize($data->getCN22ContentWeight(), 'json', $context); + $dataArray['CN22ContentTotalValue'] = $data->getCN22ContentTotalValue(); + $dataArray['CN22ContentCurrencyCode'] = $data->getCN22ContentCurrencyCode(); + if ($data->isInitialized('cN22ContentCountryOfOrigin') && null !== $data->getCN22ContentCountryOfOrigin()) { + $dataArray['CN22ContentCountryOfOrigin'] = $data->getCN22ContentCountryOfOrigin(); + } + if ($data->isInitialized('cN22ContentTariffNumber') && null !== $data->getCN22ContentTariffNumber()) { + $dataArray['CN22ContentTariffNumber'] = $data->getCN22ContentTariffNumber(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CN22FormCN22Content::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CODCODAmountNormalizer.php b/src/Api/Normalizer/CODCODAmountNormalizer.php index c5f72225..ac04882d 100644 --- a/src/Api/Normalizer/CODCODAmountNormalizer.php +++ b/src/Api/Normalizer/CODCODAmountNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CODCODAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CODCODAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODCODAmount::class; + return $type === \ShipStream\Ups\Api\Model\CODCODAmount::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODCODAmount::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODCODAmount::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODCODAmount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CODCODAmount(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODCODAmount::class => false]; - } - } -} else { - class CODCODAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODCODAmount::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODCODAmount::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODCODAmount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODCODAmount::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CODCODAmount::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CODCODBillingOptionNormalizer.php b/src/Api/Normalizer/CODCODBillingOptionNormalizer.php index ca506e96..8b9283b4 100644 --- a/src/Api/Normalizer/CODCODBillingOptionNormalizer.php +++ b/src/Api/Normalizer/CODCODBillingOptionNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CODCODBillingOptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CODCODBillingOptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODCODBillingOption::class; + return $type === \ShipStream\Ups\Api\Model\CODCODBillingOption::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODCODBillingOption::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODCODBillingOption::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODCODBillingOption(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CODCODBillingOption(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODCODBillingOption::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class CODCODBillingOptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODCODBillingOption::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODCODBillingOption::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODCODBillingOption(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODCODBillingOption::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CODCODBillingOption::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CODCODPaymentMethodNormalizer.php b/src/Api/Normalizer/CODCODPaymentMethodNormalizer.php index 484f42a0..ae042e10 100644 --- a/src/Api/Normalizer/CODCODPaymentMethodNormalizer.php +++ b/src/Api/Normalizer/CODCODPaymentMethodNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CODCODPaymentMethodNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CODCODPaymentMethodNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class; + return $type === \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODCODPaymentMethod(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CODCODPaymentMethod(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODCODPaymentMethod::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class CODCODPaymentMethodNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODCODPaymentMethod(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODCODPaymentMethod::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CODCODPaymentMethod::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CODCODValueNormalizer.php b/src/Api/Normalizer/CODCODValueNormalizer.php index f213cf7d..b5d6ba31 100644 --- a/src/Api/Normalizer/CODCODValueNormalizer.php +++ b/src/Api/Normalizer/CODCODValueNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CODCODValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CODCODValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODCODValue::class; + return $type === \ShipStream\Ups\Api\Model\CODCODValue::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODCODValue::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODCODValue::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODCODValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CODCODValue(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODCODValue::class => false]; - } - } -} else { - class CODCODValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODCODValue::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODCODValue::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODCODValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODCODValue::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CODCODValue::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CODRemitToNormalizer.php b/src/Api/Normalizer/CODRemitToNormalizer.php index 486234c2..07572edb 100644 --- a/src/Api/Normalizer/CODRemitToNormalizer.php +++ b/src/Api/Normalizer/CODRemitToNormalizer.php @@ -5,192 +5,95 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CODRemitToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CODRemitToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODRemitTo::class; + return $type === \ShipStream\Ups\Api\Model\CODRemitTo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODRemitTo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODRemitTo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODRemitTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\RemitToPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CODRemitTo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class, 'json', $context)); + unset($data['Address']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\RemitToPhone::class, 'json', $context)); + unset($data['Phone']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODRemitTo::class => false]; + if (\array_key_exists('FaxNumber', $data)) { + $object->setFaxNumber($data['FaxNumber']); + unset($data['FaxNumber']); } + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class CODRemitToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODRemitTo::class; + $dataArray = []; + $dataArray['Name'] = $data->getName(); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODRemitTo::class; + if ($data->isInitialized('phone') && null !== $data->getPhone()) { + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODRemitTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\RemitToPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('faxNumber') && null !== $data->getFaxNumber()) { + $dataArray['FaxNumber'] = $data->getFaxNumber(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODRemitTo::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CODRemitTo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CODTurnInPageImageImageFormatNormalizer.php b/src/Api/Normalizer/CODTurnInPageImageImageFormatNormalizer.php index bc72d7f8..3f70fbc0 100644 --- a/src/Api/Normalizer/CODTurnInPageImageImageFormatNormalizer.php +++ b/src/Api/Normalizer/CODTurnInPageImageImageFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CODTurnInPageImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CODTurnInPageImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class CODTurnInPageImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CODTurnInPageImageNormalizer.php b/src/Api/Normalizer/CODTurnInPageImageNormalizer.php index 1fa00da8..299619bf 100644 --- a/src/Api/Normalizer/CODTurnInPageImageNormalizer.php +++ b/src/Api/Normalizer/CODTurnInPageImageNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CODTurnInPageImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CODTurnInPageImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODTurnInPageImage::class; + return $type === \ShipStream\Ups\Api\Model\CODTurnInPageImage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODTurnInPageImage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODTurnInPageImage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODTurnInPageImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CODTurnInPageImage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODTurnInPageImage::class => false]; - } - } -} else { - class CODTurnInPageImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CODTurnInPageImage::class; + if (\array_key_exists('ImageFormat', $data)) { + $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class, 'json', $context)); + unset($data['ImageFormat']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CODTurnInPageImage::class; + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CODTurnInPageImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ImageFormat'] = $this->normalizer->normalize($data->getImageFormat(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CODTurnInPageImage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CODTurnInPageImage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CandidateAddressClassificationNormalizer.php b/src/Api/Normalizer/CandidateAddressClassificationNormalizer.php index 61789654..167864fd 100644 --- a/src/Api/Normalizer/CandidateAddressClassificationNormalizer.php +++ b/src/Api/Normalizer/CandidateAddressClassificationNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CandidateAddressClassificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CandidateAddressClassificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CandidateAddressClassification::class; + return $type === \ShipStream\Ups\Api\Model\CandidateAddressClassification::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CandidateAddressClassification::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CandidateAddressClassification::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CandidateAddressClassification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CandidateAddressClassification(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CandidateAddressClassification::class => false]; - } - } -} else { - class CandidateAddressClassificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CandidateAddressClassification::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CandidateAddressClassification::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CandidateAddressClassification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CandidateAddressClassification::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CandidateAddressClassification::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CandidateAddressKeyFormatNormalizer.php b/src/Api/Normalizer/CandidateAddressKeyFormatNormalizer.php index da38d4dc..f37bbfcd 100644 --- a/src/Api/Normalizer/CandidateAddressKeyFormatNormalizer.php +++ b/src/Api/Normalizer/CandidateAddressKeyFormatNormalizer.php @@ -5,286 +5,142 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CandidateAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CandidateAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class; + return $type === \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data) && $data['ConsigneeName'] !== null) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - elseif (\array_key_exists('ConsigneeName', $data) && $data['ConsigneeName'] === null) { - $object->setConsigneeName(null); - } - if (\array_key_exists('AttentionName', $data) && $data['AttentionName'] !== null) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - elseif (\array_key_exists('AttentionName', $data) && $data['AttentionName'] === null) { - $object->setAttentionName(null); - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('Region', $data)) { - $object->setRegion($data['Region']); - unset($data['Region']); - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - if (\array_key_exists('PostcodeExtendedLow', $data)) { - $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); - unset($data['PostcodeExtendedLow']); - } - if (\array_key_exists('Urbanization', $data) && $data['Urbanization'] !== null) { - $object->setUrbanization($data['Urbanization']); - unset($data['Urbanization']); - } - elseif (\array_key_exists('Urbanization', $data) && $data['Urbanization'] === null) { - $object->setUrbanization(null); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('region') && null !== $object->getRegion()) { - $data['Region'] = $object->getRegion(); - } - if ($object->isInitialized('politicalDivision2') && null !== $object->getPoliticalDivision2()) { - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - } - if ($object->isInitialized('politicalDivision1') && null !== $object->getPoliticalDivision1()) { - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - } - if ($object->isInitialized('postcodePrimaryLow') && null !== $object->getPostcodePrimaryLow()) { - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - } - if ($object->isInitialized('postcodeExtendedLow') && null !== $object->getPostcodeExtendedLow()) { - $data['PostcodeExtendedLow'] = $object->getPostcodeExtendedLow(); - } - if ($object->isInitialized('urbanization') && null !== $object->getUrbanization()) { - $data['Urbanization'] = $object->getUrbanization(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ConsigneeName', $data) && $data['ConsigneeName'] !== null) { + $object->setConsigneeName($data['ConsigneeName']); + unset($data['ConsigneeName']); + } + elseif (\array_key_exists('ConsigneeName', $data) && $data['ConsigneeName'] === null) { + $object->setConsigneeName(null); + } + if (\array_key_exists('AttentionName', $data) && $data['AttentionName'] !== null) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + elseif (\array_key_exists('AttentionName', $data) && $data['AttentionName'] === null) { + $object->setAttentionName(null); + } + if (\array_key_exists('AddressLine', $data)) { + $values = []; + foreach ($data['AddressLine'] as $value) { + $values[] = $value; } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); + } + if (\array_key_exists('Region', $data)) { + $object->setRegion($data['Region']); + unset($data['Region']); + } + if (\array_key_exists('PoliticalDivision2', $data)) { + $object->setPoliticalDivision2($data['PoliticalDivision2']); + unset($data['PoliticalDivision2']); + } + if (\array_key_exists('PoliticalDivision1', $data)) { + $object->setPoliticalDivision1($data['PoliticalDivision1']); + unset($data['PoliticalDivision1']); + } + if (\array_key_exists('PostcodePrimaryLow', $data)) { + $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); + unset($data['PostcodePrimaryLow']); + } + if (\array_key_exists('PostcodeExtendedLow', $data)) { + $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); + unset($data['PostcodeExtendedLow']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class => false]; + if (\array_key_exists('Urbanization', $data) && $data['Urbanization'] !== null) { + $object->setUrbanization($data['Urbanization']); + unset($data['Urbanization']); } + elseif (\array_key_exists('Urbanization', $data) && $data['Urbanization'] === null) { + $object->setUrbanization(null); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class CandidateAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class; + $dataArray = []; + if ($data->isInitialized('consigneeName')) { + $dataArray['ConsigneeName'] = $data->getConsigneeName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class; + if ($data->isInitialized('attentionName')) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data) && $data['ConsigneeName'] !== null) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - elseif (\array_key_exists('ConsigneeName', $data) && $data['ConsigneeName'] === null) { - $object->setConsigneeName(null); - } - if (\array_key_exists('AttentionName', $data) && $data['AttentionName'] !== null) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - elseif (\array_key_exists('AttentionName', $data) && $data['AttentionName'] === null) { - $object->setAttentionName(null); - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('Region', $data)) { - $object->setRegion($data['Region']); - unset($data['Region']); - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - if (\array_key_exists('PostcodeExtendedLow', $data)) { - $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); - unset($data['PostcodeExtendedLow']); - } - if (\array_key_exists('Urbanization', $data) && $data['Urbanization'] !== null) { - $object->setUrbanization($data['Urbanization']); - unset($data['Urbanization']); - } - elseif (\array_key_exists('Urbanization', $data) && $data['Urbanization'] === null) { - $object->setUrbanization(null); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + if ($data->isInitialized('addressLine') && null !== $data->getAddressLine()) { + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - return $object; + $dataArray['AddressLine'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('region') && null !== $object->getRegion()) { - $data['Region'] = $object->getRegion(); - } - if ($object->isInitialized('politicalDivision2') && null !== $object->getPoliticalDivision2()) { - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - } - if ($object->isInitialized('politicalDivision1') && null !== $object->getPoliticalDivision1()) { - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - } - if ($object->isInitialized('postcodePrimaryLow') && null !== $object->getPostcodePrimaryLow()) { - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - } - if ($object->isInitialized('postcodeExtendedLow') && null !== $object->getPostcodeExtendedLow()) { - $data['PostcodeExtendedLow'] = $object->getPostcodeExtendedLow(); - } - if ($object->isInitialized('urbanization') && null !== $object->getUrbanization()) { - $data['Urbanization'] = $object->getUrbanization(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('region') && null !== $data->getRegion()) { + $dataArray['Region'] = $data->getRegion(); + } + if ($data->isInitialized('politicalDivision2') && null !== $data->getPoliticalDivision2()) { + $dataArray['PoliticalDivision2'] = $data->getPoliticalDivision2(); + } + if ($data->isInitialized('politicalDivision1') && null !== $data->getPoliticalDivision1()) { + $dataArray['PoliticalDivision1'] = $data->getPoliticalDivision1(); + } + if ($data->isInitialized('postcodePrimaryLow') && null !== $data->getPostcodePrimaryLow()) { + $dataArray['PostcodePrimaryLow'] = $data->getPostcodePrimaryLow(); + } + if ($data->isInitialized('postcodeExtendedLow') && null !== $data->getPostcodeExtendedLow()) { + $dataArray['PostcodeExtendedLow'] = $data->getPostcodeExtendedLow(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class => false]; + if ($data->isInitialized('urbanization')) { + $dataArray['Urbanization'] = $data->getUrbanization(); } + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CandidateAddressNormalizer.php b/src/Api/Normalizer/CandidateAddressNormalizer.php index c652efa8..850afe1c 100644 --- a/src/Api/Normalizer/CandidateAddressNormalizer.php +++ b/src/Api/Normalizer/CandidateAddressNormalizer.php @@ -5,224 +5,111 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CandidateAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CandidateAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CandidateAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CandidateAddress::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CandidateAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('countryName', $data)) { - $object->setCountryName($data['countryName']); - unset($data['countryName']); - } - if (\array_key_exists('countryCode', $data)) { - $object->setCountryCode($data['countryCode']); - unset($data['countryCode']); - } - if (\array_key_exists('stateProvince', $data)) { - $object->setStateProvince($data['stateProvince']); - unset($data['stateProvince']); - } - if (\array_key_exists('city', $data)) { - $object->setCity($data['city']); - unset($data['city']); - } - if (\array_key_exists('town', $data)) { - $object->setTown($data['town']); - unset($data['town']); - } - if (\array_key_exists('postalCode', $data)) { - $object->setPostalCode($data['postalCode']); - unset($data['postalCode']); - } - if (\array_key_exists('postalCodeLow', $data)) { - $object->setPostalCodeLow($data['postalCodeLow']); - unset($data['postalCodeLow']); - } - if (\array_key_exists('postalCodeHigh', $data)) { - $object->setPostalCodeHigh($data['postalCodeHigh']); - unset($data['postalCodeHigh']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\CandidateAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CandidateAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\CandidateAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['countryName'] = $object->getCountryName(); - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['countryCode'] = $object->getCountryCode(); - } - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['stateProvince'] = $object->getStateProvince(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['city'] = $object->getCity(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['postalCode'] = $object->getPostalCode(); - } - if ($object->isInitialized('postalCodeLow') && null !== $object->getPostalCodeLow()) { - $data['postalCodeLow'] = $object->getPostalCodeLow(); - } - if ($object->isInitialized('postalCodeHigh') && null !== $object->getPostalCodeHigh()) { - $data['postalCodeHigh'] = $object->getPostalCodeHigh(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('countryName', $data)) { + $object->setCountryName($data['countryName']); + unset($data['countryName']); + } + if (\array_key_exists('countryCode', $data)) { + $object->setCountryCode($data['countryCode']); + unset($data['countryCode']); + } + if (\array_key_exists('stateProvince', $data)) { + $object->setStateProvince($data['stateProvince']); + unset($data['stateProvince']); + } + if (\array_key_exists('city', $data)) { + $object->setCity($data['city']); + unset($data['city']); + } + if (\array_key_exists('town', $data)) { + $object->setTown($data['town']); + unset($data['town']); + } + if (\array_key_exists('postalCode', $data)) { + $object->setPostalCode($data['postalCode']); + unset($data['postalCode']); + } + if (\array_key_exists('postalCodeLow', $data)) { + $object->setPostalCodeLow($data['postalCodeLow']); + unset($data['postalCodeLow']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CandidateAddress::class => false]; + if (\array_key_exists('postalCodeHigh', $data)) { + $object->setPostalCodeHigh($data['postalCodeHigh']); + unset($data['postalCodeHigh']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class CandidateAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CandidateAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CandidateAddress::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CandidateAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('countryName', $data)) { - $object->setCountryName($data['countryName']); - unset($data['countryName']); - } - if (\array_key_exists('countryCode', $data)) { - $object->setCountryCode($data['countryCode']); - unset($data['countryCode']); - } - if (\array_key_exists('stateProvince', $data)) { - $object->setStateProvince($data['stateProvince']); - unset($data['stateProvince']); - } - if (\array_key_exists('city', $data)) { - $object->setCity($data['city']); - unset($data['city']); - } - if (\array_key_exists('town', $data)) { - $object->setTown($data['town']); - unset($data['town']); - } - if (\array_key_exists('postalCode', $data)) { - $object->setPostalCode($data['postalCode']); - unset($data['postalCode']); - } - if (\array_key_exists('postalCodeLow', $data)) { - $object->setPostalCodeLow($data['postalCodeLow']); - unset($data['postalCodeLow']); - } - if (\array_key_exists('postalCodeHigh', $data)) { - $object->setPostalCodeHigh($data['postalCodeHigh']); - unset($data['postalCodeHigh']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['countryName'] = $data->getCountryName(); + if ($data->isInitialized('countryCode') && null !== $data->getCountryCode()) { + $dataArray['countryCode'] = $data->getCountryCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['countryName'] = $object->getCountryName(); - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['countryCode'] = $object->getCountryCode(); - } - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['stateProvince'] = $object->getStateProvince(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['city'] = $object->getCity(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['postalCode'] = $object->getPostalCode(); - } - if ($object->isInitialized('postalCodeLow') && null !== $object->getPostalCodeLow()) { - $data['postalCodeLow'] = $object->getPostalCodeLow(); - } - if ($object->isInitialized('postalCodeHigh') && null !== $object->getPostalCodeHigh()) { - $data['postalCodeHigh'] = $object->getPostalCodeHigh(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('stateProvince') && null !== $data->getStateProvince()) { + $dataArray['stateProvince'] = $data->getStateProvince(); + } + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['city'] = $data->getCity(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CandidateAddress::class => false]; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['town'] = $data->getTown(); } + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['postalCode'] = $data->getPostalCode(); + } + if ($data->isInitialized('postalCodeLow') && null !== $data->getPostalCodeLow()) { + $dataArray['postalCodeLow'] = $data->getPostalCodeLow(); + } + if ($data->isInitialized('postalCodeHigh') && null !== $data->getPostalCodeHigh()) { + $dataArray['postalCodeHigh'] = $data->getPostalCodeHigh(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CandidateAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ChargeCardCardAddressNormalizer.php b/src/Api/Normalizer/ChargeCardCardAddressNormalizer.php index 2b8f5316..4312a381 100644 --- a/src/Api/Normalizer/ChargeCardCardAddressNormalizer.php +++ b/src/Api/Normalizer/ChargeCardCardAddressNormalizer.php @@ -5,198 +5,98 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ChargeCardCardAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ChargeCardCardAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class; + return $type === \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChargeCardCardAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ChargeCardCardAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['StateProvince'] = $object->getStateProvince(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); + if (\array_key_exists('AddressLine', $data)) { + $values = []; + foreach ($data['AddressLine'] as $value) { + $values[] = $value; } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChargeCardCardAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } - } -} else { - class ChargeCardCardAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class; + if (\array_key_exists('StateProvince', $data)) { + $object->setStateProvince($data['StateProvince']); + unset($data['StateProvince']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChargeCardCardAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['StateProvince'] = $object->getStateProvince(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('addressLine') && null !== $data->getAddressLine()) { + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - return $data; + $dataArray['AddressLine'] = $values; + } + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChargeCardCardAddress::class => false]; + if ($data->isInitialized('stateProvince') && null !== $data->getStateProvince()) { + $dataArray['StateProvince'] = $data->getStateProvince(); } + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); + } + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ChargeCardCardAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ChemicalDataChemicalDetailNormalizer.php b/src/Api/Normalizer/ChemicalDataChemicalDetailNormalizer.php index 04d5d632..7dd58546 100644 --- a/src/Api/Normalizer/ChemicalDataChemicalDetailNormalizer.php +++ b/src/Api/Normalizer/ChemicalDataChemicalDetailNormalizer.php @@ -5,326 +5,162 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ChemicalDataChemicalDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ChemicalDataChemicalDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('IDNumber', $data)) { - $object->setIDNumber($data['IDNumber']); - unset($data['IDNumber']); - } - if (\array_key_exists('HazardousMaterialsDescription', $data)) { - $object->setHazardousMaterialsDescription($data['HazardousMaterialsDescription']); - unset($data['HazardousMaterialsDescription']); - } - if (\array_key_exists('ClassDivisionNumber', $data)) { - $object->setClassDivisionNumber($data['ClassDivisionNumber']); - unset($data['ClassDivisionNumber']); - } - if (\array_key_exists('SubRiskClass', $data)) { - $object->setSubRiskClass($data['SubRiskClass']); - unset($data['SubRiskClass']); - } - if (\array_key_exists('PackagingGroupType', $data)) { - $object->setPackagingGroupType($data['PackagingGroupType']); - unset($data['PackagingGroupType']); - } - if (\array_key_exists('SpecialPermit', $data)) { - $object->setSpecialPermit($data['SpecialPermit']); - unset($data['SpecialPermit']); - } - if (\array_key_exists('TechnicalNameRequiredIndicator', $data)) { - $object->setTechnicalNameRequiredIndicator($data['TechnicalNameRequiredIndicator']); - unset($data['TechnicalNameRequiredIndicator']); - } - if (\array_key_exists('AdditionalShippingInformationRequiredIndicator', $data)) { - $object->setAdditionalShippingInformationRequiredIndicator($data['AdditionalShippingInformationRequiredIndicator']); - unset($data['AdditionalShippingInformationRequiredIndicator']); - } - if (\array_key_exists('TunnelRestrictionCode', $data)) { - $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); - unset($data['TunnelRestrictionCode']); - } - if (\array_key_exists('TransportCategory', $data)) { - $object->setTransportCategory($data['TransportCategory']); - unset($data['TransportCategory']); - } - if (\array_key_exists('TransportMultiplierQuantity', $data)) { - $object->setTransportMultiplierQuantity($data['TransportMultiplierQuantity']); - unset($data['TransportMultiplierQuantity']); - } - if (\array_key_exists('ChannelTunnelAcceptedIndicator', $data)) { - $object->setChannelTunnelAcceptedIndicator($data['ChannelTunnelAcceptedIndicator']); - unset($data['ChannelTunnelAcceptedIndicator']); - } - if (\array_key_exists('ChemicalType', $data)) { - $object->setChemicalType($data['ChemicalType']); - unset($data['ChemicalType']); - } - if (\array_key_exists('CAToUSShipmentAllowedIndicator', $data)) { - $object->setCAToUSShipmentAllowedIndicator($data['CAToUSShipmentAllowedIndicator']); - unset($data['CAToUSShipmentAllowedIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('regulationSet') && null !== $object->getRegulationSet()) { - $data['RegulationSet'] = $object->getRegulationSet(); - } - if ($object->isInitialized('iDNumber') && null !== $object->getIDNumber()) { - $data['IDNumber'] = $object->getIDNumber(); - } - if ($object->isInitialized('hazardousMaterialsDescription') && null !== $object->getHazardousMaterialsDescription()) { - $data['HazardousMaterialsDescription'] = $object->getHazardousMaterialsDescription(); - } - if ($object->isInitialized('classDivisionNumber') && null !== $object->getClassDivisionNumber()) { - $data['ClassDivisionNumber'] = $object->getClassDivisionNumber(); - } - if ($object->isInitialized('subRiskClass') && null !== $object->getSubRiskClass()) { - $data['SubRiskClass'] = $object->getSubRiskClass(); - } - if ($object->isInitialized('packagingGroupType') && null !== $object->getPackagingGroupType()) { - $data['PackagingGroupType'] = $object->getPackagingGroupType(); - } - if ($object->isInitialized('specialPermit') && null !== $object->getSpecialPermit()) { - $data['SpecialPermit'] = $object->getSpecialPermit(); - } - if ($object->isInitialized('technicalNameRequiredIndicator') && null !== $object->getTechnicalNameRequiredIndicator()) { - $data['TechnicalNameRequiredIndicator'] = $object->getTechnicalNameRequiredIndicator(); - } - if ($object->isInitialized('additionalShippingInformationRequiredIndicator') && null !== $object->getAdditionalShippingInformationRequiredIndicator()) { - $data['AdditionalShippingInformationRequiredIndicator'] = $object->getAdditionalShippingInformationRequiredIndicator(); - } - if ($object->isInitialized('tunnelRestrictionCode') && null !== $object->getTunnelRestrictionCode()) { - $data['TunnelRestrictionCode'] = $object->getTunnelRestrictionCode(); - } - if ($object->isInitialized('transportCategory') && null !== $object->getTransportCategory()) { - $data['TransportCategory'] = $object->getTransportCategory(); - } - if ($object->isInitialized('transportMultiplierQuantity') && null !== $object->getTransportMultiplierQuantity()) { - $data['TransportMultiplierQuantity'] = $object->getTransportMultiplierQuantity(); - } - if ($object->isInitialized('channelTunnelAcceptedIndicator') && null !== $object->getChannelTunnelAcceptedIndicator()) { - $data['ChannelTunnelAcceptedIndicator'] = $object->getChannelTunnelAcceptedIndicator(); - } - if ($object->isInitialized('chemicalType') && null !== $object->getChemicalType()) { - $data['ChemicalType'] = $object->getChemicalType(); - } - if ($object->isInitialized('cAToUSShipmentAllowedIndicator') && null !== $object->getCAToUSShipmentAllowedIndicator()) { - $data['CAToUSShipmentAllowedIndicator'] = $object->getCAToUSShipmentAllowedIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RegulationSet', $data)) { + $object->setRegulationSet($data['RegulationSet']); + unset($data['RegulationSet']); + } + if (\array_key_exists('IDNumber', $data)) { + $object->setIDNumber($data['IDNumber']); + unset($data['IDNumber']); + } + if (\array_key_exists('HazardousMaterialsDescription', $data)) { + $object->setHazardousMaterialsDescription($data['HazardousMaterialsDescription']); + unset($data['HazardousMaterialsDescription']); + } + if (\array_key_exists('ClassDivisionNumber', $data)) { + $object->setClassDivisionNumber($data['ClassDivisionNumber']); + unset($data['ClassDivisionNumber']); + } + if (\array_key_exists('SubRiskClass', $data)) { + $object->setSubRiskClass($data['SubRiskClass']); + unset($data['SubRiskClass']); + } + if (\array_key_exists('PackagingGroupType', $data)) { + $object->setPackagingGroupType($data['PackagingGroupType']); + unset($data['PackagingGroupType']); + } + if (\array_key_exists('SpecialPermit', $data)) { + $object->setSpecialPermit($data['SpecialPermit']); + unset($data['SpecialPermit']); + } + if (\array_key_exists('TechnicalNameRequiredIndicator', $data)) { + $object->setTechnicalNameRequiredIndicator($data['TechnicalNameRequiredIndicator']); + unset($data['TechnicalNameRequiredIndicator']); + } + if (\array_key_exists('AdditionalShippingInformationRequiredIndicator', $data)) { + $object->setAdditionalShippingInformationRequiredIndicator($data['AdditionalShippingInformationRequiredIndicator']); + unset($data['AdditionalShippingInformationRequiredIndicator']); + } + if (\array_key_exists('TunnelRestrictionCode', $data)) { + $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); + unset($data['TunnelRestrictionCode']); + } + if (\array_key_exists('TransportCategory', $data)) { + $object->setTransportCategory($data['TransportCategory']); + unset($data['TransportCategory']); + } + if (\array_key_exists('TransportMultiplierQuantity', $data)) { + $object->setTransportMultiplierQuantity($data['TransportMultiplierQuantity']); + unset($data['TransportMultiplierQuantity']); + } + if (\array_key_exists('ChannelTunnelAcceptedIndicator', $data)) { + $object->setChannelTunnelAcceptedIndicator($data['ChannelTunnelAcceptedIndicator']); + unset($data['ChannelTunnelAcceptedIndicator']); + } + if (\array_key_exists('ChemicalType', $data)) { + $object->setChemicalType($data['ChemicalType']); + unset($data['ChemicalType']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class => false]; + if (\array_key_exists('CAToUSShipmentAllowedIndicator', $data)) { + $object->setCAToUSShipmentAllowedIndicator($data['CAToUSShipmentAllowedIndicator']); + unset($data['CAToUSShipmentAllowedIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ChemicalDataChemicalDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('IDNumber', $data)) { - $object->setIDNumber($data['IDNumber']); - unset($data['IDNumber']); - } - if (\array_key_exists('HazardousMaterialsDescription', $data)) { - $object->setHazardousMaterialsDescription($data['HazardousMaterialsDescription']); - unset($data['HazardousMaterialsDescription']); - } - if (\array_key_exists('ClassDivisionNumber', $data)) { - $object->setClassDivisionNumber($data['ClassDivisionNumber']); - unset($data['ClassDivisionNumber']); - } - if (\array_key_exists('SubRiskClass', $data)) { - $object->setSubRiskClass($data['SubRiskClass']); - unset($data['SubRiskClass']); - } - if (\array_key_exists('PackagingGroupType', $data)) { - $object->setPackagingGroupType($data['PackagingGroupType']); - unset($data['PackagingGroupType']); - } - if (\array_key_exists('SpecialPermit', $data)) { - $object->setSpecialPermit($data['SpecialPermit']); - unset($data['SpecialPermit']); - } - if (\array_key_exists('TechnicalNameRequiredIndicator', $data)) { - $object->setTechnicalNameRequiredIndicator($data['TechnicalNameRequiredIndicator']); - unset($data['TechnicalNameRequiredIndicator']); - } - if (\array_key_exists('AdditionalShippingInformationRequiredIndicator', $data)) { - $object->setAdditionalShippingInformationRequiredIndicator($data['AdditionalShippingInformationRequiredIndicator']); - unset($data['AdditionalShippingInformationRequiredIndicator']); - } - if (\array_key_exists('TunnelRestrictionCode', $data)) { - $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); - unset($data['TunnelRestrictionCode']); - } - if (\array_key_exists('TransportCategory', $data)) { - $object->setTransportCategory($data['TransportCategory']); - unset($data['TransportCategory']); - } - if (\array_key_exists('TransportMultiplierQuantity', $data)) { - $object->setTransportMultiplierQuantity($data['TransportMultiplierQuantity']); - unset($data['TransportMultiplierQuantity']); - } - if (\array_key_exists('ChannelTunnelAcceptedIndicator', $data)) { - $object->setChannelTunnelAcceptedIndicator($data['ChannelTunnelAcceptedIndicator']); - unset($data['ChannelTunnelAcceptedIndicator']); - } - if (\array_key_exists('ChemicalType', $data)) { - $object->setChemicalType($data['ChemicalType']); - unset($data['ChemicalType']); - } - if (\array_key_exists('CAToUSShipmentAllowedIndicator', $data)) { - $object->setCAToUSShipmentAllowedIndicator($data['CAToUSShipmentAllowedIndicator']); - unset($data['CAToUSShipmentAllowedIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('regulationSet') && null !== $data->getRegulationSet()) { + $dataArray['RegulationSet'] = $data->getRegulationSet(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('regulationSet') && null !== $object->getRegulationSet()) { - $data['RegulationSet'] = $object->getRegulationSet(); - } - if ($object->isInitialized('iDNumber') && null !== $object->getIDNumber()) { - $data['IDNumber'] = $object->getIDNumber(); - } - if ($object->isInitialized('hazardousMaterialsDescription') && null !== $object->getHazardousMaterialsDescription()) { - $data['HazardousMaterialsDescription'] = $object->getHazardousMaterialsDescription(); - } - if ($object->isInitialized('classDivisionNumber') && null !== $object->getClassDivisionNumber()) { - $data['ClassDivisionNumber'] = $object->getClassDivisionNumber(); - } - if ($object->isInitialized('subRiskClass') && null !== $object->getSubRiskClass()) { - $data['SubRiskClass'] = $object->getSubRiskClass(); - } - if ($object->isInitialized('packagingGroupType') && null !== $object->getPackagingGroupType()) { - $data['PackagingGroupType'] = $object->getPackagingGroupType(); - } - if ($object->isInitialized('specialPermit') && null !== $object->getSpecialPermit()) { - $data['SpecialPermit'] = $object->getSpecialPermit(); - } - if ($object->isInitialized('technicalNameRequiredIndicator') && null !== $object->getTechnicalNameRequiredIndicator()) { - $data['TechnicalNameRequiredIndicator'] = $object->getTechnicalNameRequiredIndicator(); - } - if ($object->isInitialized('additionalShippingInformationRequiredIndicator') && null !== $object->getAdditionalShippingInformationRequiredIndicator()) { - $data['AdditionalShippingInformationRequiredIndicator'] = $object->getAdditionalShippingInformationRequiredIndicator(); - } - if ($object->isInitialized('tunnelRestrictionCode') && null !== $object->getTunnelRestrictionCode()) { - $data['TunnelRestrictionCode'] = $object->getTunnelRestrictionCode(); - } - if ($object->isInitialized('transportCategory') && null !== $object->getTransportCategory()) { - $data['TransportCategory'] = $object->getTransportCategory(); - } - if ($object->isInitialized('transportMultiplierQuantity') && null !== $object->getTransportMultiplierQuantity()) { - $data['TransportMultiplierQuantity'] = $object->getTransportMultiplierQuantity(); - } - if ($object->isInitialized('channelTunnelAcceptedIndicator') && null !== $object->getChannelTunnelAcceptedIndicator()) { - $data['ChannelTunnelAcceptedIndicator'] = $object->getChannelTunnelAcceptedIndicator(); - } - if ($object->isInitialized('chemicalType') && null !== $object->getChemicalType()) { - $data['ChemicalType'] = $object->getChemicalType(); - } - if ($object->isInitialized('cAToUSShipmentAllowedIndicator') && null !== $object->getCAToUSShipmentAllowedIndicator()) { - $data['CAToUSShipmentAllowedIndicator'] = $object->getCAToUSShipmentAllowedIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('iDNumber') && null !== $data->getIDNumber()) { + $dataArray['IDNumber'] = $data->getIDNumber(); + } + if ($data->isInitialized('hazardousMaterialsDescription') && null !== $data->getHazardousMaterialsDescription()) { + $dataArray['HazardousMaterialsDescription'] = $data->getHazardousMaterialsDescription(); + } + if ($data->isInitialized('classDivisionNumber') && null !== $data->getClassDivisionNumber()) { + $dataArray['ClassDivisionNumber'] = $data->getClassDivisionNumber(); + } + if ($data->isInitialized('subRiskClass') && null !== $data->getSubRiskClass()) { + $dataArray['SubRiskClass'] = $data->getSubRiskClass(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class => false]; + if ($data->isInitialized('packagingGroupType') && null !== $data->getPackagingGroupType()) { + $dataArray['PackagingGroupType'] = $data->getPackagingGroupType(); } + if ($data->isInitialized('specialPermit') && null !== $data->getSpecialPermit()) { + $dataArray['SpecialPermit'] = $data->getSpecialPermit(); + } + if ($data->isInitialized('technicalNameRequiredIndicator') && null !== $data->getTechnicalNameRequiredIndicator()) { + $dataArray['TechnicalNameRequiredIndicator'] = $data->getTechnicalNameRequiredIndicator(); + } + if ($data->isInitialized('additionalShippingInformationRequiredIndicator') && null !== $data->getAdditionalShippingInformationRequiredIndicator()) { + $dataArray['AdditionalShippingInformationRequiredIndicator'] = $data->getAdditionalShippingInformationRequiredIndicator(); + } + if ($data->isInitialized('tunnelRestrictionCode') && null !== $data->getTunnelRestrictionCode()) { + $dataArray['TunnelRestrictionCode'] = $data->getTunnelRestrictionCode(); + } + if ($data->isInitialized('transportCategory') && null !== $data->getTransportCategory()) { + $dataArray['TransportCategory'] = $data->getTransportCategory(); + } + if ($data->isInitialized('transportMultiplierQuantity') && null !== $data->getTransportMultiplierQuantity()) { + $dataArray['TransportMultiplierQuantity'] = $data->getTransportMultiplierQuantity(); + } + if ($data->isInitialized('channelTunnelAcceptedIndicator') && null !== $data->getChannelTunnelAcceptedIndicator()) { + $dataArray['ChannelTunnelAcceptedIndicator'] = $data->getChannelTunnelAcceptedIndicator(); + } + if ($data->isInitialized('chemicalType') && null !== $data->getChemicalType()) { + $dataArray['ChemicalType'] = $data->getChemicalType(); + } + if ($data->isInitialized('cAToUSShipmentAllowedIndicator') && null !== $data->getCAToUSShipmentAllowedIndicator()) { + $dataArray['CAToUSShipmentAllowedIndicator'] = $data->getCAToUSShipmentAllowedIndicator(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ChemicalDataPackageQuantityLimitDetailNormalizer.php b/src/Api/Normalizer/ChemicalDataPackageQuantityLimitDetailNormalizer.php index ff643cb5..2706a440 100644 --- a/src/Api/Normalizer/ChemicalDataPackageQuantityLimitDetailNormalizer.php +++ b/src/Api/Normalizer/ChemicalDataPackageQuantityLimitDetailNormalizer.php @@ -5,172 +5,85 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ChemicalDataPackageQuantityLimitDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ChemicalDataPackageQuantityLimitDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class; + return $type === \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageQuantityLimitTypeCode', $data)) { - $object->setPackageQuantityLimitTypeCode($data['PackageQuantityLimitTypeCode']); - unset($data['PackageQuantityLimitTypeCode']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('UOM', $data)) { - $object->setUOM($data['UOM']); - unset($data['UOM']); - } - if (\array_key_exists('PackagingInstructionCode', $data)) { - $object->setPackagingInstructionCode($data['PackagingInstructionCode']); - unset($data['PackagingInstructionCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('packageQuantityLimitTypeCode') && null !== $object->getPackageQuantityLimitTypeCode()) { - $data['PackageQuantityLimitTypeCode'] = $object->getPackageQuantityLimitTypeCode(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['Quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('uOM') && null !== $object->getUOM()) { - $data['UOM'] = $object->getUOM(); - } - if ($object->isInitialized('packagingInstructionCode') && null !== $object->getPackagingInstructionCode()) { - $data['PackagingInstructionCode'] = $object->getPackagingInstructionCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PackageQuantityLimitTypeCode', $data)) { + $object->setPackageQuantityLimitTypeCode($data['PackageQuantityLimitTypeCode']); + unset($data['PackageQuantityLimitTypeCode']); + } + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); + } + if (\array_key_exists('UOM', $data)) { + $object->setUOM($data['UOM']); + unset($data['UOM']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class => false]; + if (\array_key_exists('PackagingInstructionCode', $data)) { + $object->setPackagingInstructionCode($data['PackagingInstructionCode']); + unset($data['PackagingInstructionCode']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ChemicalDataPackageQuantityLimitDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class; + $dataArray = []; + if ($data->isInitialized('packageQuantityLimitTypeCode') && null !== $data->getPackageQuantityLimitTypeCode()) { + $dataArray['PackageQuantityLimitTypeCode'] = $data->getPackageQuantityLimitTypeCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class; + if ($data->isInitialized('quantity') && null !== $data->getQuantity()) { + $dataArray['Quantity'] = $data->getQuantity(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageQuantityLimitTypeCode', $data)) { - $object->setPackageQuantityLimitTypeCode($data['PackageQuantityLimitTypeCode']); - unset($data['PackageQuantityLimitTypeCode']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('UOM', $data)) { - $object->setUOM($data['UOM']); - unset($data['UOM']); - } - if (\array_key_exists('PackagingInstructionCode', $data)) { - $object->setPackagingInstructionCode($data['PackagingInstructionCode']); - unset($data['PackagingInstructionCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('uOM') && null !== $data->getUOM()) { + $dataArray['UOM'] = $data->getUOM(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('packageQuantityLimitTypeCode') && null !== $object->getPackageQuantityLimitTypeCode()) { - $data['PackageQuantityLimitTypeCode'] = $object->getPackageQuantityLimitTypeCode(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['Quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('uOM') && null !== $object->getUOM()) { - $data['UOM'] = $object->getUOM(); - } - if ($object->isInitialized('packagingInstructionCode') && null !== $object->getPackagingInstructionCode()) { - $data['PackagingInstructionCode'] = $object->getPackagingInstructionCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('packagingInstructionCode') && null !== $data->getPackagingInstructionCode()) { + $dataArray['PackagingInstructionCode'] = $data->getPackagingInstructionCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ChemicalDataProperShippingNameDetailNormalizer.php b/src/Api/Normalizer/ChemicalDataProperShippingNameDetailNormalizer.php index 098ef843..2385e234 100644 --- a/src/Api/Normalizer/ChemicalDataProperShippingNameDetailNormalizer.php +++ b/src/Api/Normalizer/ChemicalDataProperShippingNameDetailNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ChemicalDataProperShippingNameDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ChemicalDataProperShippingNameDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class; + return $type === \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ProperShippingName', $data)) { - $object->setProperShippingName($data['ProperShippingName']); - unset($data['ProperShippingName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ProperShippingName'] = $object->getProperShippingName(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ProperShippingName', $data)) { + $object->setProperShippingName($data['ProperShippingName']); + unset($data['ProperShippingName']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ChemicalDataProperShippingNameDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['ProperShippingName'] = $data->getProperShippingName(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('ProperShippingName', $data)) { - $object->setProperShippingName($data['ProperShippingName']); - unset($data['ProperShippingName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ProperShippingName'] = $object->getProperShippingName(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ChemicalReferenceDataRequestNormalizer.php b/src/Api/Normalizer/ChemicalReferenceDataRequestNormalizer.php index 36f997cb..71a4f908 100644 --- a/src/Api/Normalizer/ChemicalReferenceDataRequestNormalizer.php +++ b/src/Api/Normalizer/ChemicalReferenceDataRequestNormalizer.php @@ -5,164 +5,81 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ChemicalReferenceDataRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ChemicalReferenceDataRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class; + return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('IDNumber', $data)) { - $object->setIDNumber($data['IDNumber']); - unset($data['IDNumber']); - } - if (\array_key_exists('ProperShippingName', $data)) { - $object->setProperShippingName($data['ProperShippingName']); - unset($data['ProperShippingName']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('iDNumber') && null !== $object->getIDNumber()) { - $data['IDNumber'] = $object->getIDNumber(); - } - if ($object->isInitialized('properShippingName') && null !== $object->getProperShippingName()) { - $data['ProperShippingName'] = $object->getProperShippingName(); - } - $data['ShipperNumber'] = $object->getShipperNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class, 'json', $context)); + unset($data['Request']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class => false]; + if (\array_key_exists('IDNumber', $data)) { + $object->setIDNumber($data['IDNumber']); + unset($data['IDNumber']); } - } -} else { - class ChemicalReferenceDataRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class; + if (\array_key_exists('ProperShippingName', $data)) { + $object->setProperShippingName($data['ProperShippingName']); + unset($data['ProperShippingName']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class; + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('IDNumber', $data)) { - $object->setIDNumber($data['IDNumber']); - unset($data['IDNumber']); - } - if (\array_key_exists('ProperShippingName', $data)) { - $object->setProperShippingName($data['ProperShippingName']); - unset($data['ProperShippingName']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('iDNumber') && null !== $object->getIDNumber()) { - $data['IDNumber'] = $object->getIDNumber(); - } - if ($object->isInitialized('properShippingName') && null !== $object->getProperShippingName()) { - $data['ProperShippingName'] = $object->getProperShippingName(); - } - $data['ShipperNumber'] = $object->getShipperNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + if ($data->isInitialized('iDNumber') && null !== $data->getIDNumber()) { + $dataArray['IDNumber'] = $data->getIDNumber(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class => false]; + if ($data->isInitialized('properShippingName') && null !== $data->getProperShippingName()) { + $dataArray['ProperShippingName'] = $data->getProperShippingName(); } + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ChemicalReferenceDataRequestRequestNormalizer.php b/src/Api/Normalizer/ChemicalReferenceDataRequestRequestNormalizer.php index 1736d34d..9803a871 100644 --- a/src/Api/Normalizer/ChemicalReferenceDataRequestRequestNormalizer.php +++ b/src/Api/Normalizer/ChemicalReferenceDataRequestRequestNormalizer.php @@ -5,174 +5,86 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ChemicalReferenceDataRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ChemicalReferenceDataRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $values = []; - foreach ($data['RequestOption'] as $value) { - $values[] = $value; - } - $object->setRequestOption($values); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $values = []; - foreach ($object->getRequestOption() as $value) { - $values[] = $value; - } - $data['RequestOption'] = $values; - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); + if (\array_key_exists('RequestOption', $data)) { + $values = []; + foreach ($data['RequestOption'] as $value) { + $values[] = $value; } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setRequestOption($values); + unset($data['RequestOption']); + } + if (\array_key_exists('SubVersion', $data)) { + $object->setSubVersion($data['SubVersion']); + unset($data['SubVersion']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class ChemicalReferenceDataRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('requestOption') && null !== $data->getRequestOption()) { + $values = []; + foreach ($data->getRequestOption() as $value) { + $values[] = $value; + } + $dataArray['RequestOption'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class; + if ($data->isInitialized('subVersion') && null !== $data->getSubVersion()) { + $dataArray['SubVersion'] = $data->getSubVersion(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $values = []; - foreach ($data['RequestOption'] as $value) { - $values[] = $value; - } - $object->setRequestOption($values); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $values = []; - foreach ($object->getRequestOption() as $value) { - $values[] = $value; - } - $data['RequestOption'] = $values; - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ChemicalReferenceDataResponseChemicalDataNormalizer.php b/src/Api/Normalizer/ChemicalReferenceDataResponseChemicalDataNormalizer.php index c8f04ac4..f092be99 100644 --- a/src/Api/Normalizer/ChemicalReferenceDataResponseChemicalDataNormalizer.php +++ b/src/Api/Normalizer/ChemicalReferenceDataResponseChemicalDataNormalizer.php @@ -5,174 +5,86 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ChemicalReferenceDataResponseChemicalDataNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ChemicalReferenceDataResponseChemicalDataNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class; + return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ChemicalDetail', $data)) { - $object->setChemicalDetail($this->denormalizer->denormalize($data['ChemicalDetail'], \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class, 'json', $context)); - unset($data['ChemicalDetail']); - } - if (\array_key_exists('ProperShippingNameDetail', $data)) { - $object->setProperShippingNameDetail($this->denormalizer->denormalize($data['ProperShippingNameDetail'], \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class, 'json', $context)); - unset($data['ProperShippingNameDetail']); - } - if (\array_key_exists('PackageQuantityLimitDetail', $data)) { - $values = []; - foreach ($data['PackageQuantityLimitDetail'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class, 'json', $context); - } - $object->setPackageQuantityLimitDetail($values); - unset($data['PackageQuantityLimitDetail']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('chemicalDetail') && null !== $object->getChemicalDetail()) { - $data['ChemicalDetail'] = $this->normalizer->normalize($object->getChemicalDetail(), 'json', $context); - } - if ($object->isInitialized('properShippingNameDetail') && null !== $object->getProperShippingNameDetail()) { - $data['ProperShippingNameDetail'] = $this->normalizer->normalize($object->getProperShippingNameDetail(), 'json', $context); - } - if ($object->isInitialized('packageQuantityLimitDetail') && null !== $object->getPackageQuantityLimitDetail()) { - $values = []; - foreach ($object->getPackageQuantityLimitDetail() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PackageQuantityLimitDetail'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ChemicalDetail', $data)) { + $object->setChemicalDetail($this->denormalizer->denormalize($data['ChemicalDetail'], \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class, 'json', $context)); + unset($data['ChemicalDetail']); + } + if (\array_key_exists('ProperShippingNameDetail', $data)) { + $object->setProperShippingNameDetail($this->denormalizer->denormalize($data['ProperShippingNameDetail'], \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class, 'json', $context)); + unset($data['ProperShippingNameDetail']); + } + if (\array_key_exists('PackageQuantityLimitDetail', $data)) { + $values = []; + foreach ($data['PackageQuantityLimitDetail'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class, 'json', $context); } - return $data; + $object->setPackageQuantityLimitDetail($values); + unset($data['PackageQuantityLimitDetail']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class ChemicalReferenceDataResponseChemicalDataNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class; + $dataArray = []; + if ($data->isInitialized('chemicalDetail') && null !== $data->getChemicalDetail()) { + $dataArray['ChemicalDetail'] = $this->normalizer->normalize($data->getChemicalDetail(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class; + if ($data->isInitialized('properShippingNameDetail') && null !== $data->getProperShippingNameDetail()) { + $dataArray['ProperShippingNameDetail'] = $this->normalizer->normalize($data->getProperShippingNameDetail(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ChemicalDetail', $data)) { - $object->setChemicalDetail($this->denormalizer->denormalize($data['ChemicalDetail'], \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class, 'json', $context)); - unset($data['ChemicalDetail']); - } - if (\array_key_exists('ProperShippingNameDetail', $data)) { - $object->setProperShippingNameDetail($this->denormalizer->denormalize($data['ProperShippingNameDetail'], \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class, 'json', $context)); - unset($data['ProperShippingNameDetail']); - } - if (\array_key_exists('PackageQuantityLimitDetail', $data)) { - $values = []; - foreach ($data['PackageQuantityLimitDetail'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class, 'json', $context); - } - $object->setPackageQuantityLimitDetail($values); - unset($data['PackageQuantityLimitDetail']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + if ($data->isInitialized('packageQuantityLimitDetail') && null !== $data->getPackageQuantityLimitDetail()) { + $values = []; + foreach ($data->getPackageQuantityLimitDetail() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['PackageQuantityLimitDetail'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('chemicalDetail') && null !== $object->getChemicalDetail()) { - $data['ChemicalDetail'] = $this->normalizer->normalize($object->getChemicalDetail(), 'json', $context); - } - if ($object->isInitialized('properShippingNameDetail') && null !== $object->getProperShippingNameDetail()) { - $data['ProperShippingNameDetail'] = $this->normalizer->normalize($object->getProperShippingNameDetail(), 'json', $context); - } - if ($object->isInitialized('packageQuantityLimitDetail') && null !== $object->getPackageQuantityLimitDetail()) { - $values = []; - foreach ($object->getPackageQuantityLimitDetail() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PackageQuantityLimitDetail'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ChemicalReferenceDataResponseNormalizer.php b/src/Api/Normalizer/ChemicalReferenceDataResponseNormalizer.php index 978f2624..d50be73f 100644 --- a/src/Api/Normalizer/ChemicalReferenceDataResponseNormalizer.php +++ b/src/Api/Normalizer/ChemicalReferenceDataResponseNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ChemicalReferenceDataResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ChemicalReferenceDataResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class; + return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('ChemicalData', $data)) { - $values = []; - foreach ($data['ChemicalData'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class, 'json', $context); - } - $object->setChemicalData($values); - unset($data['ChemicalData']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('chemicalData') && null !== $object->getChemicalData()) { - $values = []; - foreach ($object->getChemicalData() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ChemicalData'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class, 'json', $context)); + unset($data['Response']); + } + if (\array_key_exists('ChemicalData', $data)) { + $values = []; + foreach ($data['ChemicalData'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class, 'json', $context); } - return $data; + $object->setChemicalData($values); + unset($data['ChemicalData']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class ChemicalReferenceDataResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + if ($data->isInitialized('chemicalData') && null !== $data->getChemicalData()) { + $values = []; + foreach ($data->getChemicalData() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['ChemicalData'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class, 'json', $context)); - unset($data['Response']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('ChemicalData', $data)) { - $values = []; - foreach ($data['ChemicalData'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class, 'json', $context); - } - $object->setChemicalData($values); - unset($data['ChemicalData']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('chemicalData') && null !== $object->getChemicalData()) { - $values = []; - foreach ($object->getChemicalData() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ChemicalData'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ChemicalReferenceDataResponseResponseNormalizer.php b/src/Api/Normalizer/ChemicalReferenceDataResponseResponseNormalizer.php index 83ee1fef..fb30d622 100644 --- a/src/Api/Normalizer/ChemicalReferenceDataResponseResponseNormalizer.php +++ b/src/Api/Normalizer/ChemicalReferenceDataResponseResponseNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ChemicalReferenceDataResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ChemicalReferenceDataResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); + } + if (\array_key_exists('Alert', $data)) { + $values = []; + foreach ($data['Alert'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); } - return $data; + $object->setAlert($values); + unset($data['Alert']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class ChemicalReferenceDataResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $values = []; + foreach ($data->getAlert() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Alert'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CommodityAdjustedWeightNormalizer.php b/src/Api/Normalizer/CommodityAdjustedWeightNormalizer.php index 25a9345f..aafce3d8 100644 --- a/src/Api/Normalizer/CommodityAdjustedWeightNormalizer.php +++ b/src/Api/Normalizer/CommodityAdjustedWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CommodityAdjustedWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CommodityAdjustedWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class; + return $type === \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityAdjustedWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CommodityAdjustedWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class => false]; - } - } -} else { - class CommodityAdjustedWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityAdjustedWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Value'] = $data->getValue(); + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CommodityCommodityValueNormalizer.php b/src/Api/Normalizer/CommodityCommodityValueNormalizer.php index 584e6b83..f552ceaf 100644 --- a/src/Api/Normalizer/CommodityCommodityValueNormalizer.php +++ b/src/Api/Normalizer/CommodityCommodityValueNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CommodityCommodityValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CommodityCommodityValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityCommodityValue::class; + return $type === \ShipStream\Ups\Api\Model\CommodityCommodityValue::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityCommodityValue::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityCommodityValue::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityCommodityValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CommodityCommodityValue(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('currencyCode') && null !== $object->getCurrencyCode()) { - $data['CurrencyCode'] = $object->getCurrencyCode(); - } - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); + } + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityCommodityValue::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class CommodityCommodityValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityCommodityValue::class; + $dataArray = []; + if ($data->isInitialized('currencyCode') && null !== $data->getCurrencyCode()) { + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityCommodityValue::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityCommodityValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('currencyCode') && null !== $object->getCurrencyCode()) { - $data['CurrencyCode'] = $object->getCurrencyCode(); - } - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityCommodityValue::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CommodityCommodityValue::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CommodityDimensionsNormalizer.php b/src/Api/Normalizer/CommodityDimensionsNormalizer.php index c6d9d924..9f840343 100644 --- a/src/Api/Normalizer/CommodityDimensionsNormalizer.php +++ b/src/Api/Normalizer/CommodityDimensionsNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CommodityDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CommodityDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityDimensions::class; + return $type === \ShipStream\Ups\Api\Model\CommodityDimensions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityDimensions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityDimensions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CommodityDimensions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['Height'] = $object->getHeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityDimensions::class => false]; + if (\array_key_exists('Length', $data)) { + $object->setLength($data['Length']); + unset($data['Length']); } - } -} else { - class CommodityDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityDimensions::class; + if (\array_key_exists('Width', $data)) { + $object->setWidth($data['Width']); + unset($data['Width']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityDimensions::class; + if (\array_key_exists('Height', $data)) { + $object->setHeight($data['Height']); + unset($data['Height']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['Height'] = $object->getHeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Length'] = $data->getLength(); + $dataArray['Width'] = $data->getWidth(); + $dataArray['Height'] = $data->getHeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityDimensions::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CommodityDimensions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CommodityNMFCCommodityNormalizer.php b/src/Api/Normalizer/CommodityNMFCCommodityNormalizer.php index a05c4c0e..689142a0 100644 --- a/src/Api/Normalizer/CommodityNMFCCommodityNormalizer.php +++ b/src/Api/Normalizer/CommodityNMFCCommodityNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CommodityNMFCCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CommodityNMFCCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class; + return $type === \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityNMFCCommodity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PrimeCode', $data)) { - $object->setPrimeCode($data['PrimeCode']); - unset($data['PrimeCode']); - } - if (\array_key_exists('SubCode', $data)) { - $object->setSubCode($data['SubCode']); - unset($data['SubCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CommodityNMFCCommodity(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('primeCode') && null !== $object->getPrimeCode()) { - $data['PrimeCode'] = $object->getPrimeCode(); - } - if ($object->isInitialized('subCode') && null !== $object->getSubCode()) { - $data['SubCode'] = $object->getSubCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PrimeCode', $data)) { + $object->setPrimeCode($data['PrimeCode']); + unset($data['PrimeCode']); + } + if (\array_key_exists('SubCode', $data)) { + $object->setSubCode($data['SubCode']); + unset($data['SubCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class CommodityNMFCCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class; + $dataArray = []; + if ($data->isInitialized('primeCode') && null !== $data->getPrimeCode()) { + $dataArray['PrimeCode'] = $data->getPrimeCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityNMFCCommodity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PrimeCode', $data)) { - $object->setPrimeCode($data['PrimeCode']); - unset($data['PrimeCode']); - } - if (\array_key_exists('SubCode', $data)) { - $object->setSubCode($data['SubCode']); - unset($data['SubCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('subCode') && null !== $data->getSubCode()) { + $dataArray['SubCode'] = $data->getSubCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('primeCode') && null !== $object->getPrimeCode()) { - $data['PrimeCode'] = $object->getPrimeCode(); - } - if ($object->isInitialized('subCode') && null !== $object->getSubCode()) { - $data['SubCode'] = $object->getSubCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CommodityNMFCNormalizer.php b/src/Api/Normalizer/CommodityNMFCNormalizer.php index 6a0b8217..49998d1b 100644 --- a/src/Api/Normalizer/CommodityNMFCNormalizer.php +++ b/src/Api/Normalizer/CommodityNMFCNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CommodityNMFCNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CommodityNMFCNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityNMFC::class; + return $type === \ShipStream\Ups\Api\Model\CommodityNMFC::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityNMFC::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityNMFC::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityNMFC(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PrimeCode', $data)) { - $object->setPrimeCode($data['PrimeCode']); - unset($data['PrimeCode']); - } - if (\array_key_exists('SubCode', $data)) { - $object->setSubCode($data['SubCode']); - unset($data['SubCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CommodityNMFC(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PrimeCode'] = $object->getPrimeCode(); - if ($object->isInitialized('subCode') && null !== $object->getSubCode()) { - $data['SubCode'] = $object->getSubCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PrimeCode', $data)) { + $object->setPrimeCode($data['PrimeCode']); + unset($data['PrimeCode']); + } + if (\array_key_exists('SubCode', $data)) { + $object->setSubCode($data['SubCode']); + unset($data['SubCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityNMFC::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class CommodityNMFCNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityNMFC::class; + $dataArray = []; + $dataArray['PrimeCode'] = $data->getPrimeCode(); + if ($data->isInitialized('subCode') && null !== $data->getSubCode()) { + $dataArray['SubCode'] = $data->getSubCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityNMFC::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityNMFC(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PrimeCode', $data)) { - $object->setPrimeCode($data['PrimeCode']); - unset($data['PrimeCode']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('SubCode', $data)) { - $object->setSubCode($data['SubCode']); - unset($data['SubCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PrimeCode'] = $object->getPrimeCode(); - if ($object->isInitialized('subCode') && null !== $object->getSubCode()) { - $data['SubCode'] = $object->getSubCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityNMFC::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CommodityNMFC::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CommodityPackagingTypeNormalizer.php b/src/Api/Normalizer/CommodityPackagingTypeNormalizer.php index 93ce7f80..7bab3708 100644 --- a/src/Api/Normalizer/CommodityPackagingTypeNormalizer.php +++ b/src/Api/Normalizer/CommodityPackagingTypeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CommodityPackagingTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CommodityPackagingTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityPackagingType::class; + return $type === \ShipStream\Ups\Api\Model\CommodityPackagingType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityPackagingType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityPackagingType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityPackagingType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CommodityPackagingType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityPackagingType::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class CommodityPackagingTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityPackagingType::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityPackagingType::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityPackagingType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityPackagingType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CommodityPackagingType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CommodityWeightNormalizer.php b/src/Api/Normalizer/CommodityWeightNormalizer.php index dc183f49..abf9c717 100644 --- a/src/Api/Normalizer/CommodityWeightNormalizer.php +++ b/src/Api/Normalizer/CommodityWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CommodityWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CommodityWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityWeight::class; + return $type === \ShipStream\Ups\Api\Model\CommodityWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\CommodityWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityWeight::class => false]; - } - } -} else { - class CommodityWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CommodityWeight::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CommodityWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CommodityWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Value'] = $data->getValue(); + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CommodityWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CommodityWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ConfirmationNumberTypeNormalizer.php b/src/Api/Normalizer/ConfirmationNumberTypeNormalizer.php index d29d633c..d6c59267 100644 --- a/src/Api/Normalizer/ConfirmationNumberTypeNormalizer.php +++ b/src/Api/Normalizer/ConfirmationNumberTypeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ConfirmationNumberTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ConfirmationNumberTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ConfirmationNumberType::class; + return $type === \ShipStream\Ups\Api\Model\ConfirmationNumberType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ConfirmationNumberType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ConfirmationNumberType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ConfirmationNumberType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ConfirmationNumberType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ConfirmationNumberType::class => false]; - } - } -} else { - class ConfirmationNumberTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ConfirmationNumberType::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ConfirmationNumberType::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ConfirmationNumberType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ConfirmationNumberType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ConfirmationNumberType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ContactsForwardAgentNormalizer.php b/src/Api/Normalizer/ContactsForwardAgentNormalizer.php index 37de9c0d..a44c9838 100644 --- a/src/Api/Normalizer/ContactsForwardAgentNormalizer.php +++ b/src/Api/Normalizer/ContactsForwardAgentNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ContactsForwardAgentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ContactsForwardAgentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ContactsForwardAgent::class; + return $type === \ShipStream\Ups\Api\Model\ContactsForwardAgent::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsForwardAgent::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsForwardAgent::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ContactsForwardAgent(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ForwardAgentAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ContactsForwardAgent(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CompanyName'] = $object->getCompanyName(); - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CompanyName', $data)) { + $object->setCompanyName($data['CompanyName']); + unset($data['CompanyName']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ContactsForwardAgent::class => false]; + if (\array_key_exists('TaxIdentificationNumber', $data)) { + $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); + unset($data['TaxIdentificationNumber']); } - } -} else { - class ContactsForwardAgentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ContactsForwardAgent::class; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ForwardAgentAddress::class, 'json', $context)); + unset($data['Address']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsForwardAgent::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ContactsForwardAgent(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ForwardAgentAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CompanyName'] = $object->getCompanyName(); - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CompanyName'] = $data->getCompanyName(); + $dataArray['TaxIdentificationNumber'] = $data->getTaxIdentificationNumber(); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ContactsForwardAgent::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ContactsForwardAgent::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ContactsIntermediateConsigneeNormalizer.php b/src/Api/Normalizer/ContactsIntermediateConsigneeNormalizer.php index e6728837..2a51ff18 100644 --- a/src/Api/Normalizer/ContactsIntermediateConsigneeNormalizer.php +++ b/src/Api/Normalizer/ContactsIntermediateConsigneeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ContactsIntermediateConsigneeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ContactsIntermediateConsigneeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class; + return $type === \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CompanyName'] = $object->getCompanyName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class => false]; - } - } -} else { - class ContactsIntermediateConsigneeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class; + if (\array_key_exists('CompanyName', $data)) { + $object->setCompanyName($data['CompanyName']); + unset($data['CompanyName']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class, 'json', $context)); + unset($data['Address']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CompanyName'] = $object->getCompanyName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CompanyName'] = $data->getCompanyName(); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ContactsProducerNormalizer.php b/src/Api/Normalizer/ContactsProducerNormalizer.php index 0dcb3f2b..bc5708df 100644 --- a/src/Api/Normalizer/ContactsProducerNormalizer.php +++ b/src/Api/Normalizer/ContactsProducerNormalizer.php @@ -5,214 +5,106 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ContactsProducerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ContactsProducerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ContactsProducer::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsProducer::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ContactsProducer(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ProducerAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ProducerPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ContactsProducer::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsProducer::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ContactsProducer(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('option') && null !== $object->getOption()) { - $data['Option'] = $object->getOption(); - } - if ($object->isInitialized('companyName') && null !== $object->getCompanyName()) { - $data['CompanyName'] = $object->getCompanyName(); - } - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Option', $data)) { + $object->setOption($data['Option']); + unset($data['Option']); + } + if (\array_key_exists('CompanyName', $data)) { + $object->setCompanyName($data['CompanyName']); + unset($data['CompanyName']); + } + if (\array_key_exists('TaxIdentificationNumber', $data)) { + $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); + unset($data['TaxIdentificationNumber']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ProducerAddress::class, 'json', $context)); + unset($data['Address']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ProducerPhone::class, 'json', $context)); + unset($data['Phone']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ContactsProducer::class => false]; + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ContactsProducerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ContactsProducer::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsProducer::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ContactsProducer(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ProducerAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ProducerPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('option') && null !== $data->getOption()) { + $dataArray['Option'] = $data->getOption(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('option') && null !== $object->getOption()) { - $data['Option'] = $object->getOption(); - } - if ($object->isInitialized('companyName') && null !== $object->getCompanyName()) { - $data['CompanyName'] = $object->getCompanyName(); - } - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('companyName') && null !== $data->getCompanyName()) { + $dataArray['CompanyName'] = $data->getCompanyName(); + } + if ($data->isInitialized('taxIdentificationNumber') && null !== $data->getTaxIdentificationNumber()) { + $dataArray['TaxIdentificationNumber'] = $data->getTaxIdentificationNumber(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ContactsProducer::class => false]; + if ($data->isInitialized('address') && null !== $data->getAddress()) { + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); } + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); + } + if ($data->isInitialized('phone') && null !== $data->getPhone()) { + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); + } + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ContactsProducer::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ContactsSoldToNormalizer.php b/src/Api/Normalizer/ContactsSoldToNormalizer.php index 57002d94..02821b52 100644 --- a/src/Api/Normalizer/ContactsSoldToNormalizer.php +++ b/src/Api/Normalizer/ContactsSoldToNormalizer.php @@ -5,216 +5,107 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ContactsSoldToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ContactsSoldToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ContactsSoldTo::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsSoldTo::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ContactsSoldTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\SoldToPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\SoldToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ContactsSoldTo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsSoldTo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ContactsSoldTo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - $data['AttentionName'] = $object->getAttentionName(); - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('option') && null !== $object->getOption()) { - $data['Option'] = $object->getOption(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('accountNumber') && null !== $object->getAccountNumber()) { - $data['AccountNumber'] = $object->getAccountNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('TaxIdentificationNumber', $data)) { + $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); + unset($data['TaxIdentificationNumber']); + } + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\SoldToPhone::class, 'json', $context)); + unset($data['Phone']); + } + if (\array_key_exists('Option', $data)) { + $object->setOption($data['Option']); + unset($data['Option']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\SoldToAddress::class, 'json', $context)); + unset($data['Address']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ContactsSoldTo::class => false]; + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } + if (\array_key_exists('AccountNumber', $data)) { + $object->setAccountNumber($data['AccountNumber']); + unset($data['AccountNumber']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ContactsSoldToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ContactsSoldTo::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsSoldTo::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ContactsSoldTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\SoldToPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\SoldToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Name'] = $data->getName(); + $dataArray['AttentionName'] = $data->getAttentionName(); + if ($data->isInitialized('taxIdentificationNumber') && null !== $data->getTaxIdentificationNumber()) { + $dataArray['TaxIdentificationNumber'] = $data->getTaxIdentificationNumber(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - $data['AttentionName'] = $object->getAttentionName(); - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('option') && null !== $object->getOption()) { - $data['Option'] = $object->getOption(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('accountNumber') && null !== $object->getAccountNumber()) { - $data['AccountNumber'] = $object->getAccountNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('phone') && null !== $data->getPhone()) { + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); + } + if ($data->isInitialized('option') && null !== $data->getOption()) { + $dataArray['Option'] = $data->getOption(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ContactsSoldTo::class => false]; + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); } + if ($data->isInitialized('accountNumber') && null !== $data->getAccountNumber()) { + $dataArray['AccountNumber'] = $data->getAccountNumber(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ContactsSoldTo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ContactsUltimateConsigneeNormalizer.php b/src/Api/Normalizer/ContactsUltimateConsigneeNormalizer.php index 0fabd670..1fc79972 100644 --- a/src/Api/Normalizer/ContactsUltimateConsigneeNormalizer.php +++ b/src/Api/Normalizer/ContactsUltimateConsigneeNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ContactsUltimateConsigneeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ContactsUltimateConsigneeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class; + return $type === \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ContactsUltimateConsignee(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('UltimateConsigneeType', $data)) { - $object->setUltimateConsigneeType($this->denormalizer->denormalize($data['UltimateConsigneeType'], \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class, 'json', $context)); - unset($data['UltimateConsigneeType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ContactsUltimateConsignee(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CompanyName'] = $object->getCompanyName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('ultimateConsigneeType') && null !== $object->getUltimateConsigneeType()) { - $data['UltimateConsigneeType'] = $this->normalizer->normalize($object->getUltimateConsigneeType(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class => false]; + if (\array_key_exists('CompanyName', $data)) { + $object->setCompanyName($data['CompanyName']); + unset($data['CompanyName']); } - } -} else { - class ContactsUltimateConsigneeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class, 'json', $context)); + unset($data['Address']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class; + if (\array_key_exists('UltimateConsigneeType', $data)) { + $object->setUltimateConsigneeType($this->denormalizer->denormalize($data['UltimateConsigneeType'], \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class, 'json', $context)); + unset($data['UltimateConsigneeType']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ContactsUltimateConsignee(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('UltimateConsigneeType', $data)) { - $object->setUltimateConsigneeType($this->denormalizer->denormalize($data['UltimateConsigneeType'], \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class, 'json', $context)); - unset($data['UltimateConsigneeType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CompanyName'] = $object->getCompanyName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('ultimateConsigneeType') && null !== $object->getUltimateConsigneeType()) { - $data['UltimateConsigneeType'] = $this->normalizer->normalize($object->getUltimateConsigneeType(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CompanyName'] = $data->getCompanyName(); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + if ($data->isInitialized('ultimateConsigneeType') && null !== $data->getUltimateConsigneeType()) { + $dataArray['UltimateConsigneeType'] = $this->normalizer->normalize($data->getUltimateConsigneeType(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ControlLogReceiptImageFormatNormalizer.php b/src/Api/Normalizer/ControlLogReceiptImageFormatNormalizer.php index bddeb52e..8fafc905 100644 --- a/src/Api/Normalizer/ControlLogReceiptImageFormatNormalizer.php +++ b/src/Api/Normalizer/ControlLogReceiptImageFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ControlLogReceiptImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ControlLogReceiptImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ControlLogReceiptImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/CreditCardAddressNormalizer.php b/src/Api/Normalizer/CreditCardAddressNormalizer.php index 335675d8..b8af1322 100644 --- a/src/Api/Normalizer/CreditCardAddressNormalizer.php +++ b/src/Api/Normalizer/CreditCardAddressNormalizer.php @@ -5,190 +5,94 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CreditCardAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CreditCardAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CreditCardAddress::class; + return $type === \ShipStream\Ups\Api\Model\CreditCardAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CreditCardAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CreditCardAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CreditCardAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\CreditCardAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CreditCardAddress::class => false]; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class CreditCardAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\CreditCardAddress::class; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\CreditCardAddress::class; + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\CreditCardAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\CreditCardAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\CreditCardAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DANGEROUSGOODSUTILITYAPCRequestWrapperNormalizer.php b/src/Api/Normalizer/DANGEROUSGOODSUTILITYAPCRequestWrapperNormalizer.php index 593ad9b9..11984463 100644 --- a/src/Api/Normalizer/DANGEROUSGOODSUTILITYAPCRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/DANGEROUSGOODSUTILITYAPCRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DANGEROUSGOODSUTILITYAPCRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DANGEROUSGOODSUTILITYAPCRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AcceptanceAuditPreCheckRequest', $data)) { - $object->setAcceptanceAuditPreCheckRequest($this->denormalizer->denormalize($data['AcceptanceAuditPreCheckRequest'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class, 'json', $context)); - unset($data['AcceptanceAuditPreCheckRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AcceptanceAuditPreCheckRequest'] = $this->normalizer->normalize($object->getAcceptanceAuditPreCheckRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AcceptanceAuditPreCheckRequest', $data)) { + $object->setAcceptanceAuditPreCheckRequest($this->denormalizer->denormalize($data['AcceptanceAuditPreCheckRequest'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class, 'json', $context)); + unset($data['AcceptanceAuditPreCheckRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DANGEROUSGOODSUTILITYAPCRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['AcceptanceAuditPreCheckRequest'] = $this->normalizer->normalize($data->getAcceptanceAuditPreCheckRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('AcceptanceAuditPreCheckRequest', $data)) { - $object->setAcceptanceAuditPreCheckRequest($this->denormalizer->denormalize($data['AcceptanceAuditPreCheckRequest'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class, 'json', $context)); - unset($data['AcceptanceAuditPreCheckRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AcceptanceAuditPreCheckRequest'] = $this->normalizer->normalize($object->getAcceptanceAuditPreCheckRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DANGEROUSGOODSUTILITYAPCResponseWrapperNormalizer.php b/src/Api/Normalizer/DANGEROUSGOODSUTILITYAPCResponseWrapperNormalizer.php index c815c33e..e4f8e605 100644 --- a/src/Api/Normalizer/DANGEROUSGOODSUTILITYAPCResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/DANGEROUSGOODSUTILITYAPCResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DANGEROUSGOODSUTILITYAPCResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DANGEROUSGOODSUTILITYAPCResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AcceptanceAuditPreCheckResponse', $data)) { - $object->setAcceptanceAuditPreCheckResponse($this->denormalizer->denormalize($data['AcceptanceAuditPreCheckResponse'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class, 'json', $context)); - unset($data['AcceptanceAuditPreCheckResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AcceptanceAuditPreCheckResponse'] = $this->normalizer->normalize($object->getAcceptanceAuditPreCheckResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AcceptanceAuditPreCheckResponse', $data)) { + $object->setAcceptanceAuditPreCheckResponse($this->denormalizer->denormalize($data['AcceptanceAuditPreCheckResponse'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class, 'json', $context)); + unset($data['AcceptanceAuditPreCheckResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DANGEROUSGOODSUTILITYAPCResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['AcceptanceAuditPreCheckResponse'] = $this->normalizer->normalize($data->getAcceptanceAuditPreCheckResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('AcceptanceAuditPreCheckResponse', $data)) { - $object->setAcceptanceAuditPreCheckResponse($this->denormalizer->denormalize($data['AcceptanceAuditPreCheckResponse'], \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class, 'json', $context)); - unset($data['AcceptanceAuditPreCheckResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AcceptanceAuditPreCheckResponse'] = $this->normalizer->normalize($object->getAcceptanceAuditPreCheckResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DANGEROUSGOODSUTILITYRequestWrapperNormalizer.php b/src/Api/Normalizer/DANGEROUSGOODSUTILITYRequestWrapperNormalizer.php index 3c74af3c..460e6445 100644 --- a/src/Api/Normalizer/DANGEROUSGOODSUTILITYRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/DANGEROUSGOODSUTILITYRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DANGEROUSGOODSUTILITYRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DANGEROUSGOODSUTILITYRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ChemicalReferenceDataRequest', $data)) { - $object->setChemicalReferenceDataRequest($this->denormalizer->denormalize($data['ChemicalReferenceDataRequest'], \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class, 'json', $context)); - unset($data['ChemicalReferenceDataRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ChemicalReferenceDataRequest'] = $this->normalizer->normalize($object->getChemicalReferenceDataRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ChemicalReferenceDataRequest', $data)) { + $object->setChemicalReferenceDataRequest($this->denormalizer->denormalize($data['ChemicalReferenceDataRequest'], \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class, 'json', $context)); + unset($data['ChemicalReferenceDataRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DANGEROUSGOODSUTILITYRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['ChemicalReferenceDataRequest'] = $this->normalizer->normalize($data->getChemicalReferenceDataRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('ChemicalReferenceDataRequest', $data)) { - $object->setChemicalReferenceDataRequest($this->denormalizer->denormalize($data['ChemicalReferenceDataRequest'], \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class, 'json', $context)); - unset($data['ChemicalReferenceDataRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ChemicalReferenceDataRequest'] = $this->normalizer->normalize($object->getChemicalReferenceDataRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DANGEROUSGOODSUTILITYResponseWrapperNormalizer.php b/src/Api/Normalizer/DANGEROUSGOODSUTILITYResponseWrapperNormalizer.php index fb911e0c..074c4b8e 100644 --- a/src/Api/Normalizer/DANGEROUSGOODSUTILITYResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/DANGEROUSGOODSUTILITYResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DANGEROUSGOODSUTILITYResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DANGEROUSGOODSUTILITYResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ChemicalReferenceDataResponse', $data)) { - $object->setChemicalReferenceDataResponse($this->denormalizer->denormalize($data['ChemicalReferenceDataResponse'], \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class, 'json', $context)); - unset($data['ChemicalReferenceDataResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ChemicalReferenceDataResponse'] = $this->normalizer->normalize($object->getChemicalReferenceDataResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ChemicalReferenceDataResponse', $data)) { + $object->setChemicalReferenceDataResponse($this->denormalizer->denormalize($data['ChemicalReferenceDataResponse'], \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class, 'json', $context)); + unset($data['ChemicalReferenceDataResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DANGEROUSGOODSUTILITYResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['ChemicalReferenceDataResponse'] = $this->normalizer->normalize($data->getChemicalReferenceDataResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('ChemicalReferenceDataResponse', $data)) { - $object->setChemicalReferenceDataResponse($this->denormalizer->denormalize($data['ChemicalReferenceDataResponse'], \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class, 'json', $context)); - unset($data['ChemicalReferenceDataResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ChemicalReferenceDataResponse'] = $this->normalizer->normalize($object->getChemicalReferenceDataResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DCRAvailabilityUnavailableReasonNormalizer.php b/src/Api/Normalizer/DCRAvailabilityUnavailableReasonNormalizer.php index 1634a3ae..1a589d50 100644 --- a/src/Api/Normalizer/DCRAvailabilityUnavailableReasonNormalizer.php +++ b/src/Api/Normalizer/DCRAvailabilityUnavailableReasonNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DCRAvailabilityUnavailableReasonNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DCRAvailabilityUnavailableReasonNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class; + return $type === \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class => false]; - } - } -} else { - class DCRAvailabilityUnavailableReasonNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DDTCInformationUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/DDTCInformationUnitOfMeasurementNormalizer.php index 67b2c1ad..a571028f 100644 --- a/src/Api/Normalizer/DDTCInformationUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/DDTCInformationUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DDTCInformationUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DDTCInformationUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DDTCInformationUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DangerousGoodsPhoneNormalizer.php b/src/Api/Normalizer/DangerousGoodsPhoneNormalizer.php index 79c53cf2..46d0123e 100644 --- a/src/Api/Normalizer/DangerousGoodsPhoneNormalizer.php +++ b/src/Api/Normalizer/DangerousGoodsPhoneNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DangerousGoodsPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DangerousGoodsPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class; + return $type === \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DangerousGoodsPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DangerousGoodsPhone(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Extension', $data)) { + $object->setExtension($data['Extension']); + unset($data['Extension']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DangerousGoodsPhone::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DangerousGoodsPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class; + $dataArray = []; + $dataArray['Number'] = $data->getNumber(); + if ($data->isInitialized('extension') && null !== $data->getExtension()) { + $dataArray['Extension'] = $data->getExtension(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DangerousGoodsPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DangerousGoodsPhone::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DangerousGoodsPhone::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DangerousGoodsTransportationModeNormalizer.php b/src/Api/Normalizer/DangerousGoodsTransportationModeNormalizer.php index 428d274e..1990c4e4 100644 --- a/src/Api/Normalizer/DangerousGoodsTransportationModeNormalizer.php +++ b/src/Api/Normalizer/DangerousGoodsTransportationModeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DangerousGoodsTransportationModeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DangerousGoodsTransportationModeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class; + return $type === \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DangerousGoodsTransportationModeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeclaredValueTypeNormalizer.php b/src/Api/Normalizer/DeclaredValueTypeNormalizer.php index 3198d1c8..aeb97f92 100644 --- a/src/Api/Normalizer/DeclaredValueTypeNormalizer.php +++ b/src/Api/Normalizer/DeclaredValueTypeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeclaredValueTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeclaredValueTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeclaredValueType::class; + return $type === \ShipStream\Ups\Api\Model\DeclaredValueType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeclaredValueType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeclaredValueType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeclaredValueType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeclaredValueType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeclaredValueType::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DeclaredValueTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeclaredValueType::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeclaredValueType::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeclaredValueType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeclaredValueType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeclaredValueType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeleteRequestNormalizer.php b/src/Api/Normalizer/DeleteRequestNormalizer.php index 41327a8b..7398b375 100644 --- a/src/Api/Normalizer/DeleteRequestNormalizer.php +++ b/src/Api/Normalizer/DeleteRequestNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeleteRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeleteRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeleteRequest::class; + return $type === \ShipStream\Ups\Api\Model\DeleteRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeleteRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeleteRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeleteRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\DeleteRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('DocumentID', $data)) { - $object->setDocumentID($data['DocumentID']); - unset($data['DocumentID']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeleteRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['DocumentID'] = $object->getDocumentID(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\DeleteRequestRequest::class, 'json', $context)); + unset($data['Request']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeleteRequest::class => false]; + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); } - } -} else { - class DeleteRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeleteRequest::class; + if (\array_key_exists('DocumentID', $data)) { + $object->setDocumentID($data['DocumentID']); + unset($data['DocumentID']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeleteRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeleteRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\DeleteRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('DocumentID', $data)) { - $object->setDocumentID($data['DocumentID']); - unset($data['DocumentID']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['DocumentID'] = $object->getDocumentID(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + $dataArray['DocumentID'] = $data->getDocumentID(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeleteRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeleteRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeleteRequestRequestNormalizer.php b/src/Api/Normalizer/DeleteRequestRequestNormalizer.php index 35114fed..710ee8ef 100644 --- a/src/Api/Normalizer/DeleteRequestRequestNormalizer.php +++ b/src/Api/Normalizer/DeleteRequestRequestNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeleteRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeleteRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeleteRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\DeleteRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeleteRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeleteRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeleteRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeleteRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); + } + if (\array_key_exists('SubVersion', $data)) { + $object->setSubVersion($data['SubVersion']); + unset($data['SubVersion']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeleteRequestRequest::class => false]; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class DeleteRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeleteRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('requestOption') && null !== $data->getRequestOption()) { + $dataArray['RequestOption'] = $data->getRequestOption(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeleteRequestRequest::class; + if ($data->isInitialized('subVersion') && null !== $data->getSubVersion()) { + $dataArray['SubVersion'] = $data->getSubVersion(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeleteRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeleteRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeleteRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeleteResponseNormalizer.php b/src/Api/Normalizer/DeleteResponseNormalizer.php index 4bf9db16..7d02ef12 100644 --- a/src/Api/Normalizer/DeleteResponseNormalizer.php +++ b/src/Api/Normalizer/DeleteResponseNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeleteResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeleteResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeleteResponse::class; + return $type === \ShipStream\Ups\Api\Model\DeleteResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeleteResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeleteResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeleteResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\DeleteResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeleteResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\DeleteResponseResponse::class, 'json', $context)); + unset($data['Response']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeleteResponse::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DeleteResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeleteResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeleteResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeleteResponse(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\DeleteResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeleteResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeleteResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeleteResponseResponseNormalizer.php b/src/Api/Normalizer/DeleteResponseResponseNormalizer.php index de8f4620..fe67a2dd 100644 --- a/src/Api/Normalizer/DeleteResponseResponseNormalizer.php +++ b/src/Api/Normalizer/DeleteResponseResponseNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeleteResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeleteResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeleteResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\DeleteResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeleteResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeleteResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeleteResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\DeleteResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); + } + if (\array_key_exists('Alert', $data)) { + $values = []; + foreach ($data['Alert'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); } - return $data; + $object->setAlert($values); + unset($data['Alert']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeleteResponseResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class DeleteResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeleteResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $values = []; + foreach ($data->getAlert() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Alert'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeleteResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeleteResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeleteResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeleteResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeliveryActivityLocationNormalizer.php b/src/Api/Normalizer/DeliveryActivityLocationNormalizer.php index 26f7ec74..938e4878 100644 --- a/src/Api/Normalizer/DeliveryActivityLocationNormalizer.php +++ b/src/Api/Normalizer/DeliveryActivityLocationNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeliveryActivityLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeliveryActivityLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class; + return $type === \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryActivityLocation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressArtifactFormat', $data)) { - $object->setAddressArtifactFormat($this->denormalizer->denormalize($data['AddressArtifactFormat'], \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class, 'json', $context)); - unset($data['AddressArtifactFormat']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeliveryActivityLocation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AddressArtifactFormat'] = $this->normalizer->normalize($object->getAddressArtifactFormat(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressArtifactFormat', $data)) { + $object->setAddressArtifactFormat($this->denormalizer->denormalize($data['AddressArtifactFormat'], \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class, 'json', $context)); + unset($data['AddressArtifactFormat']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryActivityLocation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DeliveryActivityLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryActivityLocation(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['AddressArtifactFormat'] = $this->normalizer->normalize($data->getAddressArtifactFormat(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('AddressArtifactFormat', $data)) { - $object->setAddressArtifactFormat($this->denormalizer->denormalize($data['AddressArtifactFormat'], \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class, 'json', $context)); - unset($data['AddressArtifactFormat']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AddressArtifactFormat'] = $this->normalizer->normalize($object->getAddressArtifactFormat(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryActivityLocation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeliveryActivityLocation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeliveryBillToAccountNormalizer.php b/src/Api/Normalizer/DeliveryBillToAccountNormalizer.php index e5eaba93..b0d9f5cf 100644 --- a/src/Api/Normalizer/DeliveryBillToAccountNormalizer.php +++ b/src/Api/Normalizer/DeliveryBillToAccountNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeliveryBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeliveryBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class; + return $type === \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryBillToAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeliveryBillToAccount(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Option'] = $object->getOption(); - $data['Number'] = $object->getNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryBillToAccount::class => false]; - } - } -} else { - class DeliveryBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class; + if (\array_key_exists('Option', $data)) { + $object->setOption($data['Option']); + unset($data['Option']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryBillToAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Option'] = $object->getOption(); - $data['Number'] = $object->getNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Option'] = $data->getOption(); + $dataArray['Number'] = $data->getNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryBillToAccount::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeliveryBillToAccount::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeliveryCODNormalizer.php b/src/Api/Normalizer/DeliveryCODNormalizer.php index ea97b2ab..793237d8 100644 --- a/src/Api/Normalizer/DeliveryCODNormalizer.php +++ b/src/Api/Normalizer/DeliveryCODNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeliveryCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeliveryCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryCOD::class; + return $type === \ShipStream\Ups\Api\Model\DeliveryCOD::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryCOD::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryCOD::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CODAmount', $data)) { - $object->setCODAmount($this->denormalizer->denormalize($data['CODAmount'], \ShipStream\Ups\Api\Model\CODCODAmount::class, 'json', $context)); - unset($data['CODAmount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeliveryCOD(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('cODAmount') && null !== $object->getCODAmount()) { - $data['CODAmount'] = $this->normalizer->normalize($object->getCODAmount(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CODAmount', $data)) { + $object->setCODAmount($this->denormalizer->denormalize($data['CODAmount'], \ShipStream\Ups\Api\Model\CODCODAmount::class, 'json', $context)); + unset($data['CODAmount']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryCOD::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DeliveryCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryCOD::class; + $dataArray = []; + if ($data->isInitialized('cODAmount') && null !== $data->getCODAmount()) { + $dataArray['CODAmount'] = $this->normalizer->normalize($data->getCODAmount(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryCOD::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CODAmount', $data)) { - $object->setCODAmount($this->denormalizer->denormalize($data['CODAmount'], \ShipStream\Ups\Api\Model\CODCODAmount::class, 'json', $context)); - unset($data['CODAmount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('cODAmount') && null !== $object->getCODAmount()) { - $data['CODAmount'] = $this->normalizer->normalize($object->getCODAmount(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryCOD::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeliveryCOD::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeliveryDateNormalizer.php b/src/Api/Normalizer/DeliveryDateNormalizer.php index a131f7b1..eddb23af 100644 --- a/src/Api/Normalizer/DeliveryDateNormalizer.php +++ b/src/Api/Normalizer/DeliveryDateNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeliveryDateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeliveryDateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryDate::class; + return $type === \ShipStream\Ups\Api\Model\DeliveryDate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryDate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryDate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryDate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('date', $data)) { - $object->setDate($data['date']); - unset($data['date']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeliveryDate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('date') && null !== $object->getDate()) { - $data['date'] = $object->getDate(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('date', $data)) { + $object->setDate($data['date']); + unset($data['date']); + } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryDate::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DeliveryDateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryDate::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryDate::class; + $dataArray = []; + if ($data->isInitialized('date') && null !== $data->getDate()) { + $dataArray['date'] = $data->getDate(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryDate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('date', $data)) { - $object->setDate($data['date']); - unset($data['date']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('type') && null !== $data->getType()) { + $dataArray['type'] = $data->getType(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('date') && null !== $object->getDate()) { - $data['date'] = $object->getDate(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryDate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeliveryDate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeliveryDeliveryLocationNormalizer.php b/src/Api/Normalizer/DeliveryDeliveryLocationNormalizer.php index 9de82b0a..2fb15222 100644 --- a/src/Api/Normalizer/DeliveryDeliveryLocationNormalizer.php +++ b/src/Api/Normalizer/DeliveryDeliveryLocationNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeliveryDeliveryLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeliveryDeliveryLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class; + return $type === \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressArtifactFormat', $data)) { - $object->setAddressArtifactFormat($this->denormalizer->denormalize($data['AddressArtifactFormat'], \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class, 'json', $context)); - unset($data['AddressArtifactFormat']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('SignedForByName', $data)) { - $object->setSignedForByName($data['SignedForByName']); - unset($data['SignedForByName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AddressArtifactFormat'] = $this->normalizer->normalize($object->getAddressArtifactFormat(), 'json', $context); - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('signedForByName') && null !== $object->getSignedForByName()) { - $data['SignedForByName'] = $object->getSignedForByName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressArtifactFormat', $data)) { + $object->setAddressArtifactFormat($this->denormalizer->denormalize($data['AddressArtifactFormat'], \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class, 'json', $context)); + unset($data['AddressArtifactFormat']); + } + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class => false]; + if (\array_key_exists('SignedForByName', $data)) { + $object->setSignedForByName($data['SignedForByName']); + unset($data['SignedForByName']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class DeliveryDeliveryLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class; + $dataArray = []; + $dataArray['AddressArtifactFormat'] = $this->normalizer->normalize($data->getAddressArtifactFormat(), 'json', $context); + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class; + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressArtifactFormat', $data)) { - $object->setAddressArtifactFormat($this->denormalizer->denormalize($data['AddressArtifactFormat'], \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class, 'json', $context)); - unset($data['AddressArtifactFormat']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('SignedForByName', $data)) { - $object->setSignedForByName($data['SignedForByName']); - unset($data['SignedForByName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('signedForByName') && null !== $data->getSignedForByName()) { + $dataArray['SignedForByName'] = $data->getSignedForByName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AddressArtifactFormat'] = $this->normalizer->normalize($object->getAddressArtifactFormat(), 'json', $context); - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('signedForByName') && null !== $object->getSignedForByName()) { - $data['SignedForByName'] = $object->getSignedForByName(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeliveryInformationNormalizer.php b/src/Api/Normalizer/DeliveryInformationNormalizer.php index 25ef2cf2..2c2ec52b 100644 --- a/src/Api/Normalizer/DeliveryInformationNormalizer.php +++ b/src/Api/Normalizer/DeliveryInformationNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeliveryInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeliveryInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryInformation::class; + return $type === \ShipStream\Ups\Api\Model\DeliveryInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('location', $data)) { - $object->setLocation($data['location']); - unset($data['location']); - } - if (\array_key_exists('receivedBy', $data)) { - $object->setReceivedBy($data['receivedBy']); - unset($data['receivedBy']); - } - if (\array_key_exists('signature', $data)) { - $object->setSignature($this->denormalizer->denormalize($data['signature'], \ShipStream\Ups\Api\Model\Signature::class, 'json', $context)); - unset($data['signature']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeliveryInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('location') && null !== $object->getLocation()) { - $data['location'] = $object->getLocation(); - } - if ($object->isInitialized('receivedBy') && null !== $object->getReceivedBy()) { - $data['receivedBy'] = $object->getReceivedBy(); - } - if ($object->isInitialized('signature') && null !== $object->getSignature()) { - $data['signature'] = $this->normalizer->normalize($object->getSignature(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('location', $data)) { + $object->setLocation($data['location']); + unset($data['location']); + } + if (\array_key_exists('receivedBy', $data)) { + $object->setReceivedBy($data['receivedBy']); + unset($data['receivedBy']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryInformation::class => false]; + if (\array_key_exists('signature', $data)) { + $object->setSignature($this->denormalizer->denormalize($data['signature'], \ShipStream\Ups\Api\Model\Signature::class, 'json', $context)); + unset($data['signature']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class DeliveryInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryInformation::class; + $dataArray = []; + if ($data->isInitialized('location') && null !== $data->getLocation()) { + $dataArray['location'] = $data->getLocation(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryInformation::class; + if ($data->isInitialized('receivedBy') && null !== $data->getReceivedBy()) { + $dataArray['receivedBy'] = $data->getReceivedBy(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('location', $data)) { - $object->setLocation($data['location']); - unset($data['location']); - } - if (\array_key_exists('receivedBy', $data)) { - $object->setReceivedBy($data['receivedBy']); - unset($data['receivedBy']); - } - if (\array_key_exists('signature', $data)) { - $object->setSignature($this->denormalizer->denormalize($data['signature'], \ShipStream\Ups\Api\Model\Signature::class, 'json', $context)); - unset($data['signature']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('signature') && null !== $data->getSignature()) { + $dataArray['signature'] = $this->normalizer->normalize($data->getSignature(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('location') && null !== $object->getLocation()) { - $data['location'] = $object->getLocation(); - } - if ($object->isInitialized('receivedBy') && null !== $object->getReceivedBy()) { - $data['receivedBy'] = $object->getReceivedBy(); - } - if ($object->isInitialized('signature') && null !== $object->getSignature()) { - $data['signature'] = $this->normalizer->normalize($object->getSignature(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeliveryInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeliveryLocationAddressArtifactFormatNormalizer.php b/src/Api/Normalizer/DeliveryLocationAddressArtifactFormatNormalizer.php index b0bcf832..a7cbd473 100644 --- a/src/Api/Normalizer/DeliveryLocationAddressArtifactFormatNormalizer.php +++ b/src/Api/Normalizer/DeliveryLocationAddressArtifactFormatNormalizer.php @@ -5,338 +5,168 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeliveryLocationAddressArtifactFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeliveryLocationAddressArtifactFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('StreetNumberLow', $data)) { - $object->setStreetNumberLow($data['StreetNumberLow']); - unset($data['StreetNumberLow']); - } - if (\array_key_exists('StreetPrefix', $data)) { - $object->setStreetPrefix($data['StreetPrefix']); - unset($data['StreetPrefix']); - } - if (\array_key_exists('StreetName', $data)) { - $object->setStreetName($data['StreetName']); - unset($data['StreetName']); - } - if (\array_key_exists('StreetType', $data)) { - $object->setStreetType($data['StreetType']); - unset($data['StreetType']); - } - if (\array_key_exists('StreetSuffix', $data)) { - $object->setStreetSuffix($data['StreetSuffix']); - unset($data['StreetSuffix']); - } - if (\array_key_exists('BuildingName', $data)) { - $object->setBuildingName($data['BuildingName']); - unset($data['BuildingName']); - } - if (\array_key_exists('AddressExtendedInformation', $data)) { - $values = []; - foreach ($data['AddressExtendedInformation'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class, 'json', $context); - } - $object->setAddressExtendedInformation($values); - unset($data['AddressExtendedInformation']); - } - if (\array_key_exists('PoliticalDivision3', $data)) { - $object->setPoliticalDivision3($data['PoliticalDivision3']); - unset($data['PoliticalDivision3']); - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - if (\array_key_exists('PostcodeExtendedLow', $data)) { - $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); - unset($data['PostcodeExtendedLow']); - } - if (\array_key_exists('ResidentialAddressIndicator', $data)) { - $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); - unset($data['ResidentialAddressIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - if ($object->isInitialized('streetNumberLow') && null !== $object->getStreetNumberLow()) { - $data['StreetNumberLow'] = $object->getStreetNumberLow(); - } - if ($object->isInitialized('streetPrefix') && null !== $object->getStreetPrefix()) { - $data['StreetPrefix'] = $object->getStreetPrefix(); - } - if ($object->isInitialized('streetName') && null !== $object->getStreetName()) { - $data['StreetName'] = $object->getStreetName(); - } - if ($object->isInitialized('streetType') && null !== $object->getStreetType()) { - $data['StreetType'] = $object->getStreetType(); - } - if ($object->isInitialized('streetSuffix') && null !== $object->getStreetSuffix()) { - $data['StreetSuffix'] = $object->getStreetSuffix(); - } - if ($object->isInitialized('buildingName') && null !== $object->getBuildingName()) { - $data['BuildingName'] = $object->getBuildingName(); - } - if ($object->isInitialized('addressExtendedInformation') && null !== $object->getAddressExtendedInformation()) { - $values = []; - foreach ($object->getAddressExtendedInformation() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['AddressExtendedInformation'] = $values; - } - if ($object->isInitialized('politicalDivision3') && null !== $object->getPoliticalDivision3()) { - $data['PoliticalDivision3'] = $object->getPoliticalDivision3(); - } - if ($object->isInitialized('politicalDivision2') && null !== $object->getPoliticalDivision2()) { - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - } - if ($object->isInitialized('politicalDivision1') && null !== $object->getPoliticalDivision1()) { - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); - } - if ($object->isInitialized('postcodePrimaryLow') && null !== $object->getPostcodePrimaryLow()) { - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - } - if ($object->isInitialized('postcodeExtendedLow') && null !== $object->getPostcodeExtendedLow()) { - $data['PostcodeExtendedLow'] = $object->getPostcodeExtendedLow(); - } - $data['ResidentialAddressIndicator'] = $object->getResidentialAddressIndicator(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ConsigneeName', $data)) { + $object->setConsigneeName($data['ConsigneeName']); + unset($data['ConsigneeName']); + } + if (\array_key_exists('StreetNumberLow', $data)) { + $object->setStreetNumberLow($data['StreetNumberLow']); + unset($data['StreetNumberLow']); + } + if (\array_key_exists('StreetPrefix', $data)) { + $object->setStreetPrefix($data['StreetPrefix']); + unset($data['StreetPrefix']); + } + if (\array_key_exists('StreetName', $data)) { + $object->setStreetName($data['StreetName']); + unset($data['StreetName']); + } + if (\array_key_exists('StreetType', $data)) { + $object->setStreetType($data['StreetType']); + unset($data['StreetType']); + } + if (\array_key_exists('StreetSuffix', $data)) { + $object->setStreetSuffix($data['StreetSuffix']); + unset($data['StreetSuffix']); + } + if (\array_key_exists('BuildingName', $data)) { + $object->setBuildingName($data['BuildingName']); + unset($data['BuildingName']); + } + if (\array_key_exists('AddressExtendedInformation', $data)) { + $values = []; + foreach ($data['AddressExtendedInformation'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class, 'json', $context); } - return $data; + $object->setAddressExtendedInformation($values); + unset($data['AddressExtendedInformation']); + } + if (\array_key_exists('PoliticalDivision3', $data)) { + $object->setPoliticalDivision3($data['PoliticalDivision3']); + unset($data['PoliticalDivision3']); + } + if (\array_key_exists('PoliticalDivision2', $data)) { + $object->setPoliticalDivision2($data['PoliticalDivision2']); + unset($data['PoliticalDivision2']); + } + if (\array_key_exists('PoliticalDivision1', $data)) { + $object->setPoliticalDivision1($data['PoliticalDivision1']); + unset($data['PoliticalDivision1']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + if (\array_key_exists('PostcodePrimaryLow', $data)) { + $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); + unset($data['PostcodePrimaryLow']); + } + if (\array_key_exists('PostcodeExtendedLow', $data)) { + $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); + unset($data['PostcodeExtendedLow']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class => false]; + if (\array_key_exists('ResidentialAddressIndicator', $data)) { + $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); + unset($data['ResidentialAddressIndicator']); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class DeliveryLocationAddressArtifactFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('StreetNumberLow', $data)) { - $object->setStreetNumberLow($data['StreetNumberLow']); - unset($data['StreetNumberLow']); - } - if (\array_key_exists('StreetPrefix', $data)) { - $object->setStreetPrefix($data['StreetPrefix']); - unset($data['StreetPrefix']); - } - if (\array_key_exists('StreetName', $data)) { - $object->setStreetName($data['StreetName']); - unset($data['StreetName']); - } - if (\array_key_exists('StreetType', $data)) { - $object->setStreetType($data['StreetType']); - unset($data['StreetType']); - } - if (\array_key_exists('StreetSuffix', $data)) { - $object->setStreetSuffix($data['StreetSuffix']); - unset($data['StreetSuffix']); - } - if (\array_key_exists('BuildingName', $data)) { - $object->setBuildingName($data['BuildingName']); - unset($data['BuildingName']); - } - if (\array_key_exists('AddressExtendedInformation', $data)) { - $values = []; - foreach ($data['AddressExtendedInformation'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class, 'json', $context); - } - $object->setAddressExtendedInformation($values); - unset($data['AddressExtendedInformation']); - } - if (\array_key_exists('PoliticalDivision3', $data)) { - $object->setPoliticalDivision3($data['PoliticalDivision3']); - unset($data['PoliticalDivision3']); - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - if (\array_key_exists('PostcodeExtendedLow', $data)) { - $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); - unset($data['PostcodeExtendedLow']); - } - if (\array_key_exists('ResidentialAddressIndicator', $data)) { - $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); - unset($data['ResidentialAddressIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('consigneeName') && null !== $data->getConsigneeName()) { + $dataArray['ConsigneeName'] = $data->getConsigneeName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - if ($object->isInitialized('streetNumberLow') && null !== $object->getStreetNumberLow()) { - $data['StreetNumberLow'] = $object->getStreetNumberLow(); - } - if ($object->isInitialized('streetPrefix') && null !== $object->getStreetPrefix()) { - $data['StreetPrefix'] = $object->getStreetPrefix(); - } - if ($object->isInitialized('streetName') && null !== $object->getStreetName()) { - $data['StreetName'] = $object->getStreetName(); - } - if ($object->isInitialized('streetType') && null !== $object->getStreetType()) { - $data['StreetType'] = $object->getStreetType(); - } - if ($object->isInitialized('streetSuffix') && null !== $object->getStreetSuffix()) { - $data['StreetSuffix'] = $object->getStreetSuffix(); - } - if ($object->isInitialized('buildingName') && null !== $object->getBuildingName()) { - $data['BuildingName'] = $object->getBuildingName(); - } - if ($object->isInitialized('addressExtendedInformation') && null !== $object->getAddressExtendedInformation()) { - $values = []; - foreach ($object->getAddressExtendedInformation() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['AddressExtendedInformation'] = $values; - } - if ($object->isInitialized('politicalDivision3') && null !== $object->getPoliticalDivision3()) { - $data['PoliticalDivision3'] = $object->getPoliticalDivision3(); - } - if ($object->isInitialized('politicalDivision2') && null !== $object->getPoliticalDivision2()) { - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - } - if ($object->isInitialized('politicalDivision1') && null !== $object->getPoliticalDivision1()) { - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); - } - if ($object->isInitialized('postcodePrimaryLow') && null !== $object->getPostcodePrimaryLow()) { - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - } - if ($object->isInitialized('postcodeExtendedLow') && null !== $object->getPostcodeExtendedLow()) { - $data['PostcodeExtendedLow'] = $object->getPostcodeExtendedLow(); - } - $data['ResidentialAddressIndicator'] = $object->getResidentialAddressIndicator(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if ($data->isInitialized('streetNumberLow') && null !== $data->getStreetNumberLow()) { + $dataArray['StreetNumberLow'] = $data->getStreetNumberLow(); + } + if ($data->isInitialized('streetPrefix') && null !== $data->getStreetPrefix()) { + $dataArray['StreetPrefix'] = $data->getStreetPrefix(); + } + if ($data->isInitialized('streetName') && null !== $data->getStreetName()) { + $dataArray['StreetName'] = $data->getStreetName(); + } + if ($data->isInitialized('streetType') && null !== $data->getStreetType()) { + $dataArray['StreetType'] = $data->getStreetType(); + } + if ($data->isInitialized('streetSuffix') && null !== $data->getStreetSuffix()) { + $dataArray['StreetSuffix'] = $data->getStreetSuffix(); + } + if ($data->isInitialized('buildingName') && null !== $data->getBuildingName()) { + $dataArray['BuildingName'] = $data->getBuildingName(); + } + if ($data->isInitialized('addressExtendedInformation') && null !== $data->getAddressExtendedInformation()) { + $values = []; + foreach ($data->getAddressExtendedInformation() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $data; + $dataArray['AddressExtendedInformation'] = $values; + } + if ($data->isInitialized('politicalDivision3') && null !== $data->getPoliticalDivision3()) { + $dataArray['PoliticalDivision3'] = $data->getPoliticalDivision3(); + } + if ($data->isInitialized('politicalDivision2') && null !== $data->getPoliticalDivision2()) { + $dataArray['PoliticalDivision2'] = $data->getPoliticalDivision2(); + } + if ($data->isInitialized('politicalDivision1') && null !== $data->getPoliticalDivision1()) { + $dataArray['PoliticalDivision1'] = $data->getPoliticalDivision1(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class => false]; + if ($data->isInitialized('countryCode') && null !== $data->getCountryCode()) { + $dataArray['CountryCode'] = $data->getCountryCode(); } + if ($data->isInitialized('postcodePrimaryLow') && null !== $data->getPostcodePrimaryLow()) { + $dataArray['PostcodePrimaryLow'] = $data->getPostcodePrimaryLow(); + } + if ($data->isInitialized('postcodeExtendedLow') && null !== $data->getPostcodeExtendedLow()) { + $dataArray['PostcodeExtendedLow'] = $data->getPostcodeExtendedLow(); + } + $dataArray['ResidentialAddressIndicator'] = $data->getResidentialAddressIndicator(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeliveryPackageReferenceNumberNormalizer.php b/src/Api/Normalizer/DeliveryPackageReferenceNumberNormalizer.php index f3005bdd..ceb48b63 100644 --- a/src/Api/Normalizer/DeliveryPackageReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/DeliveryPackageReferenceNumberNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeliveryPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeliveryPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('BarCodeIndicator', $data)) { + $object->setBarCodeIndicator($data['BarCodeIndicator']); + unset($data['BarCodeIndicator']); + } + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class => false]; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class DeliveryPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class; + $dataArray = []; + if ($data->isInitialized('barCodeIndicator') && null !== $data->getBarCodeIndicator()) { + $dataArray['BarCodeIndicator'] = $data->getBarCodeIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeliveryShipmentReferenceNumberNormalizer.php b/src/Api/Normalizer/DeliveryShipmentReferenceNumberNormalizer.php index feca91f4..57428c9a 100644 --- a/src/Api/Normalizer/DeliveryShipmentReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/DeliveryShipmentReferenceNumberNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeliveryShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeliveryShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('BarCodeIndicator', $data)) { + $object->setBarCodeIndicator($data['BarCodeIndicator']); + unset($data['BarCodeIndicator']); + } + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class => false]; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class DeliveryShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class; + $dataArray = []; + if ($data->isInitialized('barCodeIndicator') && null !== $data->getBarCodeIndicator()) { + $dataArray['BarCodeIndicator'] = $data->getBarCodeIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeliveryTimeInformationPickupNormalizer.php b/src/Api/Normalizer/DeliveryTimeInformationPickupNormalizer.php index ae9630f1..14e25892 100644 --- a/src/Api/Normalizer/DeliveryTimeInformationPickupNormalizer.php +++ b/src/Api/Normalizer/DeliveryTimeInformationPickupNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeliveryTimeInformationPickupNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeliveryTimeInformationPickupNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class; + return $type === \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Date'] = $object->getDate(); - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['Time'] = $object->getTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Date', $data)) { + $object->setDate($data['Date']); + unset($data['Date']); + } + if (\array_key_exists('Time', $data)) { + $object->setTime($data['Time']); + unset($data['Time']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DeliveryTimeInformationPickupNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class; + $dataArray = []; + $dataArray['Date'] = $data->getDate(); + if ($data->isInitialized('time') && null !== $data->getTime()) { + $dataArray['Time'] = $data->getTime(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Date'] = $object->getDate(); - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['Time'] = $object->getTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeliveryTimeInformationReturnContractServicesNormalizer.php b/src/Api/Normalizer/DeliveryTimeInformationReturnContractServicesNormalizer.php index d8e241b2..63b48ebd 100644 --- a/src/Api/Normalizer/DeliveryTimeInformationReturnContractServicesNormalizer.php +++ b/src/Api/Normalizer/DeliveryTimeInformationReturnContractServicesNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeliveryTimeInformationReturnContractServicesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeliveryTimeInformationReturnContractServicesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class; + return $type === \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DeliveryTimeInformationReturnContractServicesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DeliveryTimeNormalizer.php b/src/Api/Normalizer/DeliveryTimeNormalizer.php index 2cf17a53..745165e1 100644 --- a/src/Api/Normalizer/DeliveryTimeNormalizer.php +++ b/src/Api/Normalizer/DeliveryTimeNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeliveryTimeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeliveryTimeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryTime::class; + return $type === \ShipStream\Ups\Api\Model\DeliveryTime::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryTime::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryTime::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryTime(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('endTime', $data)) { - $object->setEndTime($data['endTime']); - unset($data['endTime']); - } - if (\array_key_exists('startTime', $data)) { - $object->setStartTime($data['startTime']); - unset($data['startTime']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DeliveryTime(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('endTime') && null !== $object->getEndTime()) { - $data['endTime'] = $object->getEndTime(); - } - if ($object->isInitialized('startTime') && null !== $object->getStartTime()) { - $data['startTime'] = $object->getStartTime(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('endTime', $data)) { + $object->setEndTime($data['endTime']); + unset($data['endTime']); + } + if (\array_key_exists('startTime', $data)) { + $object->setStartTime($data['startTime']); + unset($data['startTime']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryTime::class => false]; + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class DeliveryTimeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DeliveryTime::class; + $dataArray = []; + if ($data->isInitialized('endTime') && null !== $data->getEndTime()) { + $dataArray['endTime'] = $data->getEndTime(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DeliveryTime::class; + if ($data->isInitialized('startTime') && null !== $data->getStartTime()) { + $dataArray['startTime'] = $data->getStartTime(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DeliveryTime(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('endTime', $data)) { - $object->setEndTime($data['endTime']); - unset($data['endTime']); - } - if (\array_key_exists('startTime', $data)) { - $object->setStartTime($data['startTime']); - unset($data['startTime']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('type') && null !== $data->getType()) { + $dataArray['type'] = $data->getType(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('endTime') && null !== $object->getEndTime()) { - $data['endTime'] = $object->getEndTime(); - } - if ($object->isInitialized('startTime') && null !== $object->getStartTime()) { - $data['startTime'] = $object->getStartTime(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DeliveryTime::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DeliveryTime::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DestinationNormalizer.php b/src/Api/Normalizer/DestinationNormalizer.php index 3d454619..0ea71234 100644 --- a/src/Api/Normalizer/DestinationNormalizer.php +++ b/src/Api/Normalizer/DestinationNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DestinationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DestinationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Destination::class; + return $type === \ShipStream\Ups\Api\Model\Destination::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Destination::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Destination::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Destination(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('url', $data)) { - $object->setUrl($data['url']); - unset($data['url']); - } - if (\array_key_exists('credentialType', $data)) { - $object->setCredentialType($data['credentialType']); - unset($data['credentialType']); - } - if (\array_key_exists('credential', $data)) { - $object->setCredential($data['credential']); - unset($data['credential']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\Destination(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['url'] = $object->getUrl(); - $data['credentialType'] = $object->getCredentialType(); - $data['credential'] = $object->getCredential(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('url', $data)) { + $object->setUrl($data['url']); + unset($data['url']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Destination::class => false]; + if (\array_key_exists('credentialType', $data)) { + $object->setCredentialType($data['credentialType']); + unset($data['credentialType']); } - } -} else { - class DestinationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Destination::class; + if (\array_key_exists('credential', $data)) { + $object->setCredential($data['credential']); + unset($data['credential']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Destination::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Destination(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('url', $data)) { - $object->setUrl($data['url']); - unset($data['url']); - } - if (\array_key_exists('credentialType', $data)) { - $object->setCredentialType($data['credentialType']); - unset($data['credentialType']); - } - if (\array_key_exists('credential', $data)) { - $object->setCredential($data['credential']); - unset($data['credential']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['url'] = $object->getUrl(); - $data['credentialType'] = $object->getCredentialType(); - $data['credential'] = $object->getCredential(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['url'] = $data->getUrl(); + $dataArray['credentialType'] = $data->getCredentialType(); + $dataArray['credential'] = $data->getCredential(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Destination::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Destination::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DimWeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/DimWeightUnitOfMeasurementNormalizer.php index bb969d9c..920619ed 100644 --- a/src/Api/Normalizer/DimWeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/DimWeightUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DimWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DimWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DimWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DimensionalWeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/DimensionalWeightUnitOfMeasurementNormalizer.php index f6ac1419..3be37e51 100644 --- a/src/Api/Normalizer/DimensionalWeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/DimensionalWeightUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DimensionalWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DimensionalWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DimensionalWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DimensionsUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/DimensionsUnitOfMeasurementNormalizer.php index 08b3c2f3..074e12a4 100644 --- a/src/Api/Normalizer/DimensionsUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/DimensionsUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DimensionsUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DimensionsUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DimensionsUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DistanceUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/DistanceUnitOfMeasurementNormalizer.php index 622b3cd3..956f771d 100644 --- a/src/Api/Normalizer/DistanceUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/DistanceUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DistanceUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DistanceUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DistanceUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DocumentsFormsNormalizer.php b/src/Api/Normalizer/DocumentsFormsNormalizer.php index d5a36656..b9392401 100644 --- a/src/Api/Normalizer/DocumentsFormsNormalizer.php +++ b/src/Api/Normalizer/DocumentsFormsNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DocumentsFormsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DocumentsFormsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DocumentsForms::class; + return $type === \ShipStream\Ups\Api\Model\DocumentsForms::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DocumentsForms::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DocumentsForms::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DocumentsForms(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\FormsType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - if (\array_key_exists('Format', $data)) { - $object->setFormat($this->denormalizer->denormalize($data['Format'], \ShipStream\Ups\Api\Model\FormsFormat::class, 'json', $context)); - unset($data['Format']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DocumentsForms(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - $data['Format'] = $this->normalizer->normalize($object->getFormat(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\FormsType::class, 'json', $context)); + unset($data['Type']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DocumentsForms::class => false]; + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); } - } -} else { - class DocumentsFormsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DocumentsForms::class; + if (\array_key_exists('Format', $data)) { + $object->setFormat($this->denormalizer->denormalize($data['Format'], \ShipStream\Ups\Api\Model\FormsFormat::class, 'json', $context)); + unset($data['Format']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DocumentsForms::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DocumentsForms(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\FormsType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - if (\array_key_exists('Format', $data)) { - $object->setFormat($this->denormalizer->denormalize($data['Format'], \ShipStream\Ups\Api\Model\FormsFormat::class, 'json', $context)); - unset($data['Format']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - $data['Format'] = $this->normalizer->normalize($object->getFormat(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + $dataArray['Format'] = $this->normalizer->normalize($data->getFormat(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DocumentsForms::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DocumentsForms::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DocumentsImageNormalizer.php b/src/Api/Normalizer/DocumentsImageNormalizer.php index 6c559492..756a1154 100644 --- a/src/Api/Normalizer/DocumentsImageNormalizer.php +++ b/src/Api/Normalizer/DocumentsImageNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DocumentsImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DocumentsImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DocumentsImage::class; + return $type === \ShipStream\Ups\Api\Model\DocumentsImage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DocumentsImage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DocumentsImage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DocumentsImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\ImageType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - if (\array_key_exists('Format', $data)) { - $object->setFormat($this->denormalizer->denormalize($data['Format'], \ShipStream\Ups\Api\Model\ImageFormat::class, 'json', $context)); - unset($data['Format']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DocumentsImage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - $data['Format'] = $this->normalizer->normalize($object->getFormat(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\ImageType::class, 'json', $context)); + unset($data['Type']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DocumentsImage::class => false]; + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); } - } -} else { - class DocumentsImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DocumentsImage::class; + if (\array_key_exists('Format', $data)) { + $object->setFormat($this->denormalizer->denormalize($data['Format'], \ShipStream\Ups\Api\Model\ImageFormat::class, 'json', $context)); + unset($data['Format']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DocumentsImage::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DocumentsImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\ImageType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - if (\array_key_exists('Format', $data)) { - $object->setFormat($this->denormalizer->denormalize($data['Format'], \ShipStream\Ups\Api\Model\ImageFormat::class, 'json', $context)); - unset($data['Format']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - $data['Format'] = $this->normalizer->normalize($object->getFormat(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + $dataArray['Format'] = $this->normalizer->normalize($data->getFormat(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DocumentsImage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DocumentsImage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DocumentsPackingListNormalizer.php b/src/Api/Normalizer/DocumentsPackingListNormalizer.php index 2e6174f7..d546954d 100644 --- a/src/Api/Normalizer/DocumentsPackingListNormalizer.php +++ b/src/Api/Normalizer/DocumentsPackingListNormalizer.php @@ -5,188 +5,93 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DocumentsPackingListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DocumentsPackingListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DocumentsPackingList::class; + return $type === \ShipStream\Ups\Api\Model\DocumentsPackingList::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DocumentsPackingList::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DocumentsPackingList::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DocumentsPackingList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipFrom', $data)) { - $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\PackingListShipFrom::class, 'json', $context)); - unset($data['ShipFrom']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\PackingListShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('Reference', $data)) { - $values = []; - foreach ($data['Reference'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackingListReference::class, 'json', $context); - } - $object->setReference($values); - unset($data['Reference']); - } - if (\array_key_exists('HandlingUnit', $data)) { - $object->setHandlingUnit($this->denormalizer->denormalize($data['HandlingUnit'], \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class, 'json', $context)); - unset($data['HandlingUnit']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\DocumentsPackingList(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('shipFrom') && null !== $object->getShipFrom()) { - $data['ShipFrom'] = $this->normalizer->normalize($object->getShipFrom(), 'json', $context); - } - if ($object->isInitialized('shipTo') && null !== $object->getShipTo()) { - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - } - if ($object->isInitialized('reference') && null !== $object->getReference()) { - $values = []; - foreach ($object->getReference() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Reference'] = $values; - } - if ($object->isInitialized('handlingUnit') && null !== $object->getHandlingUnit()) { - $data['HandlingUnit'] = $this->normalizer->normalize($object->getHandlingUnit(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ShipFrom', $data)) { + $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\PackingListShipFrom::class, 'json', $context)); + unset($data['ShipFrom']); + } + if (\array_key_exists('ShipTo', $data)) { + $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\PackingListShipTo::class, 'json', $context)); + unset($data['ShipTo']); + } + if (\array_key_exists('Reference', $data)) { + $values = []; + foreach ($data['Reference'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackingListReference::class, 'json', $context); } - return $data; + $object->setReference($values); + unset($data['Reference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DocumentsPackingList::class => false]; + if (\array_key_exists('HandlingUnit', $data)) { + $object->setHandlingUnit($this->denormalizer->denormalize($data['HandlingUnit'], \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class, 'json', $context)); + unset($data['HandlingUnit']); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class DocumentsPackingListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DocumentsPackingList::class; + $dataArray = []; + if ($data->isInitialized('shipFrom') && null !== $data->getShipFrom()) { + $dataArray['ShipFrom'] = $this->normalizer->normalize($data->getShipFrom(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DocumentsPackingList::class; + if ($data->isInitialized('shipTo') && null !== $data->getShipTo()) { + $dataArray['ShipTo'] = $this->normalizer->normalize($data->getShipTo(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DocumentsPackingList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipFrom', $data)) { - $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\PackingListShipFrom::class, 'json', $context)); - unset($data['ShipFrom']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\PackingListShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('Reference', $data)) { - $values = []; - foreach ($data['Reference'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackingListReference::class, 'json', $context); - } - $object->setReference($values); - unset($data['Reference']); - } - if (\array_key_exists('HandlingUnit', $data)) { - $object->setHandlingUnit($this->denormalizer->denormalize($data['HandlingUnit'], \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class, 'json', $context)); - unset($data['HandlingUnit']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + if ($data->isInitialized('reference') && null !== $data->getReference()) { + $values = []; + foreach ($data->getReference() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['Reference'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('shipFrom') && null !== $object->getShipFrom()) { - $data['ShipFrom'] = $this->normalizer->normalize($object->getShipFrom(), 'json', $context); - } - if ($object->isInitialized('shipTo') && null !== $object->getShipTo()) { - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - } - if ($object->isInitialized('reference') && null !== $object->getReference()) { - $values = []; - foreach ($object->getReference() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Reference'] = $values; - } - if ($object->isInitialized('handlingUnit') && null !== $object->getHandlingUnit()) { - $data['HandlingUnit'] = $this->normalizer->normalize($object->getHandlingUnit(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('handlingUnit') && null !== $data->getHandlingUnit()) { + $dataArray['HandlingUnit'] = $this->normalizer->normalize($data->getHandlingUnit(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DocumentsPackingList::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DocumentsPackingList::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationAccessPointInformationNormalizer.php b/src/Api/Normalizer/DropLocationAccessPointInformationNormalizer.php index 5b31a870..cceb1474 100644 --- a/src/Api/Normalizer/DropLocationAccessPointInformationNormalizer.php +++ b/src/Api/Normalizer/DropLocationAccessPointInformationNormalizer.php @@ -5,214 +5,106 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationAccessPointInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationAccessPointInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PublicAccessPointID', $data)) { - $object->setPublicAccessPointID($data['PublicAccessPointID']); - unset($data['PublicAccessPointID']); - } - if (\array_key_exists('ImageURL', $data)) { - $object->setImageURL($data['ImageURL']); - unset($data['ImageURL']); - } - if (\array_key_exists('BusinessClassificationList', $data)) { - $object->setBusinessClassificationList($this->denormalizer->denormalize($data['BusinessClassificationList'], \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class, 'json', $context)); - unset($data['BusinessClassificationList']); - } - if (\array_key_exists('AccessPointStatus', $data)) { - $object->setAccessPointStatus($this->denormalizer->denormalize($data['AccessPointStatus'], \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class, 'json', $context)); - unset($data['AccessPointStatus']); - } - if (\array_key_exists('FacilitySLIC', $data)) { - $object->setFacilitySLIC($data['FacilitySLIC']); - unset($data['FacilitySLIC']); - } - if (\array_key_exists('PrivateNetworkList', $data)) { - $object->setPrivateNetworkList($this->denormalizer->denormalize($data['PrivateNetworkList'], \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class, 'json', $context)); - unset($data['PrivateNetworkList']); - } - if (\array_key_exists('Availability', $data)) { - $object->setAvailability($this->denormalizer->denormalize($data['Availability'], \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class, 'json', $context)); - unset($data['Availability']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('publicAccessPointID') && null !== $object->getPublicAccessPointID()) { - $data['PublicAccessPointID'] = $object->getPublicAccessPointID(); - } - if ($object->isInitialized('imageURL') && null !== $object->getImageURL()) { - $data['ImageURL'] = $object->getImageURL(); - } - if ($object->isInitialized('businessClassificationList') && null !== $object->getBusinessClassificationList()) { - $data['BusinessClassificationList'] = $this->normalizer->normalize($object->getBusinessClassificationList(), 'json', $context); - } - if ($object->isInitialized('accessPointStatus') && null !== $object->getAccessPointStatus()) { - $data['AccessPointStatus'] = $this->normalizer->normalize($object->getAccessPointStatus(), 'json', $context); - } - if ($object->isInitialized('facilitySLIC') && null !== $object->getFacilitySLIC()) { - $data['FacilitySLIC'] = $object->getFacilitySLIC(); - } - if ($object->isInitialized('privateNetworkList') && null !== $object->getPrivateNetworkList()) { - $data['PrivateNetworkList'] = $this->normalizer->normalize($object->getPrivateNetworkList(), 'json', $context); - } - if ($object->isInitialized('availability') && null !== $object->getAvailability()) { - $data['Availability'] = $this->normalizer->normalize($object->getAvailability(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PublicAccessPointID', $data)) { + $object->setPublicAccessPointID($data['PublicAccessPointID']); + unset($data['PublicAccessPointID']); + } + if (\array_key_exists('ImageURL', $data)) { + $object->setImageURL($data['ImageURL']); + unset($data['ImageURL']); + } + if (\array_key_exists('BusinessClassificationList', $data)) { + $object->setBusinessClassificationList($this->denormalizer->denormalize($data['BusinessClassificationList'], \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class, 'json', $context)); + unset($data['BusinessClassificationList']); + } + if (\array_key_exists('AccessPointStatus', $data)) { + $object->setAccessPointStatus($this->denormalizer->denormalize($data['AccessPointStatus'], \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class, 'json', $context)); + unset($data['AccessPointStatus']); + } + if (\array_key_exists('FacilitySLIC', $data)) { + $object->setFacilitySLIC($data['FacilitySLIC']); + unset($data['FacilitySLIC']); + } + if (\array_key_exists('PrivateNetworkList', $data)) { + $object->setPrivateNetworkList($this->denormalizer->denormalize($data['PrivateNetworkList'], \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class, 'json', $context)); + unset($data['PrivateNetworkList']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class => false]; + if (\array_key_exists('Availability', $data)) { + $object->setAvailability($this->denormalizer->denormalize($data['Availability'], \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class, 'json', $context)); + unset($data['Availability']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class DropLocationAccessPointInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PublicAccessPointID', $data)) { - $object->setPublicAccessPointID($data['PublicAccessPointID']); - unset($data['PublicAccessPointID']); - } - if (\array_key_exists('ImageURL', $data)) { - $object->setImageURL($data['ImageURL']); - unset($data['ImageURL']); - } - if (\array_key_exists('BusinessClassificationList', $data)) { - $object->setBusinessClassificationList($this->denormalizer->denormalize($data['BusinessClassificationList'], \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class, 'json', $context)); - unset($data['BusinessClassificationList']); - } - if (\array_key_exists('AccessPointStatus', $data)) { - $object->setAccessPointStatus($this->denormalizer->denormalize($data['AccessPointStatus'], \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class, 'json', $context)); - unset($data['AccessPointStatus']); - } - if (\array_key_exists('FacilitySLIC', $data)) { - $object->setFacilitySLIC($data['FacilitySLIC']); - unset($data['FacilitySLIC']); - } - if (\array_key_exists('PrivateNetworkList', $data)) { - $object->setPrivateNetworkList($this->denormalizer->denormalize($data['PrivateNetworkList'], \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class, 'json', $context)); - unset($data['PrivateNetworkList']); - } - if (\array_key_exists('Availability', $data)) { - $object->setAvailability($this->denormalizer->denormalize($data['Availability'], \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class, 'json', $context)); - unset($data['Availability']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('publicAccessPointID') && null !== $data->getPublicAccessPointID()) { + $dataArray['PublicAccessPointID'] = $data->getPublicAccessPointID(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('publicAccessPointID') && null !== $object->getPublicAccessPointID()) { - $data['PublicAccessPointID'] = $object->getPublicAccessPointID(); - } - if ($object->isInitialized('imageURL') && null !== $object->getImageURL()) { - $data['ImageURL'] = $object->getImageURL(); - } - if ($object->isInitialized('businessClassificationList') && null !== $object->getBusinessClassificationList()) { - $data['BusinessClassificationList'] = $this->normalizer->normalize($object->getBusinessClassificationList(), 'json', $context); - } - if ($object->isInitialized('accessPointStatus') && null !== $object->getAccessPointStatus()) { - $data['AccessPointStatus'] = $this->normalizer->normalize($object->getAccessPointStatus(), 'json', $context); - } - if ($object->isInitialized('facilitySLIC') && null !== $object->getFacilitySLIC()) { - $data['FacilitySLIC'] = $object->getFacilitySLIC(); - } - if ($object->isInitialized('privateNetworkList') && null !== $object->getPrivateNetworkList()) { - $data['PrivateNetworkList'] = $this->normalizer->normalize($object->getPrivateNetworkList(), 'json', $context); - } - if ($object->isInitialized('availability') && null !== $object->getAvailability()) { - $data['Availability'] = $this->normalizer->normalize($object->getAvailability(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('imageURL') && null !== $data->getImageURL()) { + $dataArray['ImageURL'] = $data->getImageURL(); + } + if ($data->isInitialized('businessClassificationList') && null !== $data->getBusinessClassificationList()) { + $dataArray['BusinessClassificationList'] = $this->normalizer->normalize($data->getBusinessClassificationList(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class => false]; + if ($data->isInitialized('accessPointStatus') && null !== $data->getAccessPointStatus()) { + $dataArray['AccessPointStatus'] = $this->normalizer->normalize($data->getAccessPointStatus(), 'json', $context); } + if ($data->isInitialized('facilitySLIC') && null !== $data->getFacilitySLIC()) { + $dataArray['FacilitySLIC'] = $data->getFacilitySLIC(); + } + if ($data->isInitialized('privateNetworkList') && null !== $data->getPrivateNetworkList()) { + $dataArray['PrivateNetworkList'] = $this->normalizer->normalize($data->getPrivateNetworkList(), 'json', $context); + } + if ($data->isInitialized('availability') && null !== $data->getAvailability()) { + $dataArray['Availability'] = $this->normalizer->normalize($data->getAvailability(), 'json', $context); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationAdditionalCommentsNormalizer.php b/src/Api/Normalizer/DropLocationAdditionalCommentsNormalizer.php index a2b9e0f8..867e6185 100644 --- a/src/Api/Normalizer/DropLocationAdditionalCommentsNormalizer.php +++ b/src/Api/Normalizer/DropLocationAdditionalCommentsNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationAdditionalCommentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationAdditionalCommentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class; + return $type === \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationAdditionalComments(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CommentType', $data)) { - $values = []; - foreach ($data['CommentType'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class, 'json', $context); - } - $object->setCommentType($values); - unset($data['CommentType']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\DropLocationAdditionalComments(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('CommentType', $data)) { $values = []; - foreach ($object->getCommentType() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['CommentType'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class, 'json', $context); } - $data['CommentType'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setCommentType($values); + unset($data['CommentType']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class DropLocationAdditionalCommentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class; + $dataArray = []; + $values = []; + foreach ($data->getCommentType() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['CommentType'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationAdditionalComments(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CommentType', $data)) { - $values = []; - foreach ($data['CommentType'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class, 'json', $context); - } - $object->setCommentType($values); - unset($data['CommentType']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getCommentType() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['CommentType'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationAddressKeyFormatNormalizer.php b/src/Api/Normalizer/DropLocationAddressKeyFormatNormalizer.php index f1c8e84e..fdec164b 100644 --- a/src/Api/Normalizer/DropLocationAddressKeyFormatNormalizer.php +++ b/src/Api/Normalizer/DropLocationAddressKeyFormatNormalizer.php @@ -5,208 +5,103 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('PoliticalDivision3', $data)) { - $object->setPoliticalDivision3($data['PoliticalDivision3']); - unset($data['PoliticalDivision3']); - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - if (\array_key_exists('PostcodeExtendedLow', $data)) { - $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); - unset($data['PostcodeExtendedLow']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - $data['AddressLine'] = $object->getAddressLine(); - if ($object->isInitialized('politicalDivision3') && null !== $object->getPoliticalDivision3()) { - $data['PoliticalDivision3'] = $object->getPoliticalDivision3(); - } - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - if ($object->isInitialized('postcodeExtendedLow') && null !== $object->getPostcodeExtendedLow()) { - $data['PostcodeExtendedLow'] = $object->getPostcodeExtendedLow(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ConsigneeName', $data)) { + $object->setConsigneeName($data['ConsigneeName']); + unset($data['ConsigneeName']); + } + if (\array_key_exists('AddressLine', $data)) { + $object->setAddressLine($data['AddressLine']); + unset($data['AddressLine']); + } + if (\array_key_exists('PoliticalDivision3', $data)) { + $object->setPoliticalDivision3($data['PoliticalDivision3']); + unset($data['PoliticalDivision3']); + } + if (\array_key_exists('PoliticalDivision2', $data)) { + $object->setPoliticalDivision2($data['PoliticalDivision2']); + unset($data['PoliticalDivision2']); + } + if (\array_key_exists('PoliticalDivision1', $data)) { + $object->setPoliticalDivision1($data['PoliticalDivision1']); + unset($data['PoliticalDivision1']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class => false]; + if (\array_key_exists('PostcodePrimaryLow', $data)) { + $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); + unset($data['PostcodePrimaryLow']); } + if (\array_key_exists('PostcodeExtendedLow', $data)) { + $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); + unset($data['PostcodeExtendedLow']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class DropLocationAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('PoliticalDivision3', $data)) { - $object->setPoliticalDivision3($data['PoliticalDivision3']); - unset($data['PoliticalDivision3']); - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - if (\array_key_exists('PostcodeExtendedLow', $data)) { - $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); - unset($data['PostcodeExtendedLow']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('consigneeName') && null !== $data->getConsigneeName()) { + $dataArray['ConsigneeName'] = $data->getConsigneeName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - $data['AddressLine'] = $object->getAddressLine(); - if ($object->isInitialized('politicalDivision3') && null !== $object->getPoliticalDivision3()) { - $data['PoliticalDivision3'] = $object->getPoliticalDivision3(); - } - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - if ($object->isInitialized('postcodeExtendedLow') && null !== $object->getPostcodeExtendedLow()) { - $data['PostcodeExtendedLow'] = $object->getPostcodeExtendedLow(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + $dataArray['AddressLine'] = $data->getAddressLine(); + if ($data->isInitialized('politicalDivision3') && null !== $data->getPoliticalDivision3()) { + $dataArray['PoliticalDivision3'] = $data->getPoliticalDivision3(); + } + $dataArray['PoliticalDivision2'] = $data->getPoliticalDivision2(); + $dataArray['PoliticalDivision1'] = $data->getPoliticalDivision1(); + $dataArray['PostcodePrimaryLow'] = $data->getPostcodePrimaryLow(); + if ($data->isInitialized('postcodeExtendedLow') && null !== $data->getPostcodeExtendedLow()) { + $dataArray['PostcodeExtendedLow'] = $data->getPostcodeExtendedLow(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationDistanceNormalizer.php b/src/Api/Normalizer/DropLocationDistanceNormalizer.php index 3de0c1ec..8146f4d1 100644 --- a/src/Api/Normalizer/DropLocationDistanceNormalizer.php +++ b/src/Api/Normalizer/DropLocationDistanceNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationDistanceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationDistanceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationDistance::class; + return $type === \ShipStream\Ups\Api\Model\DropLocationDistance::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationDistance::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationDistance::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationDistance(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DropLocationDistance(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationDistance::class => false]; - } - } -} else { - class DropLocationDistanceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationDistance::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationDistance::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationDistance(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Value'] = $data->getValue(); + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationDistance::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationDistance::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationGeocodeNormalizer.php b/src/Api/Normalizer/DropLocationGeocodeNormalizer.php index d6326e0c..84ac63bd 100644 --- a/src/Api/Normalizer/DropLocationGeocodeNormalizer.php +++ b/src/Api/Normalizer/DropLocationGeocodeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationGeocodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationGeocodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationGeocode::class; + return $type === \ShipStream\Ups\Api\Model\DropLocationGeocode::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationGeocode::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationGeocode::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationGeocode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Latitude', $data)) { - $object->setLatitude($data['Latitude']); - unset($data['Latitude']); - } - if (\array_key_exists('Longitude', $data)) { - $object->setLongitude($data['Longitude']); - unset($data['Longitude']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DropLocationGeocode(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Latitude'] = $object->getLatitude(); - $data['Longitude'] = $object->getLongitude(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationGeocode::class => false]; - } - } -} else { - class DropLocationGeocodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationGeocode::class; + if (\array_key_exists('Latitude', $data)) { + $object->setLatitude($data['Latitude']); + unset($data['Latitude']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationGeocode::class; + if (\array_key_exists('Longitude', $data)) { + $object->setLongitude($data['Longitude']); + unset($data['Longitude']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationGeocode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Latitude', $data)) { - $object->setLatitude($data['Latitude']); - unset($data['Latitude']); - } - if (\array_key_exists('Longitude', $data)) { - $object->setLongitude($data['Longitude']); - unset($data['Longitude']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Latitude'] = $object->getLatitude(); - $data['Longitude'] = $object->getLongitude(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Latitude'] = $data->getLatitude(); + $dataArray['Longitude'] = $data->getLongitude(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationGeocode::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationGeocode::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationIVRNormalizer.php b/src/Api/Normalizer/DropLocationIVRNormalizer.php index 91a52aec..9e063584 100644 --- a/src/Api/Normalizer/DropLocationIVRNormalizer.php +++ b/src/Api/Normalizer/DropLocationIVRNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationIVRNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationIVRNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationIVR::class; + return $type === \ShipStream\Ups\Api\Model\DropLocationIVR::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationIVR::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationIVR::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationIVR(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PhraseID', $data)) { - $object->setPhraseID($data['PhraseID']); - unset($data['PhraseID']); - } - if (\array_key_exists('TextToSpeechIndicator', $data)) { - $object->setTextToSpeechIndicator($data['TextToSpeechIndicator']); - unset($data['TextToSpeechIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DropLocationIVR(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PhraseID'] = $object->getPhraseID(); - if ($object->isInitialized('textToSpeechIndicator') && null !== $object->getTextToSpeechIndicator()) { - $data['TextToSpeechIndicator'] = $object->getTextToSpeechIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PhraseID', $data)) { + $object->setPhraseID($data['PhraseID']); + unset($data['PhraseID']); + } + if (\array_key_exists('TextToSpeechIndicator', $data)) { + $object->setTextToSpeechIndicator($data['TextToSpeechIndicator']); + unset($data['TextToSpeechIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationIVR::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DropLocationIVRNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationIVR::class; + $dataArray = []; + $dataArray['PhraseID'] = $data->getPhraseID(); + if ($data->isInitialized('textToSpeechIndicator') && null !== $data->getTextToSpeechIndicator()) { + $dataArray['TextToSpeechIndicator'] = $data->getTextToSpeechIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationIVR::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationIVR(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PhraseID', $data)) { - $object->setPhraseID($data['PhraseID']); - unset($data['PhraseID']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('TextToSpeechIndicator', $data)) { - $object->setTextToSpeechIndicator($data['TextToSpeechIndicator']); - unset($data['TextToSpeechIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PhraseID'] = $object->getPhraseID(); - if ($object->isInitialized('textToSpeechIndicator') && null !== $object->getTextToSpeechIndicator()) { - $data['TextToSpeechIndicator'] = $object->getTextToSpeechIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationIVR::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationIVR::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationLocalizedInstructionNormalizer.php b/src/Api/Normalizer/DropLocationLocalizedInstructionNormalizer.php index 35984ccc..8846fe1d 100644 --- a/src/Api/Normalizer/DropLocationLocalizedInstructionNormalizer.php +++ b/src/Api/Normalizer/DropLocationLocalizedInstructionNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationLocalizedInstructionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationLocalizedInstructionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class; + return $type === \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - if (\array_key_exists('Last50ftInstruction', $data)) { - $object->setLast50ftInstruction($data['Last50ftInstruction']); - unset($data['Last50ftInstruction']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Locale'] = $object->getLocale(); - $data['Last50ftInstruction'] = $object->getLast50ftInstruction(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class => false]; - } - } -} else { - class DropLocationLocalizedInstructionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class; + if (\array_key_exists('Locale', $data)) { + $object->setLocale($data['Locale']); + unset($data['Locale']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class; + if (\array_key_exists('Last50ftInstruction', $data)) { + $object->setLast50ftInstruction($data['Last50ftInstruction']); + unset($data['Last50ftInstruction']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - if (\array_key_exists('Last50ftInstruction', $data)) { - $object->setLast50ftInstruction($data['Last50ftInstruction']); - unset($data['Last50ftInstruction']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Locale'] = $object->getLocale(); - $data['Last50ftInstruction'] = $object->getLast50ftInstruction(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Locale'] = $data->getLocale(); + $dataArray['Last50ftInstruction'] = $data->getLast50ftInstruction(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationLocationAttributeNormalizer.php b/src/Api/Normalizer/DropLocationLocationAttributeNormalizer.php index a44d840d..8f5e6d87 100644 --- a/src/Api/Normalizer/DropLocationLocationAttributeNormalizer.php +++ b/src/Api/Normalizer/DropLocationLocationAttributeNormalizer.php @@ -5,152 +5,75 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationLocationAttributeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationLocationAttributeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class; + return $type === \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationLocationAttribute(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('OptionType', $data)) { - $object->setOptionType($this->denormalizer->denormalize($data['OptionType'], \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class, 'json', $context)); - unset($data['OptionType']); - } - if (\array_key_exists('OptionCode', $data)) { - $values = []; - foreach ($data['OptionCode'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class, 'json', $context); - } - $object->setOptionCode($values); - unset($data['OptionCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\DropLocationLocationAttribute(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['OptionType'] = $this->normalizer->normalize($object->getOptionType(), 'json', $context); + if (\array_key_exists('OptionType', $data)) { + $object->setOptionType($this->denormalizer->denormalize($data['OptionType'], \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class, 'json', $context)); + unset($data['OptionType']); + } + if (\array_key_exists('OptionCode', $data)) { $values = []; - foreach ($object->getOptionCode() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['OptionCode'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class, 'json', $context); } - $data['OptionCode'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setOptionCode($values); + unset($data['OptionCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class DropLocationLocationAttributeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class; + $dataArray = []; + $dataArray['OptionType'] = $this->normalizer->normalize($data->getOptionType(), 'json', $context); + $values = []; + foreach ($data->getOptionCode() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['OptionCode'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationLocationAttribute(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('OptionType', $data)) { - $object->setOptionType($this->denormalizer->denormalize($data['OptionType'], \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class, 'json', $context)); - unset($data['OptionType']); - } - if (\array_key_exists('OptionCode', $data)) { - $values = []; - foreach ($data['OptionCode'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class, 'json', $context); - } - $object->setOptionCode($values); - unset($data['OptionCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['OptionType'] = $this->normalizer->normalize($object->getOptionType(), 'json', $context); - $values = []; - foreach ($object->getOptionCode() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['OptionCode'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationLocationImageNormalizer.php b/src/Api/Normalizer/DropLocationLocationImageNormalizer.php index 3cdc5f67..4023daa5 100644 --- a/src/Api/Normalizer/DropLocationLocationImageNormalizer.php +++ b/src/Api/Normalizer/DropLocationLocationImageNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationLocationImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationLocationImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationLocationImage::class; + return $type === \ShipStream\Ups\Api\Model\DropLocationLocationImage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationLocationImage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationLocationImage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationLocationImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SecureURL', $data)) { - $object->setSecureURL($data['SecureURL']); - unset($data['SecureURL']); - } - if (\array_key_exists('NonSecureURL', $data)) { - $object->setNonSecureURL($data['NonSecureURL']); - unset($data['NonSecureURL']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DropLocationLocationImage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('secureURL') && null !== $object->getSecureURL()) { - $data['SecureURL'] = $object->getSecureURL(); - } - if ($object->isInitialized('nonSecureURL') && null !== $object->getNonSecureURL()) { - $data['NonSecureURL'] = $object->getNonSecureURL(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('SecureURL', $data)) { + $object->setSecureURL($data['SecureURL']); + unset($data['SecureURL']); + } + if (\array_key_exists('NonSecureURL', $data)) { + $object->setNonSecureURL($data['NonSecureURL']); + unset($data['NonSecureURL']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationLocationImage::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DropLocationLocationImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationLocationImage::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationLocationImage::class; + $dataArray = []; + if ($data->isInitialized('secureURL') && null !== $data->getSecureURL()) { + $dataArray['SecureURL'] = $data->getSecureURL(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationLocationImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SecureURL', $data)) { - $object->setSecureURL($data['SecureURL']); - unset($data['SecureURL']); - } - if (\array_key_exists('NonSecureURL', $data)) { - $object->setNonSecureURL($data['NonSecureURL']); - unset($data['NonSecureURL']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('nonSecureURL') && null !== $data->getNonSecureURL()) { + $dataArray['NonSecureURL'] = $data->getNonSecureURL(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('secureURL') && null !== $object->getSecureURL()) { - $data['SecureURL'] = $object->getSecureURL(); - } - if ($object->isInitialized('nonSecureURL') && null !== $object->getNonSecureURL()) { - $data['NonSecureURL'] = $object->getNonSecureURL(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationLocationImage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationLocationImage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationOperatingHoursNormalizer.php b/src/Api/Normalizer/DropLocationOperatingHoursNormalizer.php index a5369318..ea922edb 100644 --- a/src/Api/Normalizer/DropLocationOperatingHoursNormalizer.php +++ b/src/Api/Normalizer/DropLocationOperatingHoursNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationOperatingHoursNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationOperatingHoursNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class; + return $type === \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationOperatingHours(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('StandardHours', $data)) { - $values = []; - foreach ($data['StandardHours'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class, 'json', $context); - } - $object->setStandardHours($values); - unset($data['StandardHours']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\DropLocationOperatingHours(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('standardHours') && null !== $object->getStandardHours()) { - $values = []; - foreach ($object->getStandardHours() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['StandardHours'] = $values; + if (\array_key_exists('StandardHours', $data)) { + $values = []; + foreach ($data['StandardHours'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class, 'json', $context); } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setStandardHours($values); + unset($data['StandardHours']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationOperatingHours::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class DropLocationOperatingHoursNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationOperatingHours(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('StandardHours', $data)) { - $values = []; - foreach ($data['StandardHours'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class, 'json', $context); - } - $object->setStandardHours($values); - unset($data['StandardHours']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + $dataArray = []; + if ($data->isInitialized('standardHours') && null !== $data->getStandardHours()) { + $values = []; + foreach ($data->getStandardHours() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['StandardHours'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('standardHours') && null !== $object->getStandardHours()) { - $values = []; - foreach ($object->getStandardHours() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['StandardHours'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationOperatingHours::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationOperatingHours::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationPromotionInformationNormalizer.php b/src/Api/Normalizer/DropLocationPromotionInformationNormalizer.php index 2b17b8a8..01870980 100644 --- a/src/Api/Normalizer/DropLocationPromotionInformationNormalizer.php +++ b/src/Api/Normalizer/DropLocationPromotionInformationNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationPromotionInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationPromotionInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class; + return $type === \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationPromotionInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - if (\array_key_exists('Promotion', $data)) { - $object->setPromotion($data['Promotion']); - unset($data['Promotion']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DropLocationPromotionInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Locale'] = $object->getLocale(); - $data['Promotion'] = $object->getPromotion(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class => false]; - } - } -} else { - class DropLocationPromotionInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class; + if (\array_key_exists('Locale', $data)) { + $object->setLocale($data['Locale']); + unset($data['Locale']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class; + if (\array_key_exists('Promotion', $data)) { + $object->setPromotion($data['Promotion']); + unset($data['Promotion']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationPromotionInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - if (\array_key_exists('Promotion', $data)) { - $object->setPromotion($data['Promotion']); - unset($data['Promotion']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Locale'] = $object->getLocale(); - $data['Promotion'] = $object->getPromotion(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Locale'] = $data->getLocale(); + $dataArray['Promotion'] = $data->getPromotion(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationServiceOfferingListNormalizer.php b/src/Api/Normalizer/DropLocationServiceOfferingListNormalizer.php index e90dc3ea..738dcc1d 100644 --- a/src/Api/Normalizer/DropLocationServiceOfferingListNormalizer.php +++ b/src/Api/Normalizer/DropLocationServiceOfferingListNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationServiceOfferingListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationServiceOfferingListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class; + return $type === \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ServiceOffering', $data)) { - $values = []; - foreach ($data['ServiceOffering'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class, 'json', $context); - } - $object->setServiceOffering($values); - unset($data['ServiceOffering']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('ServiceOffering', $data)) { $values = []; - foreach ($object->getServiceOffering() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['ServiceOffering'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class, 'json', $context); } - $data['ServiceOffering'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setServiceOffering($values); + unset($data['ServiceOffering']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class DropLocationServiceOfferingListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class; + $dataArray = []; + $values = []; + foreach ($data->getServiceOffering() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['ServiceOffering'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ServiceOffering', $data)) { - $values = []; - foreach ($data['ServiceOffering'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class, 'json', $context); - } - $object->setServiceOffering($values); - unset($data['ServiceOffering']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getServiceOffering() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ServiceOffering'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationSortCodeNormalizer.php b/src/Api/Normalizer/DropLocationSortCodeNormalizer.php index 322aaa73..9fe5dc6d 100644 --- a/src/Api/Normalizer/DropLocationSortCodeNormalizer.php +++ b/src/Api/Normalizer/DropLocationSortCodeNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationSortCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationSortCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationSortCode::class; + return $type === \ShipStream\Ups\Api\Model\DropLocationSortCode::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationSortCode::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationSortCode::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationSortCode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HubSortCode', $data)) { - $object->setHubSortCode($data['HubSortCode']); - unset($data['HubSortCode']); - } - if (\array_key_exists('FreightSortFacilityCode', $data)) { - $object->setFreightSortFacilityCode($data['FreightSortFacilityCode']); - unset($data['FreightSortFacilityCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DropLocationSortCode(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('hubSortCode') && null !== $object->getHubSortCode()) { - $data['HubSortCode'] = $object->getHubSortCode(); - } - if ($object->isInitialized('freightSortFacilityCode') && null !== $object->getFreightSortFacilityCode()) { - $data['FreightSortFacilityCode'] = $object->getFreightSortFacilityCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('HubSortCode', $data)) { + $object->setHubSortCode($data['HubSortCode']); + unset($data['HubSortCode']); + } + if (\array_key_exists('FreightSortFacilityCode', $data)) { + $object->setFreightSortFacilityCode($data['FreightSortFacilityCode']); + unset($data['FreightSortFacilityCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationSortCode::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DropLocationSortCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationSortCode::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationSortCode::class; + $dataArray = []; + if ($data->isInitialized('hubSortCode') && null !== $data->getHubSortCode()) { + $dataArray['HubSortCode'] = $data->getHubSortCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationSortCode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HubSortCode', $data)) { - $object->setHubSortCode($data['HubSortCode']); - unset($data['HubSortCode']); - } - if (\array_key_exists('FreightSortFacilityCode', $data)) { - $object->setFreightSortFacilityCode($data['FreightSortFacilityCode']); - unset($data['FreightSortFacilityCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('freightSortFacilityCode') && null !== $data->getFreightSortFacilityCode()) { + $dataArray['FreightSortFacilityCode'] = $data->getFreightSortFacilityCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('hubSortCode') && null !== $object->getHubSortCode()) { - $data['HubSortCode'] = $object->getHubSortCode(); - } - if ($object->isInitialized('freightSortFacilityCode') && null !== $object->getFreightSortFacilityCode()) { - $data['FreightSortFacilityCode'] = $object->getFreightSortFacilityCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationSortCode::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationSortCode::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropLocationSpecialInstructionsNormalizer.php b/src/Api/Normalizer/DropLocationSpecialInstructionsNormalizer.php index 1c9ad014..8208a955 100644 --- a/src/Api/Normalizer/DropLocationSpecialInstructionsNormalizer.php +++ b/src/Api/Normalizer/DropLocationSpecialInstructionsNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationSpecialInstructionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropLocationSpecialInstructionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class; + return $type === \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Segment', $data)) { - $object->setSegment($data['Segment']); - unset($data['Segment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Segment'] = $object->getSegment(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Segment', $data)) { + $object->setSegment($data['Segment']); + unset($data['Segment']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DropLocationSpecialInstructionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Segment'] = $data->getSegment(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Segment', $data)) { - $object->setSegment($data['Segment']); - unset($data['Segment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Segment'] = $object->getSegment(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropOffFacilitiesAddressNormalizer.php b/src/Api/Normalizer/DropOffFacilitiesAddressNormalizer.php index aa7b8a8b..67ef4e48 100644 --- a/src/Api/Normalizer/DropOffFacilitiesAddressNormalizer.php +++ b/src/Api/Normalizer/DropOffFacilitiesAddressNormalizer.php @@ -5,192 +5,95 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropOffFacilitiesAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropOffFacilitiesAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class; + return $type === \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialIndicator', $data)) { - $object->setResidentialIndicator($data['ResidentialIndicator']); - unset($data['ResidentialIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - $data['StateProvince'] = $object->getStateProvince(); - $data['PostalCode'] = $object->getPostalCode(); - $data['CountryCode'] = $object->getCountryCode(); - $data['ResidentialIndicator'] = $object->getResidentialIndicator(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } - } -} else { - class DropOffFacilitiesAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class; + if (\array_key_exists('StateProvince', $data)) { + $object->setStateProvince($data['StateProvince']); + unset($data['StateProvince']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialIndicator', $data)) { - $object->setResidentialIndicator($data['ResidentialIndicator']); - unset($data['ResidentialIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - $data['StateProvince'] = $object->getStateProvince(); - $data['PostalCode'] = $object->getPostalCode(); - $data['CountryCode'] = $object->getCountryCode(); - $data['ResidentialIndicator'] = $object->getResidentialIndicator(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ResidentialIndicator', $data)) { + $object->setResidentialIndicator($data['ResidentialIndicator']); + unset($data['ResidentialIndicator']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + $dataArray['StateProvince'] = $data->getStateProvince(); + $dataArray['PostalCode'] = $data->getPostalCode(); + $dataArray['CountryCode'] = $data->getCountryCode(); + $dataArray['ResidentialIndicator'] = $data->getResidentialIndicator(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropOffFacilitiesDistanceNormalizer.php b/src/Api/Normalizer/DropOffFacilitiesDistanceNormalizer.php index 9722405b..039f7f61 100644 --- a/src/Api/Normalizer/DropOffFacilitiesDistanceNormalizer.php +++ b/src/Api/Normalizer/DropOffFacilitiesDistanceNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropOffFacilitiesDistanceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropOffFacilitiesDistanceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class; + return $type === \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($data['UnitOfMeasurement']); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('value') && null !== $object->getValue()) { - $data['Value'] = $object->getValue(); - } - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['UnitOfMeasurement'] = $object->getUnitOfMeasurement(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); + } + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($data['UnitOfMeasurement']); + unset($data['UnitOfMeasurement']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DropOffFacilitiesDistanceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class; + $dataArray = []; + if ($data->isInitialized('value') && null !== $data->getValue()) { + $dataArray['Value'] = $data->getValue(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($data['UnitOfMeasurement']); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('unitOfMeasurement') && null !== $data->getUnitOfMeasurement()) { + $dataArray['UnitOfMeasurement'] = $data->getUnitOfMeasurement(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('value') && null !== $object->getValue()) { - $data['Value'] = $object->getValue(); - } - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['UnitOfMeasurement'] = $object->getUnitOfMeasurement(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropOffFacilitiesFacilityTimeNormalizer.php b/src/Api/Normalizer/DropOffFacilitiesFacilityTimeNormalizer.php index 4ae21382..462c6792 100644 --- a/src/Api/Normalizer/DropOffFacilitiesFacilityTimeNormalizer.php +++ b/src/Api/Normalizer/DropOffFacilitiesFacilityTimeNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropOffFacilitiesFacilityTimeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropOffFacilitiesFacilityTimeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class; + return $type === \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DayOfWeek', $data)) { - $values = []; - foreach ($data['DayOfWeek'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class, 'json', $context); - } - $object->setDayOfWeek($values); - unset($data['DayOfWeek']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('DayOfWeek', $data)) { $values = []; - foreach ($object->getDayOfWeek() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['DayOfWeek'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class, 'json', $context); } - $data['DayOfWeek'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setDayOfWeek($values); + unset($data['DayOfWeek']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class DropOffFacilitiesFacilityTimeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class; + $dataArray = []; + $values = []; + foreach ($data->getDayOfWeek() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['DayOfWeek'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DayOfWeek', $data)) { - $values = []; - foreach ($data['DayOfWeek'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class, 'json', $context); - } - $object->setDayOfWeek($values); - unset($data['DayOfWeek']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getDayOfWeek() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['DayOfWeek'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DropOffFacilitiesLocalizedInstructionNormalizer.php b/src/Api/Normalizer/DropOffFacilitiesLocalizedInstructionNormalizer.php index d2ffcd29..305d3458 100644 --- a/src/Api/Normalizer/DropOffFacilitiesLocalizedInstructionNormalizer.php +++ b/src/Api/Normalizer/DropOffFacilitiesLocalizedInstructionNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropOffFacilitiesLocalizedInstructionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DropOffFacilitiesLocalizedInstructionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class; + return $type === \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - if (\array_key_exists('Last50ftInstruction', $data)) { - $object->setLast50ftInstruction($data['Last50ftInstruction']); - unset($data['Last50ftInstruction']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('locale') && null !== $object->getLocale()) { - $data['Locale'] = $object->getLocale(); - } - if ($object->isInitialized('last50ftInstruction') && null !== $object->getLast50ftInstruction()) { - $data['Last50ftInstruction'] = $object->getLast50ftInstruction(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Locale', $data)) { + $object->setLocale($data['Locale']); + unset($data['Locale']); + } + if (\array_key_exists('Last50ftInstruction', $data)) { + $object->setLast50ftInstruction($data['Last50ftInstruction']); + unset($data['Last50ftInstruction']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DropOffFacilitiesLocalizedInstructionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class; + $dataArray = []; + if ($data->isInitialized('locale') && null !== $data->getLocale()) { + $dataArray['Locale'] = $data->getLocale(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - if (\array_key_exists('Last50ftInstruction', $data)) { - $object->setLast50ftInstruction($data['Last50ftInstruction']); - unset($data['Last50ftInstruction']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('last50ftInstruction') && null !== $data->getLast50ftInstruction()) { + $dataArray['Last50ftInstruction'] = $data->getLast50ftInstruction(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('locale') && null !== $object->getLocale()) { - $data['Locale'] = $object->getLocale(); - } - if ($object->isInitialized('last50ftInstruction') && null !== $object->getLast50ftInstruction()) { - $data['Last50ftInstruction'] = $object->getLast50ftInstruction(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DryIceDryIceWeightNormalizer.php b/src/Api/Normalizer/DryIceDryIceWeightNormalizer.php index 0428d977..c83d63b7 100644 --- a/src/Api/Normalizer/DryIceDryIceWeightNormalizer.php +++ b/src/Api/Normalizer/DryIceDryIceWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DryIceDryIceWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DryIceDryIceWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class; + return $type === \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DryIceDryIceWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DryIceDryIceWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DryIceDryIceWeight::class => false]; - } - } -} else { - class DryIceDryIceWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DryIceDryIceWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Weight'] = $data->getWeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DryIceDryIceWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DryIceDryIceWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/DryIceWeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/DryIceWeightUnitOfMeasurementNormalizer.php index 07891874..8a614ef8 100644 --- a/src/Api/Normalizer/DryIceWeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/DryIceWeightUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DryIceWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DryIceWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class DryIceWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/EEIFilingOptionShipperFiledNormalizer.php b/src/Api/Normalizer/EEIFilingOptionShipperFiledNormalizer.php index 909ea86b..bc3355df 100644 --- a/src/Api/Normalizer/EEIFilingOptionShipperFiledNormalizer.php +++ b/src/Api/Normalizer/EEIFilingOptionShipperFiledNormalizer.php @@ -5,182 +5,90 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class EEIFilingOptionShipperFiledNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class EEIFilingOptionShipperFiledNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class; + return $type === \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('PreDepartureITNNumber', $data)) { - $object->setPreDepartureITNNumber($data['PreDepartureITNNumber']); - unset($data['PreDepartureITNNumber']); - } - if (\array_key_exists('ExemptionLegend', $data)) { - $object->setExemptionLegend($data['ExemptionLegend']); - unset($data['ExemptionLegend']); - } - if (\array_key_exists('EEIShipmentReferenceNumber', $data)) { - $object->setEEIShipmentReferenceNumber($data['EEIShipmentReferenceNumber']); - unset($data['EEIShipmentReferenceNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('preDepartureITNNumber') && null !== $object->getPreDepartureITNNumber()) { - $data['PreDepartureITNNumber'] = $object->getPreDepartureITNNumber(); - } - if ($object->isInitialized('exemptionLegend') && null !== $object->getExemptionLegend()) { - $data['ExemptionLegend'] = $object->getExemptionLegend(); - } - if ($object->isInitialized('eEIShipmentReferenceNumber') && null !== $object->getEEIShipmentReferenceNumber()) { - $data['EEIShipmentReferenceNumber'] = $object->getEEIShipmentReferenceNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); + } + if (\array_key_exists('PreDepartureITNNumber', $data)) { + $object->setPreDepartureITNNumber($data['PreDepartureITNNumber']); + unset($data['PreDepartureITNNumber']); + } + if (\array_key_exists('ExemptionLegend', $data)) { + $object->setExemptionLegend($data['ExemptionLegend']); + unset($data['ExemptionLegend']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class => false]; + if (\array_key_exists('EEIShipmentReferenceNumber', $data)) { + $object->setEEIShipmentReferenceNumber($data['EEIShipmentReferenceNumber']); + unset($data['EEIShipmentReferenceNumber']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class EEIFilingOptionShipperFiledNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class; + if ($data->isInitialized('preDepartureITNNumber') && null !== $data->getPreDepartureITNNumber()) { + $dataArray['PreDepartureITNNumber'] = $data->getPreDepartureITNNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('PreDepartureITNNumber', $data)) { - $object->setPreDepartureITNNumber($data['PreDepartureITNNumber']); - unset($data['PreDepartureITNNumber']); - } - if (\array_key_exists('ExemptionLegend', $data)) { - $object->setExemptionLegend($data['ExemptionLegend']); - unset($data['ExemptionLegend']); - } - if (\array_key_exists('EEIShipmentReferenceNumber', $data)) { - $object->setEEIShipmentReferenceNumber($data['EEIShipmentReferenceNumber']); - unset($data['EEIShipmentReferenceNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('exemptionLegend') && null !== $data->getExemptionLegend()) { + $dataArray['ExemptionLegend'] = $data->getExemptionLegend(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('preDepartureITNNumber') && null !== $object->getPreDepartureITNNumber()) { - $data['PreDepartureITNNumber'] = $object->getPreDepartureITNNumber(); - } - if ($object->isInitialized('exemptionLegend') && null !== $object->getExemptionLegend()) { - $data['ExemptionLegend'] = $object->getExemptionLegend(); - } - if ($object->isInitialized('eEIShipmentReferenceNumber') && null !== $object->getEEIShipmentReferenceNumber()) { - $data['EEIShipmentReferenceNumber'] = $object->getEEIShipmentReferenceNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('eEIShipmentReferenceNumber') && null !== $data->getEEIShipmentReferenceNumber()) { + $dataArray['EEIShipmentReferenceNumber'] = $data->getEEIShipmentReferenceNumber(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/EEIFilingOptionUPSFiledNormalizer.php b/src/Api/Normalizer/EEIFilingOptionUPSFiledNormalizer.php index 15eb6eb6..4e202f7f 100644 --- a/src/Api/Normalizer/EEIFilingOptionUPSFiledNormalizer.php +++ b/src/Api/Normalizer/EEIFilingOptionUPSFiledNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class EEIFilingOptionUPSFiledNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class EEIFilingOptionUPSFiledNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class; + return $type === \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('POA', $data)) { - $object->setPOA($this->denormalizer->denormalize($data['POA'], \ShipStream\Ups\Api\Model\UPSFiledPOA::class, 'json', $context)); - unset($data['POA']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['POA'] = $this->normalizer->normalize($object->getPOA(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('POA', $data)) { + $object->setPOA($this->denormalizer->denormalize($data['POA'], \ShipStream\Ups\Api\Model\UPSFiledPOA::class, 'json', $context)); + unset($data['POA']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class EEIFilingOptionUPSFiledNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['POA'] = $this->normalizer->normalize($data->getPOA(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('POA', $data)) { - $object->setPOA($this->denormalizer->denormalize($data['POA'], \ShipStream\Ups\Api\Model\UPSFiledPOA::class, 'json', $context)); - unset($data['POA']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['POA'] = $this->normalizer->normalize($object->getPOA(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/EEIInformationDDTCInformationNormalizer.php b/src/Api/Normalizer/EEIInformationDDTCInformationNormalizer.php index 73ce4bd3..d9417057 100644 --- a/src/Api/Normalizer/EEIInformationDDTCInformationNormalizer.php +++ b/src/Api/Normalizer/EEIInformationDDTCInformationNormalizer.php @@ -5,228 +5,113 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class EEIInformationDDTCInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class EEIInformationDDTCInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ITARExemptionNumber', $data)) { - $object->setITARExemptionNumber($data['ITARExemptionNumber']); - unset($data['ITARExemptionNumber']); - } - if (\array_key_exists('USMLCategoryCode', $data)) { - $object->setUSMLCategoryCode($data['USMLCategoryCode']); - unset($data['USMLCategoryCode']); - } - if (\array_key_exists('EligiblePartyIndicator', $data)) { - $object->setEligiblePartyIndicator($data['EligiblePartyIndicator']); - unset($data['EligiblePartyIndicator']); - } - if (\array_key_exists('RegistrationNumber', $data)) { - $object->setRegistrationNumber($data['RegistrationNumber']); - unset($data['RegistrationNumber']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('SignificantMilitaryEquipmentIndicator', $data)) { - $object->setSignificantMilitaryEquipmentIndicator($data['SignificantMilitaryEquipmentIndicator']); - unset($data['SignificantMilitaryEquipmentIndicator']); - } - if (\array_key_exists('ACMNumber', $data)) { - $object->setACMNumber($data['ACMNumber']); - unset($data['ACMNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('iTARExemptionNumber') && null !== $object->getITARExemptionNumber()) { - $data['ITARExemptionNumber'] = $object->getITARExemptionNumber(); - } - if ($object->isInitialized('uSMLCategoryCode') && null !== $object->getUSMLCategoryCode()) { - $data['USMLCategoryCode'] = $object->getUSMLCategoryCode(); - } - if ($object->isInitialized('eligiblePartyIndicator') && null !== $object->getEligiblePartyIndicator()) { - $data['EligiblePartyIndicator'] = $object->getEligiblePartyIndicator(); - } - if ($object->isInitialized('registrationNumber') && null !== $object->getRegistrationNumber()) { - $data['RegistrationNumber'] = $object->getRegistrationNumber(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['Quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - } - if ($object->isInitialized('significantMilitaryEquipmentIndicator') && null !== $object->getSignificantMilitaryEquipmentIndicator()) { - $data['SignificantMilitaryEquipmentIndicator'] = $object->getSignificantMilitaryEquipmentIndicator(); - } - if ($object->isInitialized('aCMNumber') && null !== $object->getACMNumber()) { - $data['ACMNumber'] = $object->getACMNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ITARExemptionNumber', $data)) { + $object->setITARExemptionNumber($data['ITARExemptionNumber']); + unset($data['ITARExemptionNumber']); + } + if (\array_key_exists('USMLCategoryCode', $data)) { + $object->setUSMLCategoryCode($data['USMLCategoryCode']); + unset($data['USMLCategoryCode']); + } + if (\array_key_exists('EligiblePartyIndicator', $data)) { + $object->setEligiblePartyIndicator($data['EligiblePartyIndicator']); + unset($data['EligiblePartyIndicator']); + } + if (\array_key_exists('RegistrationNumber', $data)) { + $object->setRegistrationNumber($data['RegistrationNumber']); + unset($data['RegistrationNumber']); + } + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); + } + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); + } + if (\array_key_exists('SignificantMilitaryEquipmentIndicator', $data)) { + $object->setSignificantMilitaryEquipmentIndicator($data['SignificantMilitaryEquipmentIndicator']); + unset($data['SignificantMilitaryEquipmentIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class => false]; + if (\array_key_exists('ACMNumber', $data)) { + $object->setACMNumber($data['ACMNumber']); + unset($data['ACMNumber']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class EEIInformationDDTCInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ITARExemptionNumber', $data)) { - $object->setITARExemptionNumber($data['ITARExemptionNumber']); - unset($data['ITARExemptionNumber']); - } - if (\array_key_exists('USMLCategoryCode', $data)) { - $object->setUSMLCategoryCode($data['USMLCategoryCode']); - unset($data['USMLCategoryCode']); - } - if (\array_key_exists('EligiblePartyIndicator', $data)) { - $object->setEligiblePartyIndicator($data['EligiblePartyIndicator']); - unset($data['EligiblePartyIndicator']); - } - if (\array_key_exists('RegistrationNumber', $data)) { - $object->setRegistrationNumber($data['RegistrationNumber']); - unset($data['RegistrationNumber']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('SignificantMilitaryEquipmentIndicator', $data)) { - $object->setSignificantMilitaryEquipmentIndicator($data['SignificantMilitaryEquipmentIndicator']); - unset($data['SignificantMilitaryEquipmentIndicator']); - } - if (\array_key_exists('ACMNumber', $data)) { - $object->setACMNumber($data['ACMNumber']); - unset($data['ACMNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('iTARExemptionNumber') && null !== $data->getITARExemptionNumber()) { + $dataArray['ITARExemptionNumber'] = $data->getITARExemptionNumber(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('iTARExemptionNumber') && null !== $object->getITARExemptionNumber()) { - $data['ITARExemptionNumber'] = $object->getITARExemptionNumber(); - } - if ($object->isInitialized('uSMLCategoryCode') && null !== $object->getUSMLCategoryCode()) { - $data['USMLCategoryCode'] = $object->getUSMLCategoryCode(); - } - if ($object->isInitialized('eligiblePartyIndicator') && null !== $object->getEligiblePartyIndicator()) { - $data['EligiblePartyIndicator'] = $object->getEligiblePartyIndicator(); - } - if ($object->isInitialized('registrationNumber') && null !== $object->getRegistrationNumber()) { - $data['RegistrationNumber'] = $object->getRegistrationNumber(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['Quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - } - if ($object->isInitialized('significantMilitaryEquipmentIndicator') && null !== $object->getSignificantMilitaryEquipmentIndicator()) { - $data['SignificantMilitaryEquipmentIndicator'] = $object->getSignificantMilitaryEquipmentIndicator(); - } - if ($object->isInitialized('aCMNumber') && null !== $object->getACMNumber()) { - $data['ACMNumber'] = $object->getACMNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('uSMLCategoryCode') && null !== $data->getUSMLCategoryCode()) { + $dataArray['USMLCategoryCode'] = $data->getUSMLCategoryCode(); + } + if ($data->isInitialized('eligiblePartyIndicator') && null !== $data->getEligiblePartyIndicator()) { + $dataArray['EligiblePartyIndicator'] = $data->getEligiblePartyIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class => false]; + if ($data->isInitialized('registrationNumber') && null !== $data->getRegistrationNumber()) { + $dataArray['RegistrationNumber'] = $data->getRegistrationNumber(); } + if ($data->isInitialized('quantity') && null !== $data->getQuantity()) { + $dataArray['Quantity'] = $data->getQuantity(); + } + if ($data->isInitialized('unitOfMeasurement') && null !== $data->getUnitOfMeasurement()) { + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + } + if ($data->isInitialized('significantMilitaryEquipmentIndicator') && null !== $data->getSignificantMilitaryEquipmentIndicator()) { + $dataArray['SignificantMilitaryEquipmentIndicator'] = $data->getSignificantMilitaryEquipmentIndicator(); + } + if ($data->isInitialized('aCMNumber') && null !== $data->getACMNumber()) { + $dataArray['ACMNumber'] = $data->getACMNumber(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/EEIInformationLicenseNormalizer.php b/src/Api/Normalizer/EEIInformationLicenseNormalizer.php index 02c4b0f9..4cab5297 100644 --- a/src/Api/Normalizer/EEIInformationLicenseNormalizer.php +++ b/src/Api/Normalizer/EEIInformationLicenseNormalizer.php @@ -5,172 +5,85 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class EEIInformationLicenseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class EEIInformationLicenseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EEIInformationLicense::class; + return $type === \ShipStream\Ups\Api\Model\EEIInformationLicense::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EEIInformationLicense::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EEIInformationLicense::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EEIInformationLicense(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('LicenseLineValue', $data)) { - $object->setLicenseLineValue($data['LicenseLineValue']); - unset($data['LicenseLineValue']); - } - if (\array_key_exists('ECCNNumber', $data)) { - $object->setECCNNumber($data['ECCNNumber']); - unset($data['ECCNNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\EEIInformationLicense(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - if ($object->isInitialized('licenseLineValue') && null !== $object->getLicenseLineValue()) { - $data['LicenseLineValue'] = $object->getLicenseLineValue(); - } - if ($object->isInitialized('eCCNNumber') && null !== $object->getECCNNumber()) { - $data['ECCNNumber'] = $object->getECCNNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('LicenseLineValue', $data)) { + $object->setLicenseLineValue($data['LicenseLineValue']); + unset($data['LicenseLineValue']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EEIInformationLicense::class => false]; + if (\array_key_exists('ECCNNumber', $data)) { + $object->setECCNNumber($data['ECCNNumber']); + unset($data['ECCNNumber']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class EEIInformationLicenseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EEIInformationLicense::class; + $dataArray = []; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EEIInformationLicense::class; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EEIInformationLicense(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('LicenseLineValue', $data)) { - $object->setLicenseLineValue($data['LicenseLineValue']); - unset($data['LicenseLineValue']); - } - if (\array_key_exists('ECCNNumber', $data)) { - $object->setECCNNumber($data['ECCNNumber']); - unset($data['ECCNNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('licenseLineValue') && null !== $data->getLicenseLineValue()) { + $dataArray['LicenseLineValue'] = $data->getLicenseLineValue(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - if ($object->isInitialized('licenseLineValue') && null !== $object->getLicenseLineValue()) { - $data['LicenseLineValue'] = $object->getLicenseLineValue(); - } - if ($object->isInitialized('eCCNNumber') && null !== $object->getECCNNumber()) { - $data['ECCNNumber'] = $object->getECCNNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('eCCNNumber') && null !== $data->getECCNNumber()) { + $dataArray['ECCNNumber'] = $data->getECCNNumber(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EEIInformationLicense::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\EEIInformationLicense::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/EMailInformationEMailNormalizer.php b/src/Api/Normalizer/EMailInformationEMailNormalizer.php index 553dce26..780c79c5 100644 --- a/src/Api/Normalizer/EMailInformationEMailNormalizer.php +++ b/src/Api/Normalizer/EMailInformationEMailNormalizer.php @@ -5,164 +5,81 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class EMailInformationEMailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class EMailInformationEMailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EMailInformationEMail::class; + return $type === \ShipStream\Ups\Api\Model\EMailInformationEMail::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EMailInformationEMail::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EMailInformationEMail::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EMailInformationEMail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('EMailText', $data)) { - $object->setEMailText($data['EMailText']); - unset($data['EMailText']); - } - if (\array_key_exists('UndeliverableEMailAddress', $data)) { - $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); - unset($data['UndeliverableEMailAddress']); - } - if (\array_key_exists('Subject', $data)) { - $object->setSubject($data['Subject']); - unset($data['Subject']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\EMailInformationEMail(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['EMailAddress'] = $object->getEMailAddress(); - if ($object->isInitialized('eMailText') && null !== $object->getEMailText()) { - $data['EMailText'] = $object->getEMailText(); - } - $data['UndeliverableEMailAddress'] = $object->getUndeliverableEMailAddress(); - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['Subject'] = $object->getSubject(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EMailInformationEMail::class => false]; + if (\array_key_exists('EMailText', $data)) { + $object->setEMailText($data['EMailText']); + unset($data['EMailText']); } - } -} else { - class EMailInformationEMailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EMailInformationEMail::class; + if (\array_key_exists('UndeliverableEMailAddress', $data)) { + $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); + unset($data['UndeliverableEMailAddress']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EMailInformationEMail::class; + if (\array_key_exists('Subject', $data)) { + $object->setSubject($data['Subject']); + unset($data['Subject']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EMailInformationEMail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('EMailText', $data)) { - $object->setEMailText($data['EMailText']); - unset($data['EMailText']); - } - if (\array_key_exists('UndeliverableEMailAddress', $data)) { - $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); - unset($data['UndeliverableEMailAddress']); - } - if (\array_key_exists('Subject', $data)) { - $object->setSubject($data['Subject']); - unset($data['Subject']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['EMailAddress'] = $object->getEMailAddress(); - if ($object->isInitialized('eMailText') && null !== $object->getEMailText()) { - $data['EMailText'] = $object->getEMailText(); - } - $data['UndeliverableEMailAddress'] = $object->getUndeliverableEMailAddress(); - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['Subject'] = $object->getSubject(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['EMailAddress'] = $data->getEMailAddress(); + if ($data->isInitialized('eMailText') && null !== $data->getEMailText()) { + $dataArray['EMailText'] = $data->getEMailText(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EMailInformationEMail::class => false]; + $dataArray['UndeliverableEMailAddress'] = $data->getUndeliverableEMailAddress(); + if ($data->isInitialized('subject') && null !== $data->getSubject()) { + $dataArray['Subject'] = $data->getSubject(); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\EMailInformationEMail::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/EMailInformationEMailTypeNormalizer.php b/src/Api/Normalizer/EMailInformationEMailTypeNormalizer.php index c8d43a4f..4366e8d1 100644 --- a/src/Api/Normalizer/EMailInformationEMailTypeNormalizer.php +++ b/src/Api/Normalizer/EMailInformationEMailTypeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class EMailInformationEMailTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class EMailInformationEMailTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EMailInformationEMailType::class; + return $type === \ShipStream\Ups\Api\Model\EMailInformationEMailType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EMailInformationEMailType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EMailInformationEMailType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EMailInformationEMailType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\EMailInformationEMailType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EMailInformationEMailType::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class EMailInformationEMailTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EMailInformationEMailType::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EMailInformationEMailType::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EMailInformationEMailType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EMailInformationEMailType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\EMailInformationEMailType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ElementLevelInformationElementIdentifierNormalizer.php b/src/Api/Normalizer/ElementLevelInformationElementIdentifierNormalizer.php index 614eba6c..62283f52 100644 --- a/src/Api/Normalizer/ElementLevelInformationElementIdentifierNormalizer.php +++ b/src/Api/Normalizer/ElementLevelInformationElementIdentifierNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ElementLevelInformationElementIdentifierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ElementLevelInformationElementIdentifierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class; + return $type === \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class => false]; - } - } -} else { - class ElementLevelInformationElementIdentifierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/EmsResponseNormalizer.php b/src/Api/Normalizer/EmsResponseNormalizer.php index 3d938825..6583532c 100644 --- a/src/Api/Normalizer/EmsResponseNormalizer.php +++ b/src/Api/Normalizer/EmsResponseNormalizer.php @@ -5,466 +5,235 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class EmsResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class EmsResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EmsResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EmsResponse::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EmsResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('shipDate', $data)) { - $object->setShipDate($data['shipDate']); - unset($data['shipDate']); - } - if (\array_key_exists('shipTime', $data)) { - $object->setShipTime($data['shipTime']); - unset($data['shipTime']); - } - if (\array_key_exists('serviceLevel', $data)) { - $object->setServiceLevel($data['serviceLevel']); - unset($data['serviceLevel']); - } - if (\array_key_exists('billType', $data)) { - $object->setBillType($data['billType']); - unset($data['billType']); - } - if (\array_key_exists('dutyType', $data)) { - $object->setDutyType($data['dutyType']); - unset($data['dutyType']); - } - if (\array_key_exists('residentialIndicator', $data)) { - $object->setResidentialIndicator($data['residentialIndicator']); - unset($data['residentialIndicator']); - } - if (\array_key_exists('destinationCountryName', $data)) { - $object->setDestinationCountryName($data['destinationCountryName']); - unset($data['destinationCountryName']); - } - if (\array_key_exists('destinationCountryCode', $data)) { - $object->setDestinationCountryCode($data['destinationCountryCode']); - unset($data['destinationCountryCode']); - } - if (\array_key_exists('destinationPostalCode', $data)) { - $object->setDestinationPostalCode($data['destinationPostalCode']); - unset($data['destinationPostalCode']); - } - if (\array_key_exists('destinationPostalCodeLow', $data)) { - $object->setDestinationPostalCodeLow($data['destinationPostalCodeLow']); - unset($data['destinationPostalCodeLow']); - } - if (\array_key_exists('destinationPostalCodeHigh', $data)) { - $object->setDestinationPostalCodeHigh($data['destinationPostalCodeHigh']); - unset($data['destinationPostalCodeHigh']); - } - if (\array_key_exists('destinationStateProvince', $data)) { - $object->setDestinationStateProvince($data['destinationStateProvince']); - unset($data['destinationStateProvince']); - } - if (\array_key_exists('destinationCityName', $data)) { - $object->setDestinationCityName($data['destinationCityName']); - unset($data['destinationCityName']); - } - if (\array_key_exists('originCountryName', $data)) { - $object->setOriginCountryName($data['originCountryName']); - unset($data['originCountryName']); - } - if (\array_key_exists('originCountryCode', $data)) { - $object->setOriginCountryCode($data['originCountryCode']); - unset($data['originCountryCode']); - } - if (\array_key_exists('originPostalCode', $data)) { - $object->setOriginPostalCode($data['originPostalCode']); - unset($data['originPostalCode']); - } - if (\array_key_exists('originPostalCodeLow', $data)) { - $object->setOriginPostalCodeLow($data['originPostalCodeLow']); - unset($data['originPostalCodeLow']); - } - if (\array_key_exists('originPostalCodeHigh', $data)) { - $object->setOriginPostalCodeHigh($data['originPostalCodeHigh']); - unset($data['originPostalCodeHigh']); - } - if (\array_key_exists('originStateProvince', $data)) { - $object->setOriginStateProvince($data['originStateProvince']); - unset($data['originStateProvince']); - } - if (\array_key_exists('originCityName', $data)) { - $object->setOriginCityName($data['originCityName']); - unset($data['originCityName']); - } - if (\array_key_exists('weight', $data)) { - $object->setWeight($data['weight']); - unset($data['weight']); - } - if (\array_key_exists('weightUnitOfMeasure', $data)) { - $object->setWeightUnitOfMeasure($data['weightUnitOfMeasure']); - unset($data['weightUnitOfMeasure']); - } - if (\array_key_exists('shipmentContentsValue', $data)) { - $object->setShipmentContentsValue($data['shipmentContentsValue']); - unset($data['shipmentContentsValue']); - } - if (\array_key_exists('shipmentContentsCurrencyCode', $data)) { - $object->setShipmentContentsCurrencyCode($data['shipmentContentsCurrencyCode']); - unset($data['shipmentContentsCurrencyCode']); - } - if (\array_key_exists('guaranteeSuspended', $data)) { - $object->setGuaranteeSuspended($data['guaranteeSuspended']); - unset($data['guaranteeSuspended']); - } - if (\array_key_exists('numberOfServices', $data)) { - $object->setNumberOfServices($data['numberOfServices']); - unset($data['numberOfServices']); - } - if (\array_key_exists('services', $data)) { - $values = []; - foreach ($data['services'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Services::class, 'json', $context); - } - $object->setServices($values); - unset($data['services']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\EmsResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EmsResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\EmsResponse(); + if (\array_key_exists('guaranteeSuspended', $data) && \is_int($data['guaranteeSuspended'])) { + $data['guaranteeSuspended'] = (bool) $data['guaranteeSuspended']; + } + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['shipDate'] = $object->getShipDate(); - $data['shipTime'] = $object->getShipTime(); - $data['serviceLevel'] = $object->getServiceLevel(); - $data['billType'] = $object->getBillType(); - if ($object->isInitialized('dutyType') && null !== $object->getDutyType()) { - $data['dutyType'] = $object->getDutyType(); - } - $data['residentialIndicator'] = $object->getResidentialIndicator(); - $data['destinationCountryName'] = $object->getDestinationCountryName(); - $data['destinationCountryCode'] = $object->getDestinationCountryCode(); - if ($object->isInitialized('destinationPostalCode') && null !== $object->getDestinationPostalCode()) { - $data['destinationPostalCode'] = $object->getDestinationPostalCode(); - } - if ($object->isInitialized('destinationPostalCodeLow') && null !== $object->getDestinationPostalCodeLow()) { - $data['destinationPostalCodeLow'] = $object->getDestinationPostalCodeLow(); - } - if ($object->isInitialized('destinationPostalCodeHigh') && null !== $object->getDestinationPostalCodeHigh()) { - $data['destinationPostalCodeHigh'] = $object->getDestinationPostalCodeHigh(); - } - if ($object->isInitialized('destinationStateProvince') && null !== $object->getDestinationStateProvince()) { - $data['destinationStateProvince'] = $object->getDestinationStateProvince(); - } - if ($object->isInitialized('destinationCityName') && null !== $object->getDestinationCityName()) { - $data['destinationCityName'] = $object->getDestinationCityName(); - } - $data['originCountryName'] = $object->getOriginCountryName(); - $data['originCountryCode'] = $object->getOriginCountryCode(); - if ($object->isInitialized('originPostalCode') && null !== $object->getOriginPostalCode()) { - $data['originPostalCode'] = $object->getOriginPostalCode(); - } - if ($object->isInitialized('originPostalCodeLow') && null !== $object->getOriginPostalCodeLow()) { - $data['originPostalCodeLow'] = $object->getOriginPostalCodeLow(); - } - if ($object->isInitialized('originPostalCodeHigh') && null !== $object->getOriginPostalCodeHigh()) { - $data['originPostalCodeHigh'] = $object->getOriginPostalCodeHigh(); - } - if ($object->isInitialized('originStateProvince') && null !== $object->getOriginStateProvince()) { - $data['originStateProvince'] = $object->getOriginStateProvince(); - } - if ($object->isInitialized('originCityName') && null !== $object->getOriginCityName()) { - $data['originCityName'] = $object->getOriginCityName(); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['weight'] = $object->getWeight(); - } - if ($object->isInitialized('weightUnitOfMeasure') && null !== $object->getWeightUnitOfMeasure()) { - $data['weightUnitOfMeasure'] = $object->getWeightUnitOfMeasure(); - } - if ($object->isInitialized('shipmentContentsValue') && null !== $object->getShipmentContentsValue()) { - $data['shipmentContentsValue'] = $object->getShipmentContentsValue(); - } - if ($object->isInitialized('shipmentContentsCurrencyCode') && null !== $object->getShipmentContentsCurrencyCode()) { - $data['shipmentContentsCurrencyCode'] = $object->getShipmentContentsCurrencyCode(); - } - $data['guaranteeSuspended'] = $object->getGuaranteeSuspended(); - $data['numberOfServices'] = $object->getNumberOfServices(); - if ($object->isInitialized('services') && null !== $object->getServices()) { - $values = []; - foreach ($object->getServices() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['services'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('shipDate', $data)) { + $object->setShipDate($data['shipDate']); + unset($data['shipDate']); + } + if (\array_key_exists('shipTime', $data)) { + $object->setShipTime($data['shipTime']); + unset($data['shipTime']); + } + if (\array_key_exists('serviceLevel', $data)) { + $object->setServiceLevel($data['serviceLevel']); + unset($data['serviceLevel']); + } + if (\array_key_exists('billType', $data)) { + $object->setBillType($data['billType']); + unset($data['billType']); + } + if (\array_key_exists('dutyType', $data)) { + $object->setDutyType($data['dutyType']); + unset($data['dutyType']); + } + if (\array_key_exists('residentialIndicator', $data)) { + $object->setResidentialIndicator($data['residentialIndicator']); + unset($data['residentialIndicator']); + } + if (\array_key_exists('destinationCountryName', $data)) { + $object->setDestinationCountryName($data['destinationCountryName']); + unset($data['destinationCountryName']); + } + if (\array_key_exists('destinationCountryCode', $data)) { + $object->setDestinationCountryCode($data['destinationCountryCode']); + unset($data['destinationCountryCode']); + } + if (\array_key_exists('destinationPostalCode', $data)) { + $object->setDestinationPostalCode($data['destinationPostalCode']); + unset($data['destinationPostalCode']); + } + if (\array_key_exists('destinationPostalCodeLow', $data)) { + $object->setDestinationPostalCodeLow($data['destinationPostalCodeLow']); + unset($data['destinationPostalCodeLow']); + } + if (\array_key_exists('destinationPostalCodeHigh', $data)) { + $object->setDestinationPostalCodeHigh($data['destinationPostalCodeHigh']); + unset($data['destinationPostalCodeHigh']); + } + if (\array_key_exists('destinationStateProvince', $data)) { + $object->setDestinationStateProvince($data['destinationStateProvince']); + unset($data['destinationStateProvince']); + } + if (\array_key_exists('destinationCityName', $data)) { + $object->setDestinationCityName($data['destinationCityName']); + unset($data['destinationCityName']); + } + if (\array_key_exists('originCountryName', $data)) { + $object->setOriginCountryName($data['originCountryName']); + unset($data['originCountryName']); + } + if (\array_key_exists('originCountryCode', $data)) { + $object->setOriginCountryCode($data['originCountryCode']); + unset($data['originCountryCode']); + } + if (\array_key_exists('originPostalCode', $data)) { + $object->setOriginPostalCode($data['originPostalCode']); + unset($data['originPostalCode']); + } + if (\array_key_exists('originPostalCodeLow', $data)) { + $object->setOriginPostalCodeLow($data['originPostalCodeLow']); + unset($data['originPostalCodeLow']); + } + if (\array_key_exists('originPostalCodeHigh', $data)) { + $object->setOriginPostalCodeHigh($data['originPostalCodeHigh']); + unset($data['originPostalCodeHigh']); + } + if (\array_key_exists('originStateProvince', $data)) { + $object->setOriginStateProvince($data['originStateProvince']); + unset($data['originStateProvince']); + } + if (\array_key_exists('originCityName', $data)) { + $object->setOriginCityName($data['originCityName']); + unset($data['originCityName']); + } + if (\array_key_exists('weight', $data)) { + $object->setWeight($data['weight']); + unset($data['weight']); + } + if (\array_key_exists('weightUnitOfMeasure', $data)) { + $object->setWeightUnitOfMeasure($data['weightUnitOfMeasure']); + unset($data['weightUnitOfMeasure']); + } + if (\array_key_exists('shipmentContentsValue', $data)) { + $object->setShipmentContentsValue($data['shipmentContentsValue']); + unset($data['shipmentContentsValue']); + } + if (\array_key_exists('shipmentContentsCurrencyCode', $data)) { + $object->setShipmentContentsCurrencyCode($data['shipmentContentsCurrencyCode']); + unset($data['shipmentContentsCurrencyCode']); + } + if (\array_key_exists('guaranteeSuspended', $data)) { + $object->setGuaranteeSuspended($data['guaranteeSuspended']); + unset($data['guaranteeSuspended']); + } + if (\array_key_exists('numberOfServices', $data)) { + $object->setNumberOfServices($data['numberOfServices']); + unset($data['numberOfServices']); + } + if (\array_key_exists('services', $data)) { + $values = []; + foreach ($data['services'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Services::class, 'json', $context); } - return $data; + $object->setServices($values); + unset($data['services']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EmsResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class EmsResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EmsResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EmsResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EmsResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('shipDate', $data)) { - $object->setShipDate($data['shipDate']); - unset($data['shipDate']); - } - if (\array_key_exists('shipTime', $data)) { - $object->setShipTime($data['shipTime']); - unset($data['shipTime']); - } - if (\array_key_exists('serviceLevel', $data)) { - $object->setServiceLevel($data['serviceLevel']); - unset($data['serviceLevel']); - } - if (\array_key_exists('billType', $data)) { - $object->setBillType($data['billType']); - unset($data['billType']); - } - if (\array_key_exists('dutyType', $data)) { - $object->setDutyType($data['dutyType']); - unset($data['dutyType']); - } - if (\array_key_exists('residentialIndicator', $data)) { - $object->setResidentialIndicator($data['residentialIndicator']); - unset($data['residentialIndicator']); - } - if (\array_key_exists('destinationCountryName', $data)) { - $object->setDestinationCountryName($data['destinationCountryName']); - unset($data['destinationCountryName']); - } - if (\array_key_exists('destinationCountryCode', $data)) { - $object->setDestinationCountryCode($data['destinationCountryCode']); - unset($data['destinationCountryCode']); - } - if (\array_key_exists('destinationPostalCode', $data)) { - $object->setDestinationPostalCode($data['destinationPostalCode']); - unset($data['destinationPostalCode']); - } - if (\array_key_exists('destinationPostalCodeLow', $data)) { - $object->setDestinationPostalCodeLow($data['destinationPostalCodeLow']); - unset($data['destinationPostalCodeLow']); - } - if (\array_key_exists('destinationPostalCodeHigh', $data)) { - $object->setDestinationPostalCodeHigh($data['destinationPostalCodeHigh']); - unset($data['destinationPostalCodeHigh']); - } - if (\array_key_exists('destinationStateProvince', $data)) { - $object->setDestinationStateProvince($data['destinationStateProvince']); - unset($data['destinationStateProvince']); - } - if (\array_key_exists('destinationCityName', $data)) { - $object->setDestinationCityName($data['destinationCityName']); - unset($data['destinationCityName']); - } - if (\array_key_exists('originCountryName', $data)) { - $object->setOriginCountryName($data['originCountryName']); - unset($data['originCountryName']); - } - if (\array_key_exists('originCountryCode', $data)) { - $object->setOriginCountryCode($data['originCountryCode']); - unset($data['originCountryCode']); - } - if (\array_key_exists('originPostalCode', $data)) { - $object->setOriginPostalCode($data['originPostalCode']); - unset($data['originPostalCode']); - } - if (\array_key_exists('originPostalCodeLow', $data)) { - $object->setOriginPostalCodeLow($data['originPostalCodeLow']); - unset($data['originPostalCodeLow']); - } - if (\array_key_exists('originPostalCodeHigh', $data)) { - $object->setOriginPostalCodeHigh($data['originPostalCodeHigh']); - unset($data['originPostalCodeHigh']); - } - if (\array_key_exists('originStateProvince', $data)) { - $object->setOriginStateProvince($data['originStateProvince']); - unset($data['originStateProvince']); - } - if (\array_key_exists('originCityName', $data)) { - $object->setOriginCityName($data['originCityName']); - unset($data['originCityName']); - } - if (\array_key_exists('weight', $data)) { - $object->setWeight($data['weight']); - unset($data['weight']); - } - if (\array_key_exists('weightUnitOfMeasure', $data)) { - $object->setWeightUnitOfMeasure($data['weightUnitOfMeasure']); - unset($data['weightUnitOfMeasure']); - } - if (\array_key_exists('shipmentContentsValue', $data)) { - $object->setShipmentContentsValue($data['shipmentContentsValue']); - unset($data['shipmentContentsValue']); - } - if (\array_key_exists('shipmentContentsCurrencyCode', $data)) { - $object->setShipmentContentsCurrencyCode($data['shipmentContentsCurrencyCode']); - unset($data['shipmentContentsCurrencyCode']); - } - if (\array_key_exists('guaranteeSuspended', $data)) { - $object->setGuaranteeSuspended($data['guaranteeSuspended']); - unset($data['guaranteeSuspended']); - } - if (\array_key_exists('numberOfServices', $data)) { - $object->setNumberOfServices($data['numberOfServices']); - unset($data['numberOfServices']); - } - if (\array_key_exists('services', $data)) { - $values = []; - foreach ($data['services'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Services::class, 'json', $context); - } - $object->setServices($values); - unset($data['services']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray = []; + $dataArray['shipDate'] = $data->getShipDate(); + $dataArray['shipTime'] = $data->getShipTime(); + $dataArray['serviceLevel'] = $data->getServiceLevel(); + $dataArray['billType'] = $data->getBillType(); + if ($data->isInitialized('dutyType') && null !== $data->getDutyType()) { + $dataArray['dutyType'] = $data->getDutyType(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['shipDate'] = $object->getShipDate(); - $data['shipTime'] = $object->getShipTime(); - $data['serviceLevel'] = $object->getServiceLevel(); - $data['billType'] = $object->getBillType(); - if ($object->isInitialized('dutyType') && null !== $object->getDutyType()) { - $data['dutyType'] = $object->getDutyType(); - } - $data['residentialIndicator'] = $object->getResidentialIndicator(); - $data['destinationCountryName'] = $object->getDestinationCountryName(); - $data['destinationCountryCode'] = $object->getDestinationCountryCode(); - if ($object->isInitialized('destinationPostalCode') && null !== $object->getDestinationPostalCode()) { - $data['destinationPostalCode'] = $object->getDestinationPostalCode(); - } - if ($object->isInitialized('destinationPostalCodeLow') && null !== $object->getDestinationPostalCodeLow()) { - $data['destinationPostalCodeLow'] = $object->getDestinationPostalCodeLow(); - } - if ($object->isInitialized('destinationPostalCodeHigh') && null !== $object->getDestinationPostalCodeHigh()) { - $data['destinationPostalCodeHigh'] = $object->getDestinationPostalCodeHigh(); - } - if ($object->isInitialized('destinationStateProvince') && null !== $object->getDestinationStateProvince()) { - $data['destinationStateProvince'] = $object->getDestinationStateProvince(); - } - if ($object->isInitialized('destinationCityName') && null !== $object->getDestinationCityName()) { - $data['destinationCityName'] = $object->getDestinationCityName(); - } - $data['originCountryName'] = $object->getOriginCountryName(); - $data['originCountryCode'] = $object->getOriginCountryCode(); - if ($object->isInitialized('originPostalCode') && null !== $object->getOriginPostalCode()) { - $data['originPostalCode'] = $object->getOriginPostalCode(); - } - if ($object->isInitialized('originPostalCodeLow') && null !== $object->getOriginPostalCodeLow()) { - $data['originPostalCodeLow'] = $object->getOriginPostalCodeLow(); - } - if ($object->isInitialized('originPostalCodeHigh') && null !== $object->getOriginPostalCodeHigh()) { - $data['originPostalCodeHigh'] = $object->getOriginPostalCodeHigh(); - } - if ($object->isInitialized('originStateProvince') && null !== $object->getOriginStateProvince()) { - $data['originStateProvince'] = $object->getOriginStateProvince(); - } - if ($object->isInitialized('originCityName') && null !== $object->getOriginCityName()) { - $data['originCityName'] = $object->getOriginCityName(); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['weight'] = $object->getWeight(); - } - if ($object->isInitialized('weightUnitOfMeasure') && null !== $object->getWeightUnitOfMeasure()) { - $data['weightUnitOfMeasure'] = $object->getWeightUnitOfMeasure(); - } - if ($object->isInitialized('shipmentContentsValue') && null !== $object->getShipmentContentsValue()) { - $data['shipmentContentsValue'] = $object->getShipmentContentsValue(); - } - if ($object->isInitialized('shipmentContentsCurrencyCode') && null !== $object->getShipmentContentsCurrencyCode()) { - $data['shipmentContentsCurrencyCode'] = $object->getShipmentContentsCurrencyCode(); - } - $data['guaranteeSuspended'] = $object->getGuaranteeSuspended(); - $data['numberOfServices'] = $object->getNumberOfServices(); - if ($object->isInitialized('services') && null !== $object->getServices()) { - $values = []; - foreach ($object->getServices() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['services'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $dataArray['residentialIndicator'] = $data->getResidentialIndicator(); + $dataArray['destinationCountryName'] = $data->getDestinationCountryName(); + $dataArray['destinationCountryCode'] = $data->getDestinationCountryCode(); + if ($data->isInitialized('destinationPostalCode') && null !== $data->getDestinationPostalCode()) { + $dataArray['destinationPostalCode'] = $data->getDestinationPostalCode(); + } + if ($data->isInitialized('destinationPostalCodeLow') && null !== $data->getDestinationPostalCodeLow()) { + $dataArray['destinationPostalCodeLow'] = $data->getDestinationPostalCodeLow(); + } + if ($data->isInitialized('destinationPostalCodeHigh') && null !== $data->getDestinationPostalCodeHigh()) { + $dataArray['destinationPostalCodeHigh'] = $data->getDestinationPostalCodeHigh(); + } + if ($data->isInitialized('destinationStateProvince') && null !== $data->getDestinationStateProvince()) { + $dataArray['destinationStateProvince'] = $data->getDestinationStateProvince(); + } + if ($data->isInitialized('destinationCityName') && null !== $data->getDestinationCityName()) { + $dataArray['destinationCityName'] = $data->getDestinationCityName(); + } + $dataArray['originCountryName'] = $data->getOriginCountryName(); + $dataArray['originCountryCode'] = $data->getOriginCountryCode(); + if ($data->isInitialized('originPostalCode') && null !== $data->getOriginPostalCode()) { + $dataArray['originPostalCode'] = $data->getOriginPostalCode(); + } + if ($data->isInitialized('originPostalCodeLow') && null !== $data->getOriginPostalCodeLow()) { + $dataArray['originPostalCodeLow'] = $data->getOriginPostalCodeLow(); + } + if ($data->isInitialized('originPostalCodeHigh') && null !== $data->getOriginPostalCodeHigh()) { + $dataArray['originPostalCodeHigh'] = $data->getOriginPostalCodeHigh(); + } + if ($data->isInitialized('originStateProvince') && null !== $data->getOriginStateProvince()) { + $dataArray['originStateProvince'] = $data->getOriginStateProvince(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EmsResponse::class => false]; + if ($data->isInitialized('originCityName') && null !== $data->getOriginCityName()) { + $dataArray['originCityName'] = $data->getOriginCityName(); } + if ($data->isInitialized('weight') && null !== $data->getWeight()) { + $dataArray['weight'] = $data->getWeight(); + } + if ($data->isInitialized('weightUnitOfMeasure') && null !== $data->getWeightUnitOfMeasure()) { + $dataArray['weightUnitOfMeasure'] = $data->getWeightUnitOfMeasure(); + } + if ($data->isInitialized('shipmentContentsValue') && null !== $data->getShipmentContentsValue()) { + $dataArray['shipmentContentsValue'] = $data->getShipmentContentsValue(); + } + if ($data->isInitialized('shipmentContentsCurrencyCode') && null !== $data->getShipmentContentsCurrencyCode()) { + $dataArray['shipmentContentsCurrencyCode'] = $data->getShipmentContentsCurrencyCode(); + } + $dataArray['guaranteeSuspended'] = $data->getGuaranteeSuspended(); + $dataArray['numberOfServices'] = $data->getNumberOfServices(); + if ($data->isInitialized('services') && null !== $data->getServices()) { + $values = []; + foreach ($data->getServices() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['services'] = $values; + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\EmsResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ErrorErrorLocationNormalizer.php b/src/Api/Normalizer/ErrorErrorLocationNormalizer.php index 720f5b9d..1a9cc8d0 100644 --- a/src/Api/Normalizer/ErrorErrorLocationNormalizer.php +++ b/src/Api/Normalizer/ErrorErrorLocationNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ErrorErrorLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ErrorErrorLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ErrorErrorLocation::class; + return $type === \ShipStream\Ups\Api\Model\ErrorErrorLocation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ErrorErrorLocation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ErrorErrorLocation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ErrorErrorLocation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ErrorLocationElementName', $data)) { - $object->setErrorLocationElementName($data['ErrorLocationElementName']); - unset($data['ErrorLocationElementName']); - } - if (\array_key_exists('ErrorLocationAttributeName', $data)) { - $object->setErrorLocationAttributeName($data['ErrorLocationAttributeName']); - unset($data['ErrorLocationAttributeName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ErrorErrorLocation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('errorLocationElementName') && null !== $object->getErrorLocationElementName()) { - $data['ErrorLocationElementName'] = $object->getErrorLocationElementName(); - } - if ($object->isInitialized('errorLocationAttributeName') && null !== $object->getErrorLocationAttributeName()) { - $data['ErrorLocationAttributeName'] = $object->getErrorLocationAttributeName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ErrorLocationElementName', $data)) { + $object->setErrorLocationElementName($data['ErrorLocationElementName']); + unset($data['ErrorLocationElementName']); + } + if (\array_key_exists('ErrorLocationAttributeName', $data)) { + $object->setErrorLocationAttributeName($data['ErrorLocationAttributeName']); + unset($data['ErrorLocationAttributeName']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ErrorErrorLocation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ErrorErrorLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ErrorErrorLocation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ErrorErrorLocation::class; + $dataArray = []; + if ($data->isInitialized('errorLocationElementName') && null !== $data->getErrorLocationElementName()) { + $dataArray['ErrorLocationElementName'] = $data->getErrorLocationElementName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ErrorErrorLocation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ErrorLocationElementName', $data)) { - $object->setErrorLocationElementName($data['ErrorLocationElementName']); - unset($data['ErrorLocationElementName']); - } - if (\array_key_exists('ErrorLocationAttributeName', $data)) { - $object->setErrorLocationAttributeName($data['ErrorLocationAttributeName']); - unset($data['ErrorLocationAttributeName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('errorLocationAttributeName') && null !== $data->getErrorLocationAttributeName()) { + $dataArray['ErrorLocationAttributeName'] = $data->getErrorLocationAttributeName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('errorLocationElementName') && null !== $object->getErrorLocationElementName()) { - $data['ErrorLocationElementName'] = $object->getErrorLocationElementName(); - } - if ($object->isInitialized('errorLocationAttributeName') && null !== $object->getErrorLocationAttributeName()) { - $data['ErrorLocationAttributeName'] = $object->getErrorLocationAttributeName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ErrorErrorLocation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ErrorErrorLocation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ErrorNormalizer.php b/src/Api/Normalizer/ErrorNormalizer.php index 77342e92..7d486ca6 100644 --- a/src/Api/Normalizer/ErrorNormalizer.php +++ b/src/Api/Normalizer/ErrorNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Error::class; + return $type === \ShipStream\Ups\Api\Model\Error::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Error::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Error::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Error(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('message', $data)) { - $object->setMessage($data['message']); - unset($data['message']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\Error(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('message') && null !== $object->getMessage()) { - $data['message'] = $object->getMessage(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('code', $data)) { + $object->setCode($data['code']); + unset($data['code']); + } + if (\array_key_exists('message', $data)) { + $object->setMessage($data['message']); + unset($data['message']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Error::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Error::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Error::class; + $dataArray = []; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['code'] = $data->getCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Error(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('message', $data)) { - $object->setMessage($data['message']); - unset($data['message']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('message') && null !== $data->getMessage()) { + $dataArray['message'] = $data->getMessage(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('message') && null !== $object->getMessage()) { - $data['message'] = $object->getMessage(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Error::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Error::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ErrorResponseNormalizer.php b/src/Api/Normalizer/ErrorResponseNormalizer.php index 93d033e6..f7152432 100644 --- a/src/Api/Normalizer/ErrorResponseNormalizer.php +++ b/src/Api/Normalizer/ErrorResponseNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ErrorResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ErrorResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ErrorResponse::class; + return $type === \ShipStream\Ups\Api\Model\ErrorResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ErrorResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ErrorResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ErrorResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['response'], \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class, 'json', $context)); - unset($data['response']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ErrorResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('response') && null !== $object->getResponse()) { - $data['response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['response'], \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class, 'json', $context)); + unset($data['response']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ErrorResponse::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ErrorResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ErrorResponse::class; + $dataArray = []; + if ($data->isInitialized('response') && null !== $data->getResponse()) { + $dataArray['response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ErrorResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ErrorResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['response'], \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class, 'json', $context)); - unset($data['response']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('response') && null !== $object->getResponse()) { - $data['response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ErrorResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ErrorResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ErrorResponseWrapperNormalizer.php b/src/Api/Normalizer/ErrorResponseWrapperNormalizer.php index e8e89ec4..2e6a6142 100644 --- a/src/Api/Normalizer/ErrorResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/ErrorResponseWrapperNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ErrorResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ErrorResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ErrorResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('errors', $data)) { - $values = []; - foreach ($data['errors'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Error::class, 'json', $context); - } - $object->setErrors($values); - unset($data['errors']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ErrorResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('errors') && null !== $object->getErrors()) { - $values = []; - foreach ($object->getErrors() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['errors'] = $values; + if (\array_key_exists('errors', $data)) { + $values = []; + foreach ($data['errors'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Error::class, 'json', $context); } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setErrors($values); + unset($data['errors']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ErrorResponseWrapper::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class ErrorResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ErrorResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('errors', $data)) { - $values = []; - foreach ($data['errors'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Error::class, 'json', $context); - } - $object->setErrors($values); - unset($data['errors']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + $dataArray = []; + if ($data->isInitialized('errors') && null !== $data->getErrors()) { + $values = []; + foreach ($data->getErrors() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['errors'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('errors') && null !== $object->getErrors()) { - $values = []; - foreach ($object->getErrors() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['errors'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ErrorResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ErrorResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ErrorsNormalizer.php b/src/Api/Normalizer/ErrorsNormalizer.php index 87f43a03..99cd7cb5 100644 --- a/src/Api/Normalizer/ErrorsNormalizer.php +++ b/src/Api/Normalizer/ErrorsNormalizer.php @@ -5,186 +5,92 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ErrorsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ErrorsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Errors::class; + return $type === \ShipStream\Ups\Api\Model\Errors::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Errors::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Errors::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Errors(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('description', $data)) { - $object->setDescription($data['description']); - unset($data['description']); - } - if (\array_key_exists('message', $data)) { - $object->setMessage($data['message']); - unset($data['message']); - } - if (\array_key_exists('value', $data)) { - $object->setValue($data['value']); - unset($data['value']); - } - if (\array_key_exists('field', $data)) { - $object->setField($data['field']); - unset($data['field']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\Errors(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('message') && null !== $object->getMessage()) { - $data['message'] = $object->getMessage(); - } - if ($object->isInitialized('value') && null !== $object->getValue()) { - $data['value'] = $object->getValue(); - } - if ($object->isInitialized('field') && null !== $object->getField()) { - $data['field'] = $object->getField(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('code', $data)) { + $object->setCode($data['code']); + unset($data['code']); + } + if (\array_key_exists('description', $data)) { + $object->setDescription($data['description']); + unset($data['description']); + } + if (\array_key_exists('message', $data)) { + $object->setMessage($data['message']); + unset($data['message']); + } + if (\array_key_exists('value', $data)) { + $object->setValue($data['value']); + unset($data['value']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Errors::class => false]; + if (\array_key_exists('field', $data)) { + $object->setField($data['field']); + unset($data['field']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ErrorsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Errors::class; + $dataArray = []; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['code'] = $data->getCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Errors::class; + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['description'] = $data->getDescription(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Errors(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('description', $data)) { - $object->setDescription($data['description']); - unset($data['description']); - } - if (\array_key_exists('message', $data)) { - $object->setMessage($data['message']); - unset($data['message']); - } - if (\array_key_exists('value', $data)) { - $object->setValue($data['value']); - unset($data['value']); - } - if (\array_key_exists('field', $data)) { - $object->setField($data['field']); - unset($data['field']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('message') && null !== $data->getMessage()) { + $dataArray['message'] = $data->getMessage(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('message') && null !== $object->getMessage()) { - $data['message'] = $object->getMessage(); - } - if ($object->isInitialized('value') && null !== $object->getValue()) { - $data['value'] = $object->getValue(); - } - if ($object->isInitialized('field') && null !== $object->getField()) { - $data['field'] = $object->getField(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('value') && null !== $data->getValue()) { + $dataArray['value'] = $data->getValue(); + } + if ($data->isInitialized('field') && null !== $data->getField()) { + $dataArray['field'] = $data->getField(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Errors::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Errors::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/EstimatedArrivalArrivalNormalizer.php b/src/Api/Normalizer/EstimatedArrivalArrivalNormalizer.php index e1e248f6..11813872 100644 --- a/src/Api/Normalizer/EstimatedArrivalArrivalNormalizer.php +++ b/src/Api/Normalizer/EstimatedArrivalArrivalNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class EstimatedArrivalArrivalNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class EstimatedArrivalArrivalNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class; + return $type === \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EstimatedArrivalArrival(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\EstimatedArrivalArrival(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Date'] = $object->getDate(); - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['Time'] = $object->getTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Date', $data)) { + $object->setDate($data['Date']); + unset($data['Date']); + } + if (\array_key_exists('Time', $data)) { + $object->setTime($data['Time']); + unset($data['Time']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class EstimatedArrivalArrivalNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class; + $dataArray = []; + $dataArray['Date'] = $data->getDate(); + if ($data->isInitialized('time') && null !== $data->getTime()) { + $dataArray['Time'] = $data->getTime(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EstimatedArrivalArrival(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Date'] = $object->getDate(); - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['Time'] = $object->getTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/EstimatedArrivalPickupNormalizer.php b/src/Api/Normalizer/EstimatedArrivalPickupNormalizer.php index 8cb0fe2f..1b22c3d9 100644 --- a/src/Api/Normalizer/EstimatedArrivalPickupNormalizer.php +++ b/src/Api/Normalizer/EstimatedArrivalPickupNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class EstimatedArrivalPickupNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class EstimatedArrivalPickupNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class; + return $type === \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EstimatedArrivalPickup(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\EstimatedArrivalPickup(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Date'] = $object->getDate(); - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['Time'] = $object->getTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Date', $data)) { + $object->setDate($data['Date']); + unset($data['Date']); + } + if (\array_key_exists('Time', $data)) { + $object->setTime($data['Time']); + unset($data['Time']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class EstimatedArrivalPickupNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class; + $dataArray = []; + $dataArray['Date'] = $data->getDate(); + if ($data->isInitialized('time') && null !== $data->getTime()) { + $dataArray['Time'] = $data->getTime(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\EstimatedArrivalPickup(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Date'] = $object->getDate(); - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['Time'] = $object->getTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ExceptionActivityLocationNormalizer.php b/src/Api/Normalizer/ExceptionActivityLocationNormalizer.php index 6630aefc..2c0e4e64 100644 --- a/src/Api/Normalizer/ExceptionActivityLocationNormalizer.php +++ b/src/Api/Normalizer/ExceptionActivityLocationNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ExceptionActivityLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ExceptionActivityLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class; + return $type === \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExceptionActivityLocation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressArtifactFormat', $data)) { - $object->setAddressArtifactFormat($this->denormalizer->denormalize($data['AddressArtifactFormat'], \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class, 'json', $context)); - unset($data['AddressArtifactFormat']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ExceptionActivityLocation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AddressArtifactFormat'] = $this->normalizer->normalize($object->getAddressArtifactFormat(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressArtifactFormat', $data)) { + $object->setAddressArtifactFormat($this->denormalizer->denormalize($data['AddressArtifactFormat'], \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class, 'json', $context)); + unset($data['AddressArtifactFormat']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExceptionActivityLocation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ExceptionActivityLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExceptionActivityLocation(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['AddressArtifactFormat'] = $this->normalizer->normalize($data->getAddressArtifactFormat(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('AddressArtifactFormat', $data)) { - $object->setAddressArtifactFormat($this->denormalizer->denormalize($data['AddressArtifactFormat'], \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class, 'json', $context)); - unset($data['AddressArtifactFormat']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AddressArtifactFormat'] = $this->normalizer->normalize($object->getAddressArtifactFormat(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExceptionActivityLocation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ExceptionActivityLocation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ExceptionBillToAccountNormalizer.php b/src/Api/Normalizer/ExceptionBillToAccountNormalizer.php index d6f0ad36..b0fd09ea 100644 --- a/src/Api/Normalizer/ExceptionBillToAccountNormalizer.php +++ b/src/Api/Normalizer/ExceptionBillToAccountNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ExceptionBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ExceptionBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class; + return $type === \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExceptionBillToAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ExceptionBillToAccount(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Option'] = $object->getOption(); - $data['Number'] = $object->getNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExceptionBillToAccount::class => false]; - } - } -} else { - class ExceptionBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class; + if (\array_key_exists('Option', $data)) { + $object->setOption($data['Option']); + unset($data['Option']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExceptionBillToAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Option'] = $object->getOption(); - $data['Number'] = $object->getNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Option'] = $data->getOption(); + $dataArray['Number'] = $data->getNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExceptionBillToAccount::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ExceptionBillToAccount::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ExceptionPackageReferenceNumberNormalizer.php b/src/Api/Normalizer/ExceptionPackageReferenceNumberNormalizer.php index 96cfd914..32c5be29 100644 --- a/src/Api/Normalizer/ExceptionPackageReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/ExceptionPackageReferenceNumberNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ExceptionPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ExceptionPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('BarCodeIndicator', $data)) { + $object->setBarCodeIndicator($data['BarCodeIndicator']); + unset($data['BarCodeIndicator']); + } + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class => false]; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ExceptionPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class; + $dataArray = []; + if ($data->isInitialized('barCodeIndicator') && null !== $data->getBarCodeIndicator()) { + $dataArray['BarCodeIndicator'] = $data->getBarCodeIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ExceptionResolutionNormalizer.php b/src/Api/Normalizer/ExceptionResolutionNormalizer.php index c0922c3f..5867f790 100644 --- a/src/Api/Normalizer/ExceptionResolutionNormalizer.php +++ b/src/Api/Normalizer/ExceptionResolutionNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ExceptionResolutionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ExceptionResolutionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExceptionResolution::class; + return $type === \ShipStream\Ups\Api\Model\ExceptionResolution::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionResolution::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionResolution::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExceptionResolution(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ExceptionResolution(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExceptionResolution::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ExceptionResolutionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExceptionResolution::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionResolution::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExceptionResolution(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExceptionResolution::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ExceptionResolution::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ExceptionShipmentReferenceNumberNormalizer.php b/src/Api/Normalizer/ExceptionShipmentReferenceNumberNormalizer.php index b7b5c007..d5f494eb 100644 --- a/src/Api/Normalizer/ExceptionShipmentReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/ExceptionShipmentReferenceNumberNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ExceptionShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ExceptionShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('BarCodeIndicator', $data)) { + $object->setBarCodeIndicator($data['BarCodeIndicator']); + unset($data['BarCodeIndicator']); + } + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class => false]; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ExceptionShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class; + $dataArray = []; + if ($data->isInitialized('barCodeIndicator') && null !== $data->getBarCodeIndicator()) { + $dataArray['BarCodeIndicator'] = $data->getBarCodeIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ExceptionUpdatedAddressNormalizer.php b/src/Api/Normalizer/ExceptionUpdatedAddressNormalizer.php index b06c86c6..2fea4c3e 100644 --- a/src/Api/Normalizer/ExceptionUpdatedAddressNormalizer.php +++ b/src/Api/Normalizer/ExceptionUpdatedAddressNormalizer.php @@ -5,300 +5,149 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ExceptionUpdatedAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ExceptionUpdatedAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class; + return $type === \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('StreetNumberLow', $data)) { - $object->setStreetNumberLow($data['StreetNumberLow']); - unset($data['StreetNumberLow']); - } - if (\array_key_exists('StreetPrefix', $data)) { - $object->setStreetPrefix($data['StreetPrefix']); - unset($data['StreetPrefix']); - } - if (\array_key_exists('StreetName', $data)) { - $object->setStreetName($data['StreetName']); - unset($data['StreetName']); - } - if (\array_key_exists('StreetType', $data)) { - $object->setStreetType($data['StreetType']); - unset($data['StreetType']); - } - if (\array_key_exists('StreetSuffix', $data)) { - $object->setStreetSuffix($data['StreetSuffix']); - unset($data['StreetSuffix']); - } - if (\array_key_exists('AddressExtendedInformation', $data)) { - $values = []; - foreach ($data['AddressExtendedInformation'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class, 'json', $context); - } - $object->setAddressExtendedInformation($values); - unset($data['AddressExtendedInformation']); - } - if (\array_key_exists('PoliticalDivision3', $data)) { - $object->setPoliticalDivision3($data['PoliticalDivision3']); - unset($data['PoliticalDivision3']); - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - if ($object->isInitialized('streetNumberLow') && null !== $object->getStreetNumberLow()) { - $data['StreetNumberLow'] = $object->getStreetNumberLow(); - } - if ($object->isInitialized('streetPrefix') && null !== $object->getStreetPrefix()) { - $data['StreetPrefix'] = $object->getStreetPrefix(); - } - if ($object->isInitialized('streetName') && null !== $object->getStreetName()) { - $data['StreetName'] = $object->getStreetName(); - } - if ($object->isInitialized('streetType') && null !== $object->getStreetType()) { - $data['StreetType'] = $object->getStreetType(); - } - if ($object->isInitialized('streetSuffix') && null !== $object->getStreetSuffix()) { - $data['StreetSuffix'] = $object->getStreetSuffix(); - } - if ($object->isInitialized('addressExtendedInformation') && null !== $object->getAddressExtendedInformation()) { - $values = []; - foreach ($object->getAddressExtendedInformation() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['AddressExtendedInformation'] = $values; - } - if ($object->isInitialized('politicalDivision3') && null !== $object->getPoliticalDivision3()) { - $data['PoliticalDivision3'] = $object->getPoliticalDivision3(); - } - if ($object->isInitialized('politicalDivision2') && null !== $object->getPoliticalDivision2()) { - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - } - if ($object->isInitialized('politicalDivision1') && null !== $object->getPoliticalDivision1()) { - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); - } - if ($object->isInitialized('postcodePrimaryLow') && null !== $object->getPostcodePrimaryLow()) { - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ConsigneeName', $data)) { + $object->setConsigneeName($data['ConsigneeName']); + unset($data['ConsigneeName']); + } + if (\array_key_exists('StreetNumberLow', $data)) { + $object->setStreetNumberLow($data['StreetNumberLow']); + unset($data['StreetNumberLow']); + } + if (\array_key_exists('StreetPrefix', $data)) { + $object->setStreetPrefix($data['StreetPrefix']); + unset($data['StreetPrefix']); + } + if (\array_key_exists('StreetName', $data)) { + $object->setStreetName($data['StreetName']); + unset($data['StreetName']); + } + if (\array_key_exists('StreetType', $data)) { + $object->setStreetType($data['StreetType']); + unset($data['StreetType']); + } + if (\array_key_exists('StreetSuffix', $data)) { + $object->setStreetSuffix($data['StreetSuffix']); + unset($data['StreetSuffix']); + } + if (\array_key_exists('AddressExtendedInformation', $data)) { + $values = []; + foreach ($data['AddressExtendedInformation'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class, 'json', $context); } - return $data; + $object->setAddressExtendedInformation($values); + unset($data['AddressExtendedInformation']); + } + if (\array_key_exists('PoliticalDivision3', $data)) { + $object->setPoliticalDivision3($data['PoliticalDivision3']); + unset($data['PoliticalDivision3']); + } + if (\array_key_exists('PoliticalDivision2', $data)) { + $object->setPoliticalDivision2($data['PoliticalDivision2']); + unset($data['PoliticalDivision2']); + } + if (\array_key_exists('PoliticalDivision1', $data)) { + $object->setPoliticalDivision1($data['PoliticalDivision1']); + unset($data['PoliticalDivision1']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class => false]; + if (\array_key_exists('PostcodePrimaryLow', $data)) { + $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); + unset($data['PostcodePrimaryLow']); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class ExceptionUpdatedAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class; + $dataArray = []; + if ($data->isInitialized('consigneeName') && null !== $data->getConsigneeName()) { + $dataArray['ConsigneeName'] = $data->getConsigneeName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class; + if ($data->isInitialized('streetNumberLow') && null !== $data->getStreetNumberLow()) { + $dataArray['StreetNumberLow'] = $data->getStreetNumberLow(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('StreetNumberLow', $data)) { - $object->setStreetNumberLow($data['StreetNumberLow']); - unset($data['StreetNumberLow']); - } - if (\array_key_exists('StreetPrefix', $data)) { - $object->setStreetPrefix($data['StreetPrefix']); - unset($data['StreetPrefix']); - } - if (\array_key_exists('StreetName', $data)) { - $object->setStreetName($data['StreetName']); - unset($data['StreetName']); - } - if (\array_key_exists('StreetType', $data)) { - $object->setStreetType($data['StreetType']); - unset($data['StreetType']); - } - if (\array_key_exists('StreetSuffix', $data)) { - $object->setStreetSuffix($data['StreetSuffix']); - unset($data['StreetSuffix']); - } - if (\array_key_exists('AddressExtendedInformation', $data)) { - $values = []; - foreach ($data['AddressExtendedInformation'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class, 'json', $context); - } - $object->setAddressExtendedInformation($values); - unset($data['AddressExtendedInformation']); - } - if (\array_key_exists('PoliticalDivision3', $data)) { - $object->setPoliticalDivision3($data['PoliticalDivision3']); - unset($data['PoliticalDivision3']); - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('streetPrefix') && null !== $data->getStreetPrefix()) { + $dataArray['StreetPrefix'] = $data->getStreetPrefix(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - if ($object->isInitialized('streetNumberLow') && null !== $object->getStreetNumberLow()) { - $data['StreetNumberLow'] = $object->getStreetNumberLow(); - } - if ($object->isInitialized('streetPrefix') && null !== $object->getStreetPrefix()) { - $data['StreetPrefix'] = $object->getStreetPrefix(); - } - if ($object->isInitialized('streetName') && null !== $object->getStreetName()) { - $data['StreetName'] = $object->getStreetName(); - } - if ($object->isInitialized('streetType') && null !== $object->getStreetType()) { - $data['StreetType'] = $object->getStreetType(); - } - if ($object->isInitialized('streetSuffix') && null !== $object->getStreetSuffix()) { - $data['StreetSuffix'] = $object->getStreetSuffix(); - } - if ($object->isInitialized('addressExtendedInformation') && null !== $object->getAddressExtendedInformation()) { - $values = []; - foreach ($object->getAddressExtendedInformation() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['AddressExtendedInformation'] = $values; - } - if ($object->isInitialized('politicalDivision3') && null !== $object->getPoliticalDivision3()) { - $data['PoliticalDivision3'] = $object->getPoliticalDivision3(); - } - if ($object->isInitialized('politicalDivision2') && null !== $object->getPoliticalDivision2()) { - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - } - if ($object->isInitialized('politicalDivision1') && null !== $object->getPoliticalDivision1()) { - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); - } - if ($object->isInitialized('postcodePrimaryLow') && null !== $object->getPostcodePrimaryLow()) { - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if ($data->isInitialized('streetName') && null !== $data->getStreetName()) { + $dataArray['StreetName'] = $data->getStreetName(); + } + if ($data->isInitialized('streetType') && null !== $data->getStreetType()) { + $dataArray['StreetType'] = $data->getStreetType(); + } + if ($data->isInitialized('streetSuffix') && null !== $data->getStreetSuffix()) { + $dataArray['StreetSuffix'] = $data->getStreetSuffix(); + } + if ($data->isInitialized('addressExtendedInformation') && null !== $data->getAddressExtendedInformation()) { + $values = []; + foreach ($data->getAddressExtendedInformation() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $data; + $dataArray['AddressExtendedInformation'] = $values; + } + if ($data->isInitialized('politicalDivision3') && null !== $data->getPoliticalDivision3()) { + $dataArray['PoliticalDivision3'] = $data->getPoliticalDivision3(); + } + if ($data->isInitialized('politicalDivision2') && null !== $data->getPoliticalDivision2()) { + $dataArray['PoliticalDivision2'] = $data->getPoliticalDivision2(); + } + if ($data->isInitialized('politicalDivision1') && null !== $data->getPoliticalDivision1()) { + $dataArray['PoliticalDivision1'] = $data->getPoliticalDivision1(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class => false]; + if ($data->isInitialized('countryCode') && null !== $data->getCountryCode()) { + $dataArray['CountryCode'] = $data->getCountryCode(); } + if ($data->isInitialized('postcodePrimaryLow') && null !== $data->getPostcodePrimaryLow()) { + $dataArray['PostcodePrimaryLow'] = $data->getPostcodePrimaryLow(); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ExcludeFromResultPostalCodeListNormalizer.php b/src/Api/Normalizer/ExcludeFromResultPostalCodeListNormalizer.php index 3f462fa4..348cc48a 100644 --- a/src/Api/Normalizer/ExcludeFromResultPostalCodeListNormalizer.php +++ b/src/Api/Normalizer/ExcludeFromResultPostalCodeListNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ExcludeFromResultPostalCodeListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ExcludeFromResultPostalCodeListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class; + return $type === \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PostalCode', $data)) { - $values = []; - foreach ($data['PostalCode'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class, 'json', $context); - } - $object->setPostalCode($values); - unset($data['PostalCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('PostalCode', $data)) { $values = []; - foreach ($object->getPostalCode() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['PostalCode'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class, 'json', $context); } - $data['PostalCode'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setPostalCode($values); + unset($data['PostalCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class ExcludeFromResultPostalCodeListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class; + $dataArray = []; + $values = []; + foreach ($data->getPostalCode() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['PostalCode'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PostalCode', $data)) { - $values = []; - foreach ($data['PostalCode'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class, 'json', $context); - } - $object->setPostalCode($values); - unset($data['PostalCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getPostalCode() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PostalCode'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ExistingShipmentIDConfirmationNumberNormalizer.php b/src/Api/Normalizer/ExistingShipmentIDConfirmationNumberNormalizer.php index 8d9be9c7..8d9e7514 100644 --- a/src/Api/Normalizer/ExistingShipmentIDConfirmationNumberNormalizer.php +++ b/src/Api/Normalizer/ExistingShipmentIDConfirmationNumberNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ExistingShipmentIDConfirmationNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ExistingShipmentIDConfirmationNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class; + return $type === \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\ConfirmationNumberType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class => false]; - } - } -} else { - class ExistingShipmentIDConfirmationNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\ConfirmationNumberType::class, 'json', $context)); + unset($data['Type']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\ConfirmationNumberType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FREIGHTPICKUPCANCELRequestWrapperNormalizer.php b/src/Api/Normalizer/FREIGHTPICKUPCANCELRequestWrapperNormalizer.php index bea0c0e0..d295486b 100644 --- a/src/Api/Normalizer/FREIGHTPICKUPCANCELRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/FREIGHTPICKUPCANCELRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FREIGHTPICKUPCANCELRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FREIGHTPICKUPCANCELRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightCancelPickupRequest', $data)) { - $object->setFreightCancelPickupRequest($this->denormalizer->denormalize($data['FreightCancelPickupRequest'], \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class, 'json', $context)); - unset($data['FreightCancelPickupRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['FreightCancelPickupRequest'] = $this->normalizer->normalize($object->getFreightCancelPickupRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('FreightCancelPickupRequest', $data)) { + $object->setFreightCancelPickupRequest($this->denormalizer->denormalize($data['FreightCancelPickupRequest'], \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class, 'json', $context)); + unset($data['FreightCancelPickupRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FREIGHTPICKUPCANCELRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['FreightCancelPickupRequest'] = $this->normalizer->normalize($data->getFreightCancelPickupRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('FreightCancelPickupRequest', $data)) { - $object->setFreightCancelPickupRequest($this->denormalizer->denormalize($data['FreightCancelPickupRequest'], \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class, 'json', $context)); - unset($data['FreightCancelPickupRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['FreightCancelPickupRequest'] = $this->normalizer->normalize($object->getFreightCancelPickupRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FREIGHTPICKUPCANCELResponseWrapperNormalizer.php b/src/Api/Normalizer/FREIGHTPICKUPCANCELResponseWrapperNormalizer.php index 1c1b0f2c..606e1ce3 100644 --- a/src/Api/Normalizer/FREIGHTPICKUPCANCELResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/FREIGHTPICKUPCANCELResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FREIGHTPICKUPCANCELResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FREIGHTPICKUPCANCELResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightCancelPickupResponse', $data)) { - $object->setFreightCancelPickupResponse($this->denormalizer->denormalize($data['FreightCancelPickupResponse'], \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class, 'json', $context)); - unset($data['FreightCancelPickupResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['FreightCancelPickupResponse'] = $this->normalizer->normalize($object->getFreightCancelPickupResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('FreightCancelPickupResponse', $data)) { + $object->setFreightCancelPickupResponse($this->denormalizer->denormalize($data['FreightCancelPickupResponse'], \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class, 'json', $context)); + unset($data['FreightCancelPickupResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FREIGHTPICKUPCANCELResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['FreightCancelPickupResponse'] = $this->normalizer->normalize($data->getFreightCancelPickupResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('FreightCancelPickupResponse', $data)) { - $object->setFreightCancelPickupResponse($this->denormalizer->denormalize($data['FreightCancelPickupResponse'], \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class, 'json', $context)); - unset($data['FreightCancelPickupResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['FreightCancelPickupResponse'] = $this->normalizer->normalize($object->getFreightCancelPickupResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FREIGHTPICKUPRequestWrapperNormalizer.php b/src/Api/Normalizer/FREIGHTPICKUPRequestWrapperNormalizer.php index 3d9806e1..babba751 100644 --- a/src/Api/Normalizer/FREIGHTPICKUPRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/FREIGHTPICKUPRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FREIGHTPICKUPRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FREIGHTPICKUPRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightPickupRequest', $data)) { - $object->setFreightPickupRequest($this->denormalizer->denormalize($data['FreightPickupRequest'], \ShipStream\Ups\Api\Model\FreightPickupRequest::class, 'json', $context)); - unset($data['FreightPickupRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['FreightPickupRequest'] = $this->normalizer->normalize($object->getFreightPickupRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('FreightPickupRequest', $data)) { + $object->setFreightPickupRequest($this->denormalizer->denormalize($data['FreightPickupRequest'], \ShipStream\Ups\Api\Model\FreightPickupRequest::class, 'json', $context)); + unset($data['FreightPickupRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FREIGHTPICKUPRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['FreightPickupRequest'] = $this->normalizer->normalize($data->getFreightPickupRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('FreightPickupRequest', $data)) { - $object->setFreightPickupRequest($this->denormalizer->denormalize($data['FreightPickupRequest'], \ShipStream\Ups\Api\Model\FreightPickupRequest::class, 'json', $context)); - unset($data['FreightPickupRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['FreightPickupRequest'] = $this->normalizer->normalize($object->getFreightPickupRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FREIGHTPICKUPResponseWrapperNormalizer.php b/src/Api/Normalizer/FREIGHTPICKUPResponseWrapperNormalizer.php index afe924ed..d6cee824 100644 --- a/src/Api/Normalizer/FREIGHTPICKUPResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/FREIGHTPICKUPResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FREIGHTPICKUPResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FREIGHTPICKUPResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightPickupResponse', $data)) { - $object->setFreightPickupResponse($this->denormalizer->denormalize($data['FreightPickupResponse'], \ShipStream\Ups\Api\Model\FreightPickupResponse::class, 'json', $context)); - unset($data['FreightPickupResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['FreightPickupResponse'] = $this->normalizer->normalize($object->getFreightPickupResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('FreightPickupResponse', $data)) { + $object->setFreightPickupResponse($this->denormalizer->denormalize($data['FreightPickupResponse'], \ShipStream\Ups\Api\Model\FreightPickupResponse::class, 'json', $context)); + unset($data['FreightPickupResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FREIGHTPICKUPResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['FreightPickupResponse'] = $this->normalizer->normalize($data->getFreightPickupResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('FreightPickupResponse', $data)) { - $object->setFreightPickupResponse($this->denormalizer->denormalize($data['FreightPickupResponse'], \ShipStream\Ups\Api\Model\FreightPickupResponse::class, 'json', $context)); - unset($data['FreightPickupResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['FreightPickupResponse'] = $this->normalizer->normalize($object->getFreightPickupResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FREIGHTRATERequestWrapperNormalizer.php b/src/Api/Normalizer/FREIGHTRATERequestWrapperNormalizer.php index 67c3e313..add9ceaa 100644 --- a/src/Api/Normalizer/FREIGHTRATERequestWrapperNormalizer.php +++ b/src/Api/Normalizer/FREIGHTRATERequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FREIGHTRATERequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FREIGHTRATERequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightRateRequest', $data)) { - $object->setFreightRateRequest($this->denormalizer->denormalize($data['FreightRateRequest'], \ShipStream\Ups\Api\Model\FreightRateRequest::class, 'json', $context)); - unset($data['FreightRateRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['FreightRateRequest'] = $this->normalizer->normalize($object->getFreightRateRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('FreightRateRequest', $data)) { + $object->setFreightRateRequest($this->denormalizer->denormalize($data['FreightRateRequest'], \ShipStream\Ups\Api\Model\FreightRateRequest::class, 'json', $context)); + unset($data['FreightRateRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FREIGHTRATERequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['FreightRateRequest'] = $this->normalizer->normalize($data->getFreightRateRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('FreightRateRequest', $data)) { - $object->setFreightRateRequest($this->denormalizer->denormalize($data['FreightRateRequest'], \ShipStream\Ups\Api\Model\FreightRateRequest::class, 'json', $context)); - unset($data['FreightRateRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['FreightRateRequest'] = $this->normalizer->normalize($object->getFreightRateRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FREIGHTRATEResponseWrapperNormalizer.php b/src/Api/Normalizer/FREIGHTRATEResponseWrapperNormalizer.php index d332cdef..9b4d8986 100644 --- a/src/Api/Normalizer/FREIGHTRATEResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/FREIGHTRATEResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FREIGHTRATEResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FREIGHTRATEResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightRateResponse', $data)) { - $object->setFreightRateResponse($this->denormalizer->denormalize($data['FreightRateResponse'], \ShipStream\Ups\Api\Model\FreightRateResponse::class, 'json', $context)); - unset($data['FreightRateResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['FreightRateResponse'] = $this->normalizer->normalize($object->getFreightRateResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('FreightRateResponse', $data)) { + $object->setFreightRateResponse($this->denormalizer->denormalize($data['FreightRateResponse'], \ShipStream\Ups\Api\Model\FreightRateResponse::class, 'json', $context)); + unset($data['FreightRateResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FREIGHTRATEResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['FreightRateResponse'] = $this->normalizer->normalize($data->getFreightRateResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('FreightRateResponse', $data)) { - $object->setFreightRateResponse($this->denormalizer->denormalize($data['FreightRateResponse'], \ShipStream\Ups\Api\Model\FreightRateResponse::class, 'json', $context)); - unset($data['FreightRateResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['FreightRateResponse'] = $this->normalizer->normalize($object->getFreightRateResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FREIGHTSHIPRequestWrapperNormalizer.php b/src/Api/Normalizer/FREIGHTSHIPRequestWrapperNormalizer.php index 2c978189..9ce569e9 100644 --- a/src/Api/Normalizer/FREIGHTSHIPRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/FREIGHTSHIPRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FREIGHTSHIPRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FREIGHTSHIPRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightShipRequest', $data)) { - $object->setFreightShipRequest($this->denormalizer->denormalize($data['FreightShipRequest'], \ShipStream\Ups\Api\Model\FreightShipRequest::class, 'json', $context)); - unset($data['FreightShipRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['FreightShipRequest'] = $this->normalizer->normalize($object->getFreightShipRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('FreightShipRequest', $data)) { + $object->setFreightShipRequest($this->denormalizer->denormalize($data['FreightShipRequest'], \ShipStream\Ups\Api\Model\FreightShipRequest::class, 'json', $context)); + unset($data['FreightShipRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FREIGHTSHIPRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['FreightShipRequest'] = $this->normalizer->normalize($data->getFreightShipRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('FreightShipRequest', $data)) { - $object->setFreightShipRequest($this->denormalizer->denormalize($data['FreightShipRequest'], \ShipStream\Ups\Api\Model\FreightShipRequest::class, 'json', $context)); - unset($data['FreightShipRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['FreightShipRequest'] = $this->normalizer->normalize($object->getFreightShipRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FREIGHTSHIPResponseWrapperNormalizer.php b/src/Api/Normalizer/FREIGHTSHIPResponseWrapperNormalizer.php index 47323a7b..8ba3f547 100644 --- a/src/Api/Normalizer/FREIGHTSHIPResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/FREIGHTSHIPResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FREIGHTSHIPResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FREIGHTSHIPResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightShipResponse', $data)) { - $object->setFreightShipResponse($this->denormalizer->denormalize($data['FreightShipResponse'], \ShipStream\Ups\Api\Model\FreightShipResponse::class, 'json', $context)); - unset($data['FreightShipResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['FreightShipResponse'] = $this->normalizer->normalize($object->getFreightShipResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('FreightShipResponse', $data)) { + $object->setFreightShipResponse($this->denormalizer->denormalize($data['FreightShipResponse'], \ShipStream\Ups\Api\Model\FreightShipResponse::class, 'json', $context)); + unset($data['FreightShipResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FREIGHTSHIPResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['FreightShipResponse'] = $this->normalizer->normalize($data->getFreightShipResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('FreightShipResponse', $data)) { - $object->setFreightShipResponse($this->denormalizer->denormalize($data['FreightShipResponse'], \ShipStream\Ups\Api\Model\FreightShipResponse::class, 'json', $context)); - unset($data['FreightShipResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['FreightShipResponse'] = $this->normalizer->normalize($object->getFreightShipResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FRSPaymentInformationAddressNormalizer.php b/src/Api/Normalizer/FRSPaymentInformationAddressNormalizer.php index 9814fadb..784c193a 100644 --- a/src/Api/Normalizer/FRSPaymentInformationAddressNormalizer.php +++ b/src/Api/Normalizer/FRSPaymentInformationAddressNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FRSPaymentInformationAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FRSPaymentInformationAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class; + return $type === \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FRSPaymentInformationAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class; + $dataArray = []; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FRSPaymentInformationTypeNormalizer.php b/src/Api/Normalizer/FRSPaymentInformationTypeNormalizer.php index fa4cfe81..7d3014be 100644 --- a/src/Api/Normalizer/FRSPaymentInformationTypeNormalizer.php +++ b/src/Api/Normalizer/FRSPaymentInformationTypeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FRSPaymentInformationTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FRSPaymentInformationTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class; + return $type === \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FRSPaymentInformationType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FRSPaymentInformationType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FRSPaymentInformationType::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FRSPaymentInformationTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FRSPaymentInformationType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FRSPaymentInformationType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FRSPaymentInformationType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FRSShipmentDataFreightDensityRateNormalizer.php b/src/Api/Normalizer/FRSShipmentDataFreightDensityRateNormalizer.php index d1a13380..7f282d36 100644 --- a/src/Api/Normalizer/FRSShipmentDataFreightDensityRateNormalizer.php +++ b/src/Api/Normalizer/FRSShipmentDataFreightDensityRateNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FRSShipmentDataFreightDensityRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FRSShipmentDataFreightDensityRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class; + return $type === \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Density', $data)) { - $object->setDensity($data['Density']); - unset($data['Density']); - } - if (\array_key_exists('TotalCubicFeet', $data)) { - $object->setTotalCubicFeet($data['TotalCubicFeet']); - unset($data['TotalCubicFeet']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Density'] = $object->getDensity(); - $data['TotalCubicFeet'] = $object->getTotalCubicFeet(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class => false]; - } - } -} else { - class FRSShipmentDataFreightDensityRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class; + if (\array_key_exists('Density', $data)) { + $object->setDensity($data['Density']); + unset($data['Density']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class; + if (\array_key_exists('TotalCubicFeet', $data)) { + $object->setTotalCubicFeet($data['TotalCubicFeet']); + unset($data['TotalCubicFeet']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Density', $data)) { - $object->setDensity($data['Density']); - unset($data['Density']); - } - if (\array_key_exists('TotalCubicFeet', $data)) { - $object->setTotalCubicFeet($data['TotalCubicFeet']); - unset($data['TotalCubicFeet']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Density'] = $object->getDensity(); - $data['TotalCubicFeet'] = $object->getTotalCubicFeet(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Density'] = $data->getDensity(); + $dataArray['TotalCubicFeet'] = $data->getTotalCubicFeet(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FRSShipmentDataHandlingUnitsNormalizer.php b/src/Api/Normalizer/FRSShipmentDataHandlingUnitsNormalizer.php index 57c4e228..cc8bcc9b 100644 --- a/src/Api/Normalizer/FRSShipmentDataHandlingUnitsNormalizer.php +++ b/src/Api/Normalizer/FRSShipmentDataHandlingUnitsNormalizer.php @@ -5,160 +5,79 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FRSShipmentDataHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FRSShipmentDataHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class; + return $type === \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('AdjustedHeight', $data)) { - $object->setAdjustedHeight($this->denormalizer->denormalize($data['AdjustedHeight'], \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class, 'json', $context)); - unset($data['AdjustedHeight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - if ($object->isInitialized('adjustedHeight') && null !== $object->getAdjustedHeight()) { - $data['AdjustedHeight'] = $this->normalizer->normalize($object->getAdjustedHeight(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class => false]; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); + unset($data['Type']); } - } -} else { - class FRSShipmentDataHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class; + if (\array_key_exists('Dimensions', $data)) { + $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); + unset($data['Dimensions']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class; + if (\array_key_exists('AdjustedHeight', $data)) { + $object->setAdjustedHeight($this->denormalizer->denormalize($data['AdjustedHeight'], \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class, 'json', $context)); + unset($data['AdjustedHeight']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('AdjustedHeight', $data)) { - $object->setAdjustedHeight($this->denormalizer->denormalize($data['AdjustedHeight'], \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class, 'json', $context)); - unset($data['AdjustedHeight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - if ($object->isInitialized('adjustedHeight') && null !== $object->getAdjustedHeight()) { - $data['AdjustedHeight'] = $this->normalizer->normalize($object->getAdjustedHeight(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Quantity'] = $data->getQuantity(); + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + $dataArray['Dimensions'] = $this->normalizer->normalize($data->getDimensions(), 'json', $context); + if ($data->isInitialized('adjustedHeight') && null !== $data->getAdjustedHeight()) { + $dataArray['AdjustedHeight'] = $this->normalizer->normalize($data->getAdjustedHeight(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FRSShipmentDataTransportationChargesNormalizer.php b/src/Api/Normalizer/FRSShipmentDataTransportationChargesNormalizer.php index a53cf554..ed966a8d 100644 --- a/src/Api/Normalizer/FRSShipmentDataTransportationChargesNormalizer.php +++ b/src/Api/Normalizer/FRSShipmentDataTransportationChargesNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FRSShipmentDataTransportationChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FRSShipmentDataTransportationChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class; + return $type === \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('GrossCharge', $data)) { - $object->setGrossCharge($this->denormalizer->denormalize($data['GrossCharge'], \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class, 'json', $context)); - unset($data['GrossCharge']); - } - if (\array_key_exists('DiscountAmount', $data)) { - $object->setDiscountAmount($this->denormalizer->denormalize($data['DiscountAmount'], \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class, 'json', $context)); - unset($data['DiscountAmount']); - } - if (\array_key_exists('DiscountPercentage', $data)) { - $object->setDiscountPercentage($data['DiscountPercentage']); - unset($data['DiscountPercentage']); - } - if (\array_key_exists('NetCharge', $data)) { - $object->setNetCharge($this->denormalizer->denormalize($data['NetCharge'], \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class, 'json', $context)); - unset($data['NetCharge']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['GrossCharge'] = $this->normalizer->normalize($object->getGrossCharge(), 'json', $context); - $data['DiscountAmount'] = $this->normalizer->normalize($object->getDiscountAmount(), 'json', $context); - $data['DiscountPercentage'] = $object->getDiscountPercentage(); - $data['NetCharge'] = $this->normalizer->normalize($object->getNetCharge(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('GrossCharge', $data)) { + $object->setGrossCharge($this->denormalizer->denormalize($data['GrossCharge'], \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class, 'json', $context)); + unset($data['GrossCharge']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class => false]; + if (\array_key_exists('DiscountAmount', $data)) { + $object->setDiscountAmount($this->denormalizer->denormalize($data['DiscountAmount'], \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class, 'json', $context)); + unset($data['DiscountAmount']); } - } -} else { - class FRSShipmentDataTransportationChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class; + if (\array_key_exists('DiscountPercentage', $data)) { + $object->setDiscountPercentage($data['DiscountPercentage']); + unset($data['DiscountPercentage']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class; + if (\array_key_exists('NetCharge', $data)) { + $object->setNetCharge($this->denormalizer->denormalize($data['NetCharge'], \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class, 'json', $context)); + unset($data['NetCharge']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('GrossCharge', $data)) { - $object->setGrossCharge($this->denormalizer->denormalize($data['GrossCharge'], \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class, 'json', $context)); - unset($data['GrossCharge']); - } - if (\array_key_exists('DiscountAmount', $data)) { - $object->setDiscountAmount($this->denormalizer->denormalize($data['DiscountAmount'], \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class, 'json', $context)); - unset($data['DiscountAmount']); - } - if (\array_key_exists('DiscountPercentage', $data)) { - $object->setDiscountPercentage($data['DiscountPercentage']); - unset($data['DiscountPercentage']); - } - if (\array_key_exists('NetCharge', $data)) { - $object->setNetCharge($this->denormalizer->denormalize($data['NetCharge'], \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class, 'json', $context)); - unset($data['NetCharge']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['GrossCharge'] = $this->normalizer->normalize($object->getGrossCharge(), 'json', $context); - $data['DiscountAmount'] = $this->normalizer->normalize($object->getDiscountAmount(), 'json', $context); - $data['DiscountPercentage'] = $object->getDiscountPercentage(); - $data['NetCharge'] = $this->normalizer->normalize($object->getNetCharge(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['GrossCharge'] = $this->normalizer->normalize($data->getGrossCharge(), 'json', $context); + $dataArray['DiscountAmount'] = $this->normalizer->normalize($data->getDiscountAmount(), 'json', $context); + $dataArray['DiscountPercentage'] = $data->getDiscountPercentage(); + $dataArray['NetCharge'] = $this->normalizer->normalize($data->getNetCharge(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FacilityTimeDayOfWeekNormalizer.php b/src/Api/Normalizer/FacilityTimeDayOfWeekNormalizer.php index e916265e..a4c16899 100644 --- a/src/Api/Normalizer/FacilityTimeDayOfWeekNormalizer.php +++ b/src/Api/Normalizer/FacilityTimeDayOfWeekNormalizer.php @@ -5,202 +5,100 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FacilityTimeDayOfWeekNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FacilityTimeDayOfWeekNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Day', $data)) { - $object->setDay($data['Day']); - unset($data['Day']); - } - if (\array_key_exists('EarliestDropOfforPickup', $data)) { - $object->setEarliestDropOfforPickup($data['EarliestDropOfforPickup']); - unset($data['EarliestDropOfforPickup']); - } - if (\array_key_exists('LatestDropOfforPickup', $data)) { - $object->setLatestDropOfforPickup($data['LatestDropOfforPickup']); - unset($data['LatestDropOfforPickup']); - } - if (\array_key_exists('OpenHours', $data)) { - $object->setOpenHours($data['OpenHours']); - unset($data['OpenHours']); - } - if (\array_key_exists('CloseHours', $data)) { - $object->setCloseHours($data['CloseHours']); - unset($data['CloseHours']); - } - if (\array_key_exists('PrepTime', $data)) { - $object->setPrepTime($data['PrepTime']); - unset($data['PrepTime']); - } - if (\array_key_exists('LastDrop', $data)) { - $object->setLastDrop($data['LastDrop']); - unset($data['LastDrop']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Day'] = $object->getDay(); - if ($object->isInitialized('earliestDropOfforPickup') && null !== $object->getEarliestDropOfforPickup()) { - $data['EarliestDropOfforPickup'] = $object->getEarliestDropOfforPickup(); - } - if ($object->isInitialized('latestDropOfforPickup') && null !== $object->getLatestDropOfforPickup()) { - $data['LatestDropOfforPickup'] = $object->getLatestDropOfforPickup(); - } - $data['OpenHours'] = $object->getOpenHours(); - $data['CloseHours'] = $object->getCloseHours(); - if ($object->isInitialized('prepTime') && null !== $object->getPrepTime()) { - $data['PrepTime'] = $object->getPrepTime(); - } - if ($object->isInitialized('lastDrop') && null !== $object->getLastDrop()) { - $data['LastDrop'] = $object->getLastDrop(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Day', $data)) { + $object->setDay($data['Day']); + unset($data['Day']); + } + if (\array_key_exists('EarliestDropOfforPickup', $data)) { + $object->setEarliestDropOfforPickup($data['EarliestDropOfforPickup']); + unset($data['EarliestDropOfforPickup']); + } + if (\array_key_exists('LatestDropOfforPickup', $data)) { + $object->setLatestDropOfforPickup($data['LatestDropOfforPickup']); + unset($data['LatestDropOfforPickup']); + } + if (\array_key_exists('OpenHours', $data)) { + $object->setOpenHours($data['OpenHours']); + unset($data['OpenHours']); + } + if (\array_key_exists('CloseHours', $data)) { + $object->setCloseHours($data['CloseHours']); + unset($data['CloseHours']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class => false]; + if (\array_key_exists('PrepTime', $data)) { + $object->setPrepTime($data['PrepTime']); + unset($data['PrepTime']); } + if (\array_key_exists('LastDrop', $data)) { + $object->setLastDrop($data['LastDrop']); + unset($data['LastDrop']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FacilityTimeDayOfWeekNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Day', $data)) { - $object->setDay($data['Day']); - unset($data['Day']); - } - if (\array_key_exists('EarliestDropOfforPickup', $data)) { - $object->setEarliestDropOfforPickup($data['EarliestDropOfforPickup']); - unset($data['EarliestDropOfforPickup']); - } - if (\array_key_exists('LatestDropOfforPickup', $data)) { - $object->setLatestDropOfforPickup($data['LatestDropOfforPickup']); - unset($data['LatestDropOfforPickup']); - } - if (\array_key_exists('OpenHours', $data)) { - $object->setOpenHours($data['OpenHours']); - unset($data['OpenHours']); - } - if (\array_key_exists('CloseHours', $data)) { - $object->setCloseHours($data['CloseHours']); - unset($data['CloseHours']); - } - if (\array_key_exists('PrepTime', $data)) { - $object->setPrepTime($data['PrepTime']); - unset($data['PrepTime']); - } - if (\array_key_exists('LastDrop', $data)) { - $object->setLastDrop($data['LastDrop']); - unset($data['LastDrop']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Day'] = $data->getDay(); + if ($data->isInitialized('earliestDropOfforPickup') && null !== $data->getEarliestDropOfforPickup()) { + $dataArray['EarliestDropOfforPickup'] = $data->getEarliestDropOfforPickup(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Day'] = $object->getDay(); - if ($object->isInitialized('earliestDropOfforPickup') && null !== $object->getEarliestDropOfforPickup()) { - $data['EarliestDropOfforPickup'] = $object->getEarliestDropOfforPickup(); - } - if ($object->isInitialized('latestDropOfforPickup') && null !== $object->getLatestDropOfforPickup()) { - $data['LatestDropOfforPickup'] = $object->getLatestDropOfforPickup(); - } - $data['OpenHours'] = $object->getOpenHours(); - $data['CloseHours'] = $object->getCloseHours(); - if ($object->isInitialized('prepTime') && null !== $object->getPrepTime()) { - $data['PrepTime'] = $object->getPrepTime(); - } - if ($object->isInitialized('lastDrop') && null !== $object->getLastDrop()) { - $data['LastDrop'] = $object->getLastDrop(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('latestDropOfforPickup') && null !== $data->getLatestDropOfforPickup()) { + $dataArray['LatestDropOfforPickup'] = $data->getLatestDropOfforPickup(); + } + $dataArray['OpenHours'] = $data->getOpenHours(); + $dataArray['CloseHours'] = $data->getCloseHours(); + if ($data->isInitialized('prepTime') && null !== $data->getPrepTime()) { + $dataArray['PrepTime'] = $data->getPrepTime(); + } + if ($data->isInitialized('lastDrop') && null !== $data->getLastDrop()) { + $dataArray['LastDrop'] = $data->getLastDrop(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FactorUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/FactorUnitOfMeasurementNormalizer.php index d5917e76..e795aa76 100644 --- a/src/Api/Normalizer/FactorUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/FactorUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FactorUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FactorUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FactorUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FailureNotificationFailureNotificationCodeNormalizer.php b/src/Api/Normalizer/FailureNotificationFailureNotificationCodeNormalizer.php index d93c3f0c..0cdddc36 100644 --- a/src/Api/Normalizer/FailureNotificationFailureNotificationCodeNormalizer.php +++ b/src/Api/Normalizer/FailureNotificationFailureNotificationCodeNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FailureNotificationFailureNotificationCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FailureNotificationFailureNotificationCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class; + return $type === \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FailureNotificationFailureNotificationCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class; + $dataArray = []; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FormImageNormalizer.php b/src/Api/Normalizer/FormImageNormalizer.php index c661038e..57f28a8b 100644 --- a/src/Api/Normalizer/FormImageNormalizer.php +++ b/src/Api/Normalizer/FormImageNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FormImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FormImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FormImage::class; + return $type === \ShipStream\Ups\Api\Model\FormImage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FormImage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FormImage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FormImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FormImage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FormImage::class => false]; - } - } -} else { - class FormImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FormImage::class; + if (\array_key_exists('ImageFormat', $data)) { + $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ImageImageFormat::class, 'json', $context)); + unset($data['ImageFormat']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FormImage::class; + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FormImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ImageFormat'] = $this->normalizer->normalize($data->getImageFormat(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FormImage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FormImage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FormsFormatNormalizer.php b/src/Api/Normalizer/FormsFormatNormalizer.php index 4c1d32cf..5b4d80ae 100644 --- a/src/Api/Normalizer/FormsFormatNormalizer.php +++ b/src/Api/Normalizer/FormsFormatNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FormsFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FormsFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FormsFormat::class; + return $type === \ShipStream\Ups\Api\Model\FormsFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FormsFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FormsFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FormsFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FormsFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FormsFormat::class => false]; - } - } -} else { - class FormsFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FormsFormat::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FormsFormat::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FormsFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FormsFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FormsFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FormsTypeNormalizer.php b/src/Api/Normalizer/FormsTypeNormalizer.php index 66b1f8bd..e8c31c1f 100644 --- a/src/Api/Normalizer/FormsTypeNormalizer.php +++ b/src/Api/Normalizer/FormsTypeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FormsTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FormsTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FormsType::class; + return $type === \ShipStream\Ups\Api\Model\FormsType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FormsType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FormsType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FormsType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FormsType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FormsType::class => false]; - } - } -} else { - class FormsTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FormsType::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FormsType::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FormsType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FormsType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FormsType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ForwardAgentAddressNormalizer.php b/src/Api/Normalizer/ForwardAgentAddressNormalizer.php index 22c6e853..c025f772 100644 --- a/src/Api/Normalizer/ForwardAgentAddressNormalizer.php +++ b/src/Api/Normalizer/ForwardAgentAddressNormalizer.php @@ -5,204 +5,101 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ForwardAgentAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ForwardAgentAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ForwardAgentAddress::class; + return $type === \ShipStream\Ups\Api\Model\ForwardAgentAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ForwardAgentAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ForwardAgentAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ForwardAgentAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ForwardAgentAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ForwardAgentAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('Town', $data)) { + $object->setTown($data['Town']); + unset($data['Town']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class ForwardAgentAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ForwardAgentAddress::class; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ForwardAgentAddress::class; + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ForwardAgentAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['Town'] = $data->getTown(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ForwardAgentAddress::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ForwardAgentAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightCancelPickupRequestNormalizer.php b/src/Api/Normalizer/FreightCancelPickupRequestNormalizer.php index 85cbb5ae..56e15e6a 100644 --- a/src/Api/Normalizer/FreightCancelPickupRequestNormalizer.php +++ b/src/Api/Normalizer/FreightCancelPickupRequestNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightCancelPickupRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightCancelPickupRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class; + return $type === \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightCancelPickupRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('PickupRequestConfirmationNumber', $data)) { - $object->setPickupRequestConfirmationNumber($data['PickupRequestConfirmationNumber']); - unset($data['PickupRequestConfirmationNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightCancelPickupRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['PickupRequestConfirmationNumber'] = $object->getPickupRequestConfirmationNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class => false]; - } - } -} else { - class FreightCancelPickupRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class, 'json', $context)); + unset($data['Request']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class; + if (\array_key_exists('PickupRequestConfirmationNumber', $data)) { + $object->setPickupRequestConfirmationNumber($data['PickupRequestConfirmationNumber']); + unset($data['PickupRequestConfirmationNumber']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightCancelPickupRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('PickupRequestConfirmationNumber', $data)) { - $object->setPickupRequestConfirmationNumber($data['PickupRequestConfirmationNumber']); - unset($data['PickupRequestConfirmationNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['PickupRequestConfirmationNumber'] = $object->getPickupRequestConfirmationNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['PickupRequestConfirmationNumber'] = $data->getPickupRequestConfirmationNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightCancelPickupRequestRequestNormalizer.php b/src/Api/Normalizer/FreightCancelPickupRequestRequestNormalizer.php index 70405ba9..280d06ce 100644 --- a/src/Api/Normalizer/FreightCancelPickupRequestRequestNormalizer.php +++ b/src/Api/Normalizer/FreightCancelPickupRequestRequestNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightCancelPickupRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightCancelPickupRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FreightCancelPickupRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightCancelPickupResponseNormalizer.php b/src/Api/Normalizer/FreightCancelPickupResponseNormalizer.php index f1088144..41decb91 100644 --- a/src/Api/Normalizer/FreightCancelPickupResponseNormalizer.php +++ b/src/Api/Normalizer/FreightCancelPickupResponseNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightCancelPickupResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightCancelPickupResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class; + return $type === \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightCancelPickupResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('FreightCancelStatus', $data)) { - $object->setFreightCancelStatus($this->denormalizer->denormalize($data['FreightCancelStatus'], \ShipStream\Ups\Api\Model\FreightCancelStatus::class, 'json', $context)); - unset($data['FreightCancelStatus']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightCancelPickupResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['FreightCancelStatus'] = $this->normalizer->normalize($object->getFreightCancelStatus(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class => false]; - } - } -} else { - class FreightCancelPickupResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class, 'json', $context)); + unset($data['Response']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class; + if (\array_key_exists('FreightCancelStatus', $data)) { + $object->setFreightCancelStatus($this->denormalizer->denormalize($data['FreightCancelStatus'], \ShipStream\Ups\Api\Model\FreightCancelStatus::class, 'json', $context)); + unset($data['FreightCancelStatus']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightCancelPickupResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('FreightCancelStatus', $data)) { - $object->setFreightCancelStatus($this->denormalizer->denormalize($data['FreightCancelStatus'], \ShipStream\Ups\Api\Model\FreightCancelStatus::class, 'json', $context)); - unset($data['FreightCancelStatus']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['FreightCancelStatus'] = $this->normalizer->normalize($object->getFreightCancelStatus(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + $dataArray['FreightCancelStatus'] = $this->normalizer->normalize($data->getFreightCancelStatus(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightCancelPickupResponseResponseNormalizer.php b/src/Api/Normalizer/FreightCancelPickupResponseResponseNormalizer.php index aab39bdd..c9f44998 100644 --- a/src/Api/Normalizer/FreightCancelPickupResponseResponseNormalizer.php +++ b/src/Api/Normalizer/FreightCancelPickupResponseResponseNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightCancelPickupResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightCancelPickupResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class => false]; + if (\array_key_exists('Alert', $data)) { + $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); + unset($data['Alert']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightCancelPickupResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $dataArray['Alert'] = $this->normalizer->normalize($data->getAlert(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightCancelStatusNormalizer.php b/src/Api/Normalizer/FreightCancelStatusNormalizer.php index 61747105..a13bd4f8 100644 --- a/src/Api/Normalizer/FreightCancelStatusNormalizer.php +++ b/src/Api/Normalizer/FreightCancelStatusNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightCancelStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightCancelStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightCancelStatus::class; + return $type === \ShipStream\Ups\Api\Model\FreightCancelStatus::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelStatus::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelStatus::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightCancelStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightCancelStatus(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightCancelStatus::class => false]; - } - } -} else { - class FreightCancelStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightCancelStatus::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightCancelStatus::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightCancelStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightCancelStatus::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightCancelStatus::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightDensityInfoAdjustedHeightNormalizer.php b/src/Api/Normalizer/FreightDensityInfoAdjustedHeightNormalizer.php index 7be8f3ad..c151f2fe 100644 --- a/src/Api/Normalizer/FreightDensityInfoAdjustedHeightNormalizer.php +++ b/src/Api/Normalizer/FreightDensityInfoAdjustedHeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightDensityInfoAdjustedHeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightDensityInfoAdjustedHeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class; + return $type === \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class => false]; - } - } -} else { - class FreightDensityInfoAdjustedHeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Value'] = $data->getValue(); + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightDensityInfoHandlingUnitsNormalizer.php b/src/Api/Normalizer/FreightDensityInfoHandlingUnitsNormalizer.php index 907a1e92..a8470a81 100644 --- a/src/Api/Normalizer/FreightDensityInfoHandlingUnitsNormalizer.php +++ b/src/Api/Normalizer/FreightDensityInfoHandlingUnitsNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightDensityInfoHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightDensityInfoHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class; + return $type === \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class => false]; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); + unset($data['Type']); } - } -} else { - class FreightDensityInfoHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class; + if (\array_key_exists('Dimensions', $data)) { + $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); + unset($data['Dimensions']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Quantity'] = $data->getQuantity(); + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + $dataArray['Dimensions'] = $this->normalizer->normalize($data->getDimensions(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightOptionsDestinationAddressNormalizer.php b/src/Api/Normalizer/FreightOptionsDestinationAddressNormalizer.php index 8919107b..a059dc27 100644 --- a/src/Api/Normalizer/FreightOptionsDestinationAddressNormalizer.php +++ b/src/Api/Normalizer/FreightOptionsDestinationAddressNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightOptionsDestinationAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightOptionsDestinationAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class; + return $type === \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['StateProvince'] = $object->getStateProvince(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvince', $data)) { + $object->setStateProvince($data['StateProvince']); + unset($data['StateProvince']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class => false]; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightOptionsDestinationAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class; + $dataArray = []; + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class; + if ($data->isInitialized('stateProvince') && null !== $data->getStateProvince()) { + $dataArray['StateProvince'] = $data->getStateProvince(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['StateProvince'] = $object->getStateProvince(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightOptionsShipmentDetailNormalizer.php b/src/Api/Normalizer/FreightOptionsShipmentDetailNormalizer.php index 73a92dfb..67030543 100644 --- a/src/Api/Normalizer/FreightOptionsShipmentDetailNormalizer.php +++ b/src/Api/Normalizer/FreightOptionsShipmentDetailNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightOptionsShipmentDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightOptionsShipmentDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class; + return $type === \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HazmatIndicator', $data)) { - $object->setHazmatIndicator($data['HazmatIndicator']); - unset($data['HazmatIndicator']); - } - if (\array_key_exists('PalletInformation', $data)) { - $object->setPalletInformation($this->denormalizer->denormalize($data['PalletInformation'], \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class, 'json', $context)); - unset($data['PalletInformation']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('hazmatIndicator') && null !== $object->getHazmatIndicator()) { - $data['HazmatIndicator'] = $object->getHazmatIndicator(); - } - if ($object->isInitialized('palletInformation') && null !== $object->getPalletInformation()) { - $data['PalletInformation'] = $this->normalizer->normalize($object->getPalletInformation(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('HazmatIndicator', $data)) { + $object->setHazmatIndicator($data['HazmatIndicator']); + unset($data['HazmatIndicator']); + } + if (\array_key_exists('PalletInformation', $data)) { + $object->setPalletInformation($this->denormalizer->denormalize($data['PalletInformation'], \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class, 'json', $context)); + unset($data['PalletInformation']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FreightOptionsShipmentDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class; + $dataArray = []; + if ($data->isInitialized('hazmatIndicator') && null !== $data->getHazmatIndicator()) { + $dataArray['HazmatIndicator'] = $data->getHazmatIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HazmatIndicator', $data)) { - $object->setHazmatIndicator($data['HazmatIndicator']); - unset($data['HazmatIndicator']); - } - if (\array_key_exists('PalletInformation', $data)) { - $object->setPalletInformation($this->denormalizer->denormalize($data['PalletInformation'], \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class, 'json', $context)); - unset($data['PalletInformation']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('palletInformation') && null !== $data->getPalletInformation()) { + $dataArray['PalletInformation'] = $this->normalizer->normalize($data->getPalletInformation(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('hazmatIndicator') && null !== $object->getHazmatIndicator()) { - $data['HazmatIndicator'] = $object->getHazmatIndicator(); - } - if ($object->isInitialized('palletInformation') && null !== $object->getPalletInformation()) { - $data['PalletInformation'] = $this->normalizer->normalize($object->getPalletInformation(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightOptionsShipmentServiceOptionsNormalizer.php b/src/Api/Normalizer/FreightOptionsShipmentServiceOptionsNormalizer.php index 68a17e60..a003ad00 100644 --- a/src/Api/Normalizer/FreightOptionsShipmentServiceOptionsNormalizer.php +++ b/src/Api/Normalizer/FreightOptionsShipmentServiceOptionsNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightOptionsShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightOptionsShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class; + return $type === \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('OriginLiftGateIndicator', $data)) { - $object->setOriginLiftGateIndicator($data['OriginLiftGateIndicator']); - unset($data['OriginLiftGateIndicator']); - } - if (\array_key_exists('DropoffAtUPSFacilityIndicator', $data)) { - $object->setDropoffAtUPSFacilityIndicator($data['DropoffAtUPSFacilityIndicator']); - unset($data['DropoffAtUPSFacilityIndicator']); - } - if (\array_key_exists('HoldForPickupIndicator', $data)) { - $object->setHoldForPickupIndicator($data['HoldForPickupIndicator']); - unset($data['HoldForPickupIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('originLiftGateIndicator') && null !== $object->getOriginLiftGateIndicator()) { - $data['OriginLiftGateIndicator'] = $object->getOriginLiftGateIndicator(); - } - if ($object->isInitialized('dropoffAtUPSFacilityIndicator') && null !== $object->getDropoffAtUPSFacilityIndicator()) { - $data['DropoffAtUPSFacilityIndicator'] = $object->getDropoffAtUPSFacilityIndicator(); - } - if ($object->isInitialized('holdForPickupIndicator') && null !== $object->getHoldForPickupIndicator()) { - $data['HoldForPickupIndicator'] = $object->getHoldForPickupIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('OriginLiftGateIndicator', $data)) { + $object->setOriginLiftGateIndicator($data['OriginLiftGateIndicator']); + unset($data['OriginLiftGateIndicator']); + } + if (\array_key_exists('DropoffAtUPSFacilityIndicator', $data)) { + $object->setDropoffAtUPSFacilityIndicator($data['DropoffAtUPSFacilityIndicator']); + unset($data['DropoffAtUPSFacilityIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class => false]; + if (\array_key_exists('HoldForPickupIndicator', $data)) { + $object->setHoldForPickupIndicator($data['HoldForPickupIndicator']); + unset($data['HoldForPickupIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightOptionsShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class; + $dataArray = []; + if ($data->isInitialized('originLiftGateIndicator') && null !== $data->getOriginLiftGateIndicator()) { + $dataArray['OriginLiftGateIndicator'] = $data->getOriginLiftGateIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class; + if ($data->isInitialized('dropoffAtUPSFacilityIndicator') && null !== $data->getDropoffAtUPSFacilityIndicator()) { + $dataArray['DropoffAtUPSFacilityIndicator'] = $data->getDropoffAtUPSFacilityIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('OriginLiftGateIndicator', $data)) { - $object->setOriginLiftGateIndicator($data['OriginLiftGateIndicator']); - unset($data['OriginLiftGateIndicator']); - } - if (\array_key_exists('DropoffAtUPSFacilityIndicator', $data)) { - $object->setDropoffAtUPSFacilityIndicator($data['DropoffAtUPSFacilityIndicator']); - unset($data['DropoffAtUPSFacilityIndicator']); - } - if (\array_key_exists('HoldForPickupIndicator', $data)) { - $object->setHoldForPickupIndicator($data['HoldForPickupIndicator']); - unset($data['HoldForPickupIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('holdForPickupIndicator') && null !== $data->getHoldForPickupIndicator()) { + $dataArray['HoldForPickupIndicator'] = $data->getHoldForPickupIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('originLiftGateIndicator') && null !== $object->getOriginLiftGateIndicator()) { - $data['OriginLiftGateIndicator'] = $object->getOriginLiftGateIndicator(); - } - if ($object->isInitialized('dropoffAtUPSFacilityIndicator') && null !== $object->getDropoffAtUPSFacilityIndicator()) { - $data['DropoffAtUPSFacilityIndicator'] = $object->getDropoffAtUPSFacilityIndicator(); - } - if ($object->isInitialized('holdForPickupIndicator') && null !== $object->getHoldForPickupIndicator()) { - $data['HoldForPickupIndicator'] = $object->getHoldForPickupIndicator(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightPickupRequestExistingShipmentIDNormalizer.php b/src/Api/Normalizer/FreightPickupRequestExistingShipmentIDNormalizer.php index 21432fed..7c926605 100644 --- a/src/Api/Normalizer/FreightPickupRequestExistingShipmentIDNormalizer.php +++ b/src/Api/Normalizer/FreightPickupRequestExistingShipmentIDNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightPickupRequestExistingShipmentIDNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightPickupRequestExistingShipmentIDNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class; + return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentNumber', $data)) { - $object->setShipmentNumber($data['ShipmentNumber']); - unset($data['ShipmentNumber']); - } - if (\array_key_exists('BOLID', $data)) { - $object->setBOLID($data['BOLID']); - unset($data['BOLID']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ShipmentNumber'] = $object->getShipmentNumber(); - $data['BOLID'] = $object->getBOLID(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class => false]; - } - } -} else { - class FreightPickupRequestExistingShipmentIDNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class; + if (\array_key_exists('ShipmentNumber', $data)) { + $object->setShipmentNumber($data['ShipmentNumber']); + unset($data['ShipmentNumber']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class; + if (\array_key_exists('BOLID', $data)) { + $object->setBOLID($data['BOLID']); + unset($data['BOLID']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentNumber', $data)) { - $object->setShipmentNumber($data['ShipmentNumber']); - unset($data['ShipmentNumber']); - } - if (\array_key_exists('BOLID', $data)) { - $object->setBOLID($data['BOLID']); - unset($data['BOLID']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ShipmentNumber'] = $object->getShipmentNumber(); - $data['BOLID'] = $object->getBOLID(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ShipmentNumber'] = $data->getShipmentNumber(); + $dataArray['BOLID'] = $data->getBOLID(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightPickupRequestNormalizer.php b/src/Api/Normalizer/FreightPickupRequestNormalizer.php index 37f19670..cd5bbfd2 100644 --- a/src/Api/Normalizer/FreightPickupRequestNormalizer.php +++ b/src/Api/Normalizer/FreightPickupRequestNormalizer.php @@ -5,370 +5,184 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightPickupRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightPickupRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequest::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('PickupRequestConfirmationNumber', $data)) { - $object->setPickupRequestConfirmationNumber($data['PickupRequestConfirmationNumber']); - unset($data['PickupRequestConfirmationNumber']); - } - if (\array_key_exists('DestinationPostalCode', $data)) { - $object->setDestinationPostalCode($data['DestinationPostalCode']); - unset($data['DestinationPostalCode']); - } - if (\array_key_exists('DestinationCountryCode', $data)) { - $object->setDestinationCountryCode($data['DestinationCountryCode']); - unset($data['DestinationCountryCode']); - } - if (\array_key_exists('Requester', $data)) { - $object->setRequester($this->denormalizer->denormalize($data['Requester'], \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class, 'json', $context)); - unset($data['Requester']); - } - if (\array_key_exists('ShipFrom', $data)) { - $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class, 'json', $context)); - unset($data['ShipFrom']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - if (\array_key_exists('EarliestTimeReady', $data)) { - $object->setEarliestTimeReady($data['EarliestTimeReady']); - unset($data['EarliestTimeReady']); - } - if (\array_key_exists('LatestTimeReady', $data)) { - $object->setLatestTimeReady($data['LatestTimeReady']); - unset($data['LatestTimeReady']); - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('ShipmentDetail', $data)) { - $values = []; - foreach ($data['ShipmentDetail'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class, 'json', $context); - } - $object->setShipmentDetail($values); - unset($data['ShipmentDetail']); - } - if (\array_key_exists('ExistingShipmentID', $data)) { - $object->setExistingShipmentID($this->denormalizer->denormalize($data['ExistingShipmentID'], \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class, 'json', $context)); - unset($data['ExistingShipmentID']); - } - if (\array_key_exists('POM', $data)) { - $object->setPOM($this->denormalizer->denormalize($data['POM'], \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class, 'json', $context)); - unset($data['POM']); - } - if (\array_key_exists('PickupInstructions', $data)) { - $object->setPickupInstructions($data['PickupInstructions']); - unset($data['PickupInstructions']); - } - if (\array_key_exists('AdditionalComments', $data)) { - $object->setAdditionalComments($data['AdditionalComments']); - unset($data['AdditionalComments']); - } - if (\array_key_exists('HandlingInstructions', $data)) { - $object->setHandlingInstructions($data['HandlingInstructions']); - unset($data['HandlingInstructions']); - } - if (\array_key_exists('SpecialInstructions', $data)) { - $object->setSpecialInstructions($data['SpecialInstructions']); - unset($data['SpecialInstructions']); - } - if (\array_key_exists('DeliveryInstructions', $data)) { - $object->setDeliveryInstructions($data['DeliveryInstructions']); - unset($data['DeliveryInstructions']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\FreightPickupRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\FreightPickupRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('pickupRequestConfirmationNumber') && null !== $object->getPickupRequestConfirmationNumber()) { - $data['PickupRequestConfirmationNumber'] = $object->getPickupRequestConfirmationNumber(); - } - if ($object->isInitialized('destinationPostalCode') && null !== $object->getDestinationPostalCode()) { - $data['DestinationPostalCode'] = $object->getDestinationPostalCode(); - } - $data['DestinationCountryCode'] = $object->getDestinationCountryCode(); - $data['Requester'] = $this->normalizer->normalize($object->getRequester(), 'json', $context); - $data['ShipFrom'] = $this->normalizer->normalize($object->getShipFrom(), 'json', $context); - if ($object->isInitialized('shipTo') && null !== $object->getShipTo()) { - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - } - $data['PickupDate'] = $object->getPickupDate(); - $data['EarliestTimeReady'] = $object->getEarliestTimeReady(); - $data['LatestTimeReady'] = $object->getLatestTimeReady(); - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('shipmentDetail') && null !== $object->getShipmentDetail()) { - $values = []; - foreach ($object->getShipmentDetail() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ShipmentDetail'] = $values; - } - if ($object->isInitialized('existingShipmentID') && null !== $object->getExistingShipmentID()) { - $data['ExistingShipmentID'] = $this->normalizer->normalize($object->getExistingShipmentID(), 'json', $context); - } - if ($object->isInitialized('pOM') && null !== $object->getPOM()) { - $data['POM'] = $this->normalizer->normalize($object->getPOM(), 'json', $context); - } - if ($object->isInitialized('pickupInstructions') && null !== $object->getPickupInstructions()) { - $data['PickupInstructions'] = $object->getPickupInstructions(); - } - if ($object->isInitialized('additionalComments') && null !== $object->getAdditionalComments()) { - $data['AdditionalComments'] = $object->getAdditionalComments(); - } - if ($object->isInitialized('handlingInstructions') && null !== $object->getHandlingInstructions()) { - $data['HandlingInstructions'] = $object->getHandlingInstructions(); - } - if ($object->isInitialized('specialInstructions') && null !== $object->getSpecialInstructions()) { - $data['SpecialInstructions'] = $object->getSpecialInstructions(); - } - if ($object->isInitialized('deliveryInstructions') && null !== $object->getDeliveryInstructions()) { - $data['DeliveryInstructions'] = $object->getDeliveryInstructions(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class, 'json', $context)); + unset($data['Request']); + } + if (\array_key_exists('PickupRequestConfirmationNumber', $data)) { + $object->setPickupRequestConfirmationNumber($data['PickupRequestConfirmationNumber']); + unset($data['PickupRequestConfirmationNumber']); + } + if (\array_key_exists('DestinationPostalCode', $data)) { + $object->setDestinationPostalCode($data['DestinationPostalCode']); + unset($data['DestinationPostalCode']); + } + if (\array_key_exists('DestinationCountryCode', $data)) { + $object->setDestinationCountryCode($data['DestinationCountryCode']); + unset($data['DestinationCountryCode']); + } + if (\array_key_exists('Requester', $data)) { + $object->setRequester($this->denormalizer->denormalize($data['Requester'], \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class, 'json', $context)); + unset($data['Requester']); + } + if (\array_key_exists('ShipFrom', $data)) { + $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class, 'json', $context)); + unset($data['ShipFrom']); + } + if (\array_key_exists('ShipTo', $data)) { + $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class, 'json', $context)); + unset($data['ShipTo']); + } + if (\array_key_exists('PickupDate', $data)) { + $object->setPickupDate($data['PickupDate']); + unset($data['PickupDate']); + } + if (\array_key_exists('EarliestTimeReady', $data)) { + $object->setEarliestTimeReady($data['EarliestTimeReady']); + unset($data['EarliestTimeReady']); + } + if (\array_key_exists('LatestTimeReady', $data)) { + $object->setLatestTimeReady($data['LatestTimeReady']); + unset($data['LatestTimeReady']); + } + if (\array_key_exists('ShipmentServiceOptions', $data)) { + $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class, 'json', $context)); + unset($data['ShipmentServiceOptions']); + } + if (\array_key_exists('ShipmentDetail', $data)) { + $values = []; + foreach ($data['ShipmentDetail'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class, 'json', $context); } - return $data; + $object->setShipmentDetail($values); + unset($data['ShipmentDetail']); + } + if (\array_key_exists('ExistingShipmentID', $data)) { + $object->setExistingShipmentID($this->denormalizer->denormalize($data['ExistingShipmentID'], \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class, 'json', $context)); + unset($data['ExistingShipmentID']); + } + if (\array_key_exists('POM', $data)) { + $object->setPOM($this->denormalizer->denormalize($data['POM'], \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class, 'json', $context)); + unset($data['POM']); + } + if (\array_key_exists('PickupInstructions', $data)) { + $object->setPickupInstructions($data['PickupInstructions']); + unset($data['PickupInstructions']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequest::class => false]; + if (\array_key_exists('AdditionalComments', $data)) { + $object->setAdditionalComments($data['AdditionalComments']); + unset($data['AdditionalComments']); } + if (\array_key_exists('HandlingInstructions', $data)) { + $object->setHandlingInstructions($data['HandlingInstructions']); + unset($data['HandlingInstructions']); + } + if (\array_key_exists('SpecialInstructions', $data)) { + $object->setSpecialInstructions($data['SpecialInstructions']); + unset($data['SpecialInstructions']); + } + if (\array_key_exists('DeliveryInstructions', $data)) { + $object->setDeliveryInstructions($data['DeliveryInstructions']); + unset($data['DeliveryInstructions']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class FreightPickupRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('PickupRequestConfirmationNumber', $data)) { - $object->setPickupRequestConfirmationNumber($data['PickupRequestConfirmationNumber']); - unset($data['PickupRequestConfirmationNumber']); - } - if (\array_key_exists('DestinationPostalCode', $data)) { - $object->setDestinationPostalCode($data['DestinationPostalCode']); - unset($data['DestinationPostalCode']); - } - if (\array_key_exists('DestinationCountryCode', $data)) { - $object->setDestinationCountryCode($data['DestinationCountryCode']); - unset($data['DestinationCountryCode']); - } - if (\array_key_exists('Requester', $data)) { - $object->setRequester($this->denormalizer->denormalize($data['Requester'], \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class, 'json', $context)); - unset($data['Requester']); - } - if (\array_key_exists('ShipFrom', $data)) { - $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class, 'json', $context)); - unset($data['ShipFrom']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - if (\array_key_exists('EarliestTimeReady', $data)) { - $object->setEarliestTimeReady($data['EarliestTimeReady']); - unset($data['EarliestTimeReady']); - } - if (\array_key_exists('LatestTimeReady', $data)) { - $object->setLatestTimeReady($data['LatestTimeReady']); - unset($data['LatestTimeReady']); - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('ShipmentDetail', $data)) { - $values = []; - foreach ($data['ShipmentDetail'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class, 'json', $context); - } - $object->setShipmentDetail($values); - unset($data['ShipmentDetail']); - } - if (\array_key_exists('ExistingShipmentID', $data)) { - $object->setExistingShipmentID($this->denormalizer->denormalize($data['ExistingShipmentID'], \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class, 'json', $context)); - unset($data['ExistingShipmentID']); - } - if (\array_key_exists('POM', $data)) { - $object->setPOM($this->denormalizer->denormalize($data['POM'], \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class, 'json', $context)); - unset($data['POM']); - } - if (\array_key_exists('PickupInstructions', $data)) { - $object->setPickupInstructions($data['PickupInstructions']); - unset($data['PickupInstructions']); - } - if (\array_key_exists('AdditionalComments', $data)) { - $object->setAdditionalComments($data['AdditionalComments']); - unset($data['AdditionalComments']); - } - if (\array_key_exists('HandlingInstructions', $data)) { - $object->setHandlingInstructions($data['HandlingInstructions']); - unset($data['HandlingInstructions']); - } - if (\array_key_exists('SpecialInstructions', $data)) { - $object->setSpecialInstructions($data['SpecialInstructions']); - unset($data['SpecialInstructions']); - } - if (\array_key_exists('DeliveryInstructions', $data)) { - $object->setDeliveryInstructions($data['DeliveryInstructions']); - unset($data['DeliveryInstructions']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + if ($data->isInitialized('pickupRequestConfirmationNumber') && null !== $data->getPickupRequestConfirmationNumber()) { + $dataArray['PickupRequestConfirmationNumber'] = $data->getPickupRequestConfirmationNumber(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('pickupRequestConfirmationNumber') && null !== $object->getPickupRequestConfirmationNumber()) { - $data['PickupRequestConfirmationNumber'] = $object->getPickupRequestConfirmationNumber(); - } - if ($object->isInitialized('destinationPostalCode') && null !== $object->getDestinationPostalCode()) { - $data['DestinationPostalCode'] = $object->getDestinationPostalCode(); - } - $data['DestinationCountryCode'] = $object->getDestinationCountryCode(); - $data['Requester'] = $this->normalizer->normalize($object->getRequester(), 'json', $context); - $data['ShipFrom'] = $this->normalizer->normalize($object->getShipFrom(), 'json', $context); - if ($object->isInitialized('shipTo') && null !== $object->getShipTo()) { - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - } - $data['PickupDate'] = $object->getPickupDate(); - $data['EarliestTimeReady'] = $object->getEarliestTimeReady(); - $data['LatestTimeReady'] = $object->getLatestTimeReady(); - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('shipmentDetail') && null !== $object->getShipmentDetail()) { - $values = []; - foreach ($object->getShipmentDetail() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ShipmentDetail'] = $values; - } - if ($object->isInitialized('existingShipmentID') && null !== $object->getExistingShipmentID()) { - $data['ExistingShipmentID'] = $this->normalizer->normalize($object->getExistingShipmentID(), 'json', $context); - } - if ($object->isInitialized('pOM') && null !== $object->getPOM()) { - $data['POM'] = $this->normalizer->normalize($object->getPOM(), 'json', $context); - } - if ($object->isInitialized('pickupInstructions') && null !== $object->getPickupInstructions()) { - $data['PickupInstructions'] = $object->getPickupInstructions(); - } - if ($object->isInitialized('additionalComments') && null !== $object->getAdditionalComments()) { - $data['AdditionalComments'] = $object->getAdditionalComments(); - } - if ($object->isInitialized('handlingInstructions') && null !== $object->getHandlingInstructions()) { - $data['HandlingInstructions'] = $object->getHandlingInstructions(); - } - if ($object->isInitialized('specialInstructions') && null !== $object->getSpecialInstructions()) { - $data['SpecialInstructions'] = $object->getSpecialInstructions(); - } - if ($object->isInitialized('deliveryInstructions') && null !== $object->getDeliveryInstructions()) { - $data['DeliveryInstructions'] = $object->getDeliveryInstructions(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if ($data->isInitialized('destinationPostalCode') && null !== $data->getDestinationPostalCode()) { + $dataArray['DestinationPostalCode'] = $data->getDestinationPostalCode(); + } + $dataArray['DestinationCountryCode'] = $data->getDestinationCountryCode(); + $dataArray['Requester'] = $this->normalizer->normalize($data->getRequester(), 'json', $context); + $dataArray['ShipFrom'] = $this->normalizer->normalize($data->getShipFrom(), 'json', $context); + if ($data->isInitialized('shipTo') && null !== $data->getShipTo()) { + $dataArray['ShipTo'] = $this->normalizer->normalize($data->getShipTo(), 'json', $context); + } + $dataArray['PickupDate'] = $data->getPickupDate(); + $dataArray['EarliestTimeReady'] = $data->getEarliestTimeReady(); + $dataArray['LatestTimeReady'] = $data->getLatestTimeReady(); + if ($data->isInitialized('shipmentServiceOptions') && null !== $data->getShipmentServiceOptions()) { + $dataArray['ShipmentServiceOptions'] = $this->normalizer->normalize($data->getShipmentServiceOptions(), 'json', $context); + } + if ($data->isInitialized('shipmentDetail') && null !== $data->getShipmentDetail()) { + $values = []; + foreach ($data->getShipmentDetail() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $data; + $dataArray['ShipmentDetail'] = $values; + } + if ($data->isInitialized('existingShipmentID') && null !== $data->getExistingShipmentID()) { + $dataArray['ExistingShipmentID'] = $this->normalizer->normalize($data->getExistingShipmentID(), 'json', $context); + } + if ($data->isInitialized('pOM') && null !== $data->getPOM()) { + $dataArray['POM'] = $this->normalizer->normalize($data->getPOM(), 'json', $context); + } + if ($data->isInitialized('pickupInstructions') && null !== $data->getPickupInstructions()) { + $dataArray['PickupInstructions'] = $data->getPickupInstructions(); + } + if ($data->isInitialized('additionalComments') && null !== $data->getAdditionalComments()) { + $dataArray['AdditionalComments'] = $data->getAdditionalComments(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequest::class => false]; + if ($data->isInitialized('handlingInstructions') && null !== $data->getHandlingInstructions()) { + $dataArray['HandlingInstructions'] = $data->getHandlingInstructions(); } + if ($data->isInitialized('specialInstructions') && null !== $data->getSpecialInstructions()) { + $dataArray['SpecialInstructions'] = $data->getSpecialInstructions(); + } + if ($data->isInitialized('deliveryInstructions') && null !== $data->getDeliveryInstructions()) { + $dataArray['DeliveryInstructions'] = $data->getDeliveryInstructions(); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightPickupRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightPickupRequestPOMNormalizer.php b/src/Api/Normalizer/FreightPickupRequestPOMNormalizer.php index af8c3662..f9630371 100644 --- a/src/Api/Normalizer/FreightPickupRequestPOMNormalizer.php +++ b/src/Api/Normalizer/FreightPickupRequestPOMNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightPickupRequestPOMNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightPickupRequestPOMNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class; + return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestPOM(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('POMNumber', $data)) { - $object->setPOMNumber($data['POMNumber']); - unset($data['POMNumber']); - } - if (\array_key_exists('POMNumberType', $data)) { - $object->setPOMNumberType($data['POMNumberType']); - unset($data['POMNumberType']); - } - if (\array_key_exists('PickupNotifications', $data)) { - $object->setPickupNotifications($this->denormalizer->denormalize($data['PickupNotifications'], \ShipStream\Ups\Api\Model\POMPickupNotifications::class, 'json', $context)); - unset($data['PickupNotifications']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestPOM(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('pOMNumber') && null !== $object->getPOMNumber()) { - $data['POMNumber'] = $object->getPOMNumber(); - } - if ($object->isInitialized('pOMNumberType') && null !== $object->getPOMNumberType()) { - $data['POMNumberType'] = $object->getPOMNumberType(); - } - if ($object->isInitialized('pickupNotifications') && null !== $object->getPickupNotifications()) { - $data['PickupNotifications'] = $this->normalizer->normalize($object->getPickupNotifications(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('POMNumber', $data)) { + $object->setPOMNumber($data['POMNumber']); + unset($data['POMNumber']); + } + if (\array_key_exists('POMNumberType', $data)) { + $object->setPOMNumberType($data['POMNumberType']); + unset($data['POMNumberType']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class => false]; + if (\array_key_exists('PickupNotifications', $data)) { + $object->setPickupNotifications($this->denormalizer->denormalize($data['PickupNotifications'], \ShipStream\Ups\Api\Model\POMPickupNotifications::class, 'json', $context)); + unset($data['PickupNotifications']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightPickupRequestPOMNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class; + $dataArray = []; + if ($data->isInitialized('pOMNumber') && null !== $data->getPOMNumber()) { + $dataArray['POMNumber'] = $data->getPOMNumber(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class; + if ($data->isInitialized('pOMNumberType') && null !== $data->getPOMNumberType()) { + $dataArray['POMNumberType'] = $data->getPOMNumberType(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestPOM(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('POMNumber', $data)) { - $object->setPOMNumber($data['POMNumber']); - unset($data['POMNumber']); - } - if (\array_key_exists('POMNumberType', $data)) { - $object->setPOMNumberType($data['POMNumberType']); - unset($data['POMNumberType']); - } - if (\array_key_exists('PickupNotifications', $data)) { - $object->setPickupNotifications($this->denormalizer->denormalize($data['PickupNotifications'], \ShipStream\Ups\Api\Model\POMPickupNotifications::class, 'json', $context)); - unset($data['PickupNotifications']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('pickupNotifications') && null !== $data->getPickupNotifications()) { + $dataArray['PickupNotifications'] = $this->normalizer->normalize($data->getPickupNotifications(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('pOMNumber') && null !== $object->getPOMNumber()) { - $data['POMNumber'] = $object->getPOMNumber(); - } - if ($object->isInitialized('pOMNumberType') && null !== $object->getPOMNumberType()) { - $data['POMNumberType'] = $object->getPOMNumberType(); - } - if ($object->isInitialized('pickupNotifications') && null !== $object->getPickupNotifications()) { - $data['PickupNotifications'] = $this->normalizer->normalize($object->getPickupNotifications(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightPickupRequestRequestNormalizer.php b/src/Api/Normalizer/FreightPickupRequestRequestNormalizer.php index 6f0219fe..711b1eda 100644 --- a/src/Api/Normalizer/FreightPickupRequestRequestNormalizer.php +++ b/src/Api/Normalizer/FreightPickupRequestRequestNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightPickupRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightPickupRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FreightPickupRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('requestOption') && null !== $data->getRequestOption()) { + $dataArray['RequestOption'] = $data->getRequestOption(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightPickupRequestRequesterNormalizer.php b/src/Api/Normalizer/FreightPickupRequestRequesterNormalizer.php index f49e0a40..515df3c0 100644 --- a/src/Api/Normalizer/FreightPickupRequestRequesterNormalizer.php +++ b/src/Api/Normalizer/FreightPickupRequestRequesterNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightPickupRequestRequesterNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightPickupRequestRequesterNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class; + return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestRequester(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ThirdPartyIndicator', $data)) { - $object->setThirdPartyIndicator($data['ThirdPartyIndicator']); - unset($data['ThirdPartyIndicator']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\RequesterPhone::class, 'json', $context)); - unset($data['Phone']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestRequester(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('thirdPartyIndicator') && null !== $object->getThirdPartyIndicator()) { - $data['ThirdPartyIndicator'] = $object->getThirdPartyIndicator(); - } - $data['AttentionName'] = $object->getAttentionName(); - $data['EMailAddress'] = $object->getEMailAddress(); - $data['Name'] = $object->getName(); - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ThirdPartyIndicator', $data)) { + $object->setThirdPartyIndicator($data['ThirdPartyIndicator']); + unset($data['ThirdPartyIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class => false]; + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); } - } -} else { - class FreightPickupRequestRequesterNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class; + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestRequester(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ThirdPartyIndicator', $data)) { - $object->setThirdPartyIndicator($data['ThirdPartyIndicator']); - unset($data['ThirdPartyIndicator']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\RequesterPhone::class, 'json', $context)); - unset($data['Phone']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\RequesterPhone::class, 'json', $context)); + unset($data['Phone']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('thirdPartyIndicator') && null !== $object->getThirdPartyIndicator()) { - $data['ThirdPartyIndicator'] = $object->getThirdPartyIndicator(); - } - $data['AttentionName'] = $object->getAttentionName(); - $data['EMailAddress'] = $object->getEMailAddress(); - $data['Name'] = $object->getName(); - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('thirdPartyIndicator') && null !== $data->getThirdPartyIndicator()) { + $dataArray['ThirdPartyIndicator'] = $data->getThirdPartyIndicator(); + } + $dataArray['AttentionName'] = $data->getAttentionName(); + $dataArray['EMailAddress'] = $data->getEMailAddress(); + $dataArray['Name'] = $data->getName(); + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightPickupRequestShipFromNormalizer.php b/src/Api/Normalizer/FreightPickupRequestShipFromNormalizer.php index aef016dc..87af549d 100644 --- a/src/Api/Normalizer/FreightPickupRequestShipFromNormalizer.php +++ b/src/Api/Normalizer/FreightPickupRequestShipFromNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightPickupRequestShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightPickupRequestShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class; + return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipFromAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipFromPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AttentionName'] = $object->getAttentionName(); - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class => false]; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - } -} else { - class FreightPickupRequestShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipFromAddress::class, 'json', $context)); + unset($data['Address']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class; + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipFromPhone::class, 'json', $context)); + unset($data['Phone']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipFromAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipFromPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AttentionName'] = $object->getAttentionName(); - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['AttentionName'] = $data->getAttentionName(); + $dataArray['Name'] = $data->getName(); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightPickupRequestShipToNormalizer.php b/src/Api/Normalizer/FreightPickupRequestShipToNormalizer.php index 47249e45..756f8c31 100644 --- a/src/Api/Normalizer/FreightPickupRequestShipToNormalizer.php +++ b/src/Api/Normalizer/FreightPickupRequestShipToNormalizer.php @@ -5,172 +5,85 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightPickupRequestShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightPickupRequestShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class; + return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipToPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class, 'json', $context)); + unset($data['Address']); + } + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipToPhone::class, 'json', $context)); + unset($data['Phone']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class => false]; + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightPickupRequestShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class; + $dataArray = []; + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class; + if ($data->isInitialized('address') && null !== $data->getAddress()) { + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipToPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('phone') && null !== $data->getPhone()) { + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightPickupRequestShipmentDetailNormalizer.php b/src/Api/Normalizer/FreightPickupRequestShipmentDetailNormalizer.php index c1e383d5..4d84cef0 100644 --- a/src/Api/Normalizer/FreightPickupRequestShipmentDetailNormalizer.php +++ b/src/Api/Normalizer/FreightPickupRequestShipmentDetailNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightPickupRequestShipmentDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightPickupRequestShipmentDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class; + return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HazmatIndicator', $data)) { - $object->setHazmatIndicator($data['HazmatIndicator']); - unset($data['HazmatIndicator']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class, 'json', $context)); - unset($data['PackagingType']); - } - if (\array_key_exists('NumberOfPieces', $data)) { - $object->setNumberOfPieces($data['NumberOfPieces']); - unset($data['NumberOfPieces']); - } - if (\array_key_exists('DescriptionOfCommodity', $data)) { - $object->setDescriptionOfCommodity($data['DescriptionOfCommodity']); - unset($data['DescriptionOfCommodity']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($this->denormalizer->denormalize($data['Weight'], \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class, 'json', $context)); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('hazmatIndicator') && null !== $object->getHazmatIndicator()) { - $data['HazmatIndicator'] = $object->getHazmatIndicator(); - } - $data['PackagingType'] = $this->normalizer->normalize($object->getPackagingType(), 'json', $context); - $data['NumberOfPieces'] = $object->getNumberOfPieces(); - $data['DescriptionOfCommodity'] = $object->getDescriptionOfCommodity(); - $data['Weight'] = $this->normalizer->normalize($object->getWeight(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('HazmatIndicator', $data)) { + $object->setHazmatIndicator($data['HazmatIndicator']); + unset($data['HazmatIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class => false]; + if (\array_key_exists('PackagingType', $data)) { + $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class, 'json', $context)); + unset($data['PackagingType']); } - } -} else { - class FreightPickupRequestShipmentDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class; + if (\array_key_exists('NumberOfPieces', $data)) { + $object->setNumberOfPieces($data['NumberOfPieces']); + unset($data['NumberOfPieces']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class; + if (\array_key_exists('DescriptionOfCommodity', $data)) { + $object->setDescriptionOfCommodity($data['DescriptionOfCommodity']); + unset($data['DescriptionOfCommodity']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HazmatIndicator', $data)) { - $object->setHazmatIndicator($data['HazmatIndicator']); - unset($data['HazmatIndicator']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class, 'json', $context)); - unset($data['PackagingType']); - } - if (\array_key_exists('NumberOfPieces', $data)) { - $object->setNumberOfPieces($data['NumberOfPieces']); - unset($data['NumberOfPieces']); - } - if (\array_key_exists('DescriptionOfCommodity', $data)) { - $object->setDescriptionOfCommodity($data['DescriptionOfCommodity']); - unset($data['DescriptionOfCommodity']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($this->denormalizer->denormalize($data['Weight'], \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class, 'json', $context)); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($this->denormalizer->denormalize($data['Weight'], \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class, 'json', $context)); + unset($data['Weight']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('hazmatIndicator') && null !== $object->getHazmatIndicator()) { - $data['HazmatIndicator'] = $object->getHazmatIndicator(); - } - $data['PackagingType'] = $this->normalizer->normalize($object->getPackagingType(), 'json', $context); - $data['NumberOfPieces'] = $object->getNumberOfPieces(); - $data['DescriptionOfCommodity'] = $object->getDescriptionOfCommodity(); - $data['Weight'] = $this->normalizer->normalize($object->getWeight(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('hazmatIndicator') && null !== $data->getHazmatIndicator()) { + $dataArray['HazmatIndicator'] = $data->getHazmatIndicator(); + } + $dataArray['PackagingType'] = $this->normalizer->normalize($data->getPackagingType(), 'json', $context); + $dataArray['NumberOfPieces'] = $data->getNumberOfPieces(); + $dataArray['DescriptionOfCommodity'] = $data->getDescriptionOfCommodity(); + $dataArray['Weight'] = $this->normalizer->normalize($data->getWeight(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightPickupRequestShipmentServiceOptionsNormalizer.php b/src/Api/Normalizer/FreightPickupRequestShipmentServiceOptionsNormalizer.php index b599afca..85159689 100644 --- a/src/Api/Normalizer/FreightPickupRequestShipmentServiceOptionsNormalizer.php +++ b/src/Api/Normalizer/FreightPickupRequestShipmentServiceOptionsNormalizer.php @@ -5,172 +5,85 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightPickupRequestShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightPickupRequestShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class; + return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreezableProtectionIndicator', $data)) { - $object->setFreezableProtectionIndicator($data['FreezableProtectionIndicator']); - unset($data['FreezableProtectionIndicator']); - } - if (\array_key_exists('LimitedAccessPickupIndicator', $data)) { - $object->setLimitedAccessPickupIndicator($data['LimitedAccessPickupIndicator']); - unset($data['LimitedAccessPickupIndicator']); - } - if (\array_key_exists('LimitedAccessDeliveryIndicator', $data)) { - $object->setLimitedAccessDeliveryIndicator($data['LimitedAccessDeliveryIndicator']); - unset($data['LimitedAccessDeliveryIndicator']); - } - if (\array_key_exists('ExtremeLengthIndicator', $data)) { - $object->setExtremeLengthIndicator($data['ExtremeLengthIndicator']); - unset($data['ExtremeLengthIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('freezableProtectionIndicator') && null !== $object->getFreezableProtectionIndicator()) { - $data['FreezableProtectionIndicator'] = $object->getFreezableProtectionIndicator(); - } - if ($object->isInitialized('limitedAccessPickupIndicator') && null !== $object->getLimitedAccessPickupIndicator()) { - $data['LimitedAccessPickupIndicator'] = $object->getLimitedAccessPickupIndicator(); - } - if ($object->isInitialized('limitedAccessDeliveryIndicator') && null !== $object->getLimitedAccessDeliveryIndicator()) { - $data['LimitedAccessDeliveryIndicator'] = $object->getLimitedAccessDeliveryIndicator(); - } - if ($object->isInitialized('extremeLengthIndicator') && null !== $object->getExtremeLengthIndicator()) { - $data['ExtremeLengthIndicator'] = $object->getExtremeLengthIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('FreezableProtectionIndicator', $data)) { + $object->setFreezableProtectionIndicator($data['FreezableProtectionIndicator']); + unset($data['FreezableProtectionIndicator']); + } + if (\array_key_exists('LimitedAccessPickupIndicator', $data)) { + $object->setLimitedAccessPickupIndicator($data['LimitedAccessPickupIndicator']); + unset($data['LimitedAccessPickupIndicator']); + } + if (\array_key_exists('LimitedAccessDeliveryIndicator', $data)) { + $object->setLimitedAccessDeliveryIndicator($data['LimitedAccessDeliveryIndicator']); + unset($data['LimitedAccessDeliveryIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class => false]; + if (\array_key_exists('ExtremeLengthIndicator', $data)) { + $object->setExtremeLengthIndicator($data['ExtremeLengthIndicator']); + unset($data['ExtremeLengthIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightPickupRequestShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class; + $dataArray = []; + if ($data->isInitialized('freezableProtectionIndicator') && null !== $data->getFreezableProtectionIndicator()) { + $dataArray['FreezableProtectionIndicator'] = $data->getFreezableProtectionIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class; + if ($data->isInitialized('limitedAccessPickupIndicator') && null !== $data->getLimitedAccessPickupIndicator()) { + $dataArray['LimitedAccessPickupIndicator'] = $data->getLimitedAccessPickupIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreezableProtectionIndicator', $data)) { - $object->setFreezableProtectionIndicator($data['FreezableProtectionIndicator']); - unset($data['FreezableProtectionIndicator']); - } - if (\array_key_exists('LimitedAccessPickupIndicator', $data)) { - $object->setLimitedAccessPickupIndicator($data['LimitedAccessPickupIndicator']); - unset($data['LimitedAccessPickupIndicator']); - } - if (\array_key_exists('LimitedAccessDeliveryIndicator', $data)) { - $object->setLimitedAccessDeliveryIndicator($data['LimitedAccessDeliveryIndicator']); - unset($data['LimitedAccessDeliveryIndicator']); - } - if (\array_key_exists('ExtremeLengthIndicator', $data)) { - $object->setExtremeLengthIndicator($data['ExtremeLengthIndicator']); - unset($data['ExtremeLengthIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('limitedAccessDeliveryIndicator') && null !== $data->getLimitedAccessDeliveryIndicator()) { + $dataArray['LimitedAccessDeliveryIndicator'] = $data->getLimitedAccessDeliveryIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('freezableProtectionIndicator') && null !== $object->getFreezableProtectionIndicator()) { - $data['FreezableProtectionIndicator'] = $object->getFreezableProtectionIndicator(); - } - if ($object->isInitialized('limitedAccessPickupIndicator') && null !== $object->getLimitedAccessPickupIndicator()) { - $data['LimitedAccessPickupIndicator'] = $object->getLimitedAccessPickupIndicator(); - } - if ($object->isInitialized('limitedAccessDeliveryIndicator') && null !== $object->getLimitedAccessDeliveryIndicator()) { - $data['LimitedAccessDeliveryIndicator'] = $object->getLimitedAccessDeliveryIndicator(); - } - if ($object->isInitialized('extremeLengthIndicator') && null !== $object->getExtremeLengthIndicator()) { - $data['ExtremeLengthIndicator'] = $object->getExtremeLengthIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('extremeLengthIndicator') && null !== $data->getExtremeLengthIndicator()) { + $dataArray['ExtremeLengthIndicator'] = $data->getExtremeLengthIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightPickupResponseNormalizer.php b/src/Api/Normalizer/FreightPickupResponseNormalizer.php index 4984a38a..544f7aa5 100644 --- a/src/Api/Normalizer/FreightPickupResponseNormalizer.php +++ b/src/Api/Normalizer/FreightPickupResponseNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightPickupResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightPickupResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupResponse::class; + return $type === \ShipStream\Ups\Api\Model\FreightPickupResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('PickupRequestConfirmationNumber', $data)) { - $object->setPickupRequestConfirmationNumber($data['PickupRequestConfirmationNumber']); - unset($data['PickupRequestConfirmationNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightPickupResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['PickupRequestConfirmationNumber'] = $object->getPickupRequestConfirmationNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupResponse::class => false]; - } - } -} else { - class FreightPickupResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupResponse::class; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class, 'json', $context)); + unset($data['Response']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupResponse::class; + if (\array_key_exists('PickupRequestConfirmationNumber', $data)) { + $object->setPickupRequestConfirmationNumber($data['PickupRequestConfirmationNumber']); + unset($data['PickupRequestConfirmationNumber']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('PickupRequestConfirmationNumber', $data)) { - $object->setPickupRequestConfirmationNumber($data['PickupRequestConfirmationNumber']); - unset($data['PickupRequestConfirmationNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['PickupRequestConfirmationNumber'] = $object->getPickupRequestConfirmationNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + $dataArray['PickupRequestConfirmationNumber'] = $data->getPickupRequestConfirmationNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightPickupResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightPickupResponseResponseNormalizer.php b/src/Api/Normalizer/FreightPickupResponseResponseNormalizer.php index 5f6df3f9..7f15f8d1 100644 --- a/src/Api/Normalizer/FreightPickupResponseResponseNormalizer.php +++ b/src/Api/Normalizer/FreightPickupResponseResponseNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightPickupResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightPickupResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightPickupResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class => false]; + if (\array_key_exists('Alert', $data)) { + $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); + unset($data['Alert']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightPickupResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $dataArray['Alert'] = $this->normalizer->normalize($data->getAlert(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightPickupShipToAddressNormalizer.php b/src/Api/Normalizer/FreightPickupShipToAddressNormalizer.php index 526d3b7e..582eb7e5 100644 --- a/src/Api/Normalizer/FreightPickupShipToAddressNormalizer.php +++ b/src/Api/Normalizer/FreightPickupShipToAddressNormalizer.php @@ -5,202 +5,100 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightPickupShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightPickupShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class; + return $type === \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightPickupShipToAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); + if (\array_key_exists('AddressLine', $data)) { + $values = []; + foreach ($data['AddressLine'] as $value) { + $values[] = $value; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } - } -} else { - class FreightPickupShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class; + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightPickupShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('addressLine') && null !== $data->getAddressLine()) { + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - return $data; + $dataArray['AddressLine'] = $values; + } + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); + } + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class => false]; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } + if ($data->isInitialized('countryCode') && null !== $data->getCountryCode()) { + $dataArray['CountryCode'] = $data->getCountryCode(); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateCODRemitToNormalizer.php b/src/Api/Normalizer/FreightRateCODRemitToNormalizer.php index 2c58fc94..8218969f 100644 --- a/src/Api/Normalizer/FreightRateCODRemitToNormalizer.php +++ b/src/Api/Normalizer/FreightRateCODRemitToNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateCODRemitToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateCODRemitToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateCODRemitTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\RemitToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateCODRemitTo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class => false]; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - } -} else { - class FreightRateCODRemitToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\RemitToAddress::class, 'json', $context)); + unset($data['Address']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class; + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateCODRemitTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\RemitToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Name'] = $data->getName(); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRatePaymentInformationPayerNormalizer.php b/src/Api/Normalizer/FreightRatePaymentInformationPayerNormalizer.php index ce592c92..ae1a4f22 100644 --- a/src/Api/Normalizer/FreightRatePaymentInformationPayerNormalizer.php +++ b/src/Api/Normalizer/FreightRatePaymentInformationPayerNormalizer.php @@ -5,164 +5,81 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRatePaymentInformationPayerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRatePaymentInformationPayerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class; + return $type === \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\PayerAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('shipperNumber') && null !== $object->getShipperNumber()) { - $data['ShipperNumber'] = $object->getShipperNumber(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class => false]; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\PayerAddress::class, 'json', $context)); + unset($data['Address']); } - } -} else { - class FreightRatePaymentInformationPayerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class; + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class; + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\PayerAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('shipperNumber') && null !== $object->getShipperNumber()) { - $data['ShipperNumber'] = $object->getShipperNumber(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Name'] = $data->getName(); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + if ($data->isInitialized('shipperNumber') && null !== $data->getShipperNumber()) { + $dataArray['ShipperNumber'] = $data->getShipperNumber(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class => false]; + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestAlternateRateOptionsNormalizer.php b/src/Api/Normalizer/FreightRateRequestAlternateRateOptionsNormalizer.php index defa70fc..babdeb50 100644 --- a/src/Api/Normalizer/FreightRateRequestAlternateRateOptionsNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestAlternateRateOptionsNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestAlternateRateOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestAlternateRateOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FreightRateRequestAlternateRateOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestCommodityNormalizer.php b/src/Api/Normalizer/FreightRateRequestCommodityNormalizer.php index 45b62b36..9914c0d7 100644 --- a/src/Api/Normalizer/FreightRateRequestCommodityNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestCommodityNormalizer.php @@ -5,268 +5,133 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestCommodity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CommodityID', $data)) { - $object->setCommodityID($data['CommodityID']); - unset($data['CommodityID']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($this->denormalizer->denormalize($data['Weight'], \ShipStream\Ups\Api\Model\CommodityWeight::class, 'json', $context)); - unset($data['Weight']); - } - if (\array_key_exists('AdjustedWeight', $data)) { - $object->setAdjustedWeight($this->denormalizer->denormalize($data['AdjustedWeight'], \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class, 'json', $context)); - unset($data['AdjustedWeight']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\CommodityDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('NumberOfPieces', $data)) { - $object->setNumberOfPieces($data['NumberOfPieces']); - unset($data['NumberOfPieces']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\CommodityPackagingType::class, 'json', $context)); - unset($data['PackagingType']); - } - if (\array_key_exists('DangerousGoodsIndicator', $data)) { - $object->setDangerousGoodsIndicator($data['DangerousGoodsIndicator']); - unset($data['DangerousGoodsIndicator']); - } - if (\array_key_exists('CommodityValue', $data)) { - $object->setCommodityValue($this->denormalizer->denormalize($data['CommodityValue'], \ShipStream\Ups\Api\Model\CommodityCommodityValue::class, 'json', $context)); - unset($data['CommodityValue']); - } - if (\array_key_exists('FreightClass', $data)) { - $object->setFreightClass($data['FreightClass']); - unset($data['FreightClass']); - } - if (\array_key_exists('NMFCCommodityCode', $data)) { - $object->setNMFCCommodityCode($data['NMFCCommodityCode']); - unset($data['NMFCCommodityCode']); - } - if (\array_key_exists('NMFCCommodity', $data)) { - $object->setNMFCCommodity($this->denormalizer->denormalize($data['NMFCCommodity'], \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class, 'json', $context)); - unset($data['NMFCCommodity']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestCommodity(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('commodityID') && null !== $object->getCommodityID()) { - $data['CommodityID'] = $object->getCommodityID(); - } - $data['Description'] = $object->getDescription(); - $data['Weight'] = $this->normalizer->normalize($object->getWeight(), 'json', $context); - if ($object->isInitialized('adjustedWeight') && null !== $object->getAdjustedWeight()) { - $data['AdjustedWeight'] = $this->normalizer->normalize($object->getAdjustedWeight(), 'json', $context); - } - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - $data['NumberOfPieces'] = $object->getNumberOfPieces(); - $data['PackagingType'] = $this->normalizer->normalize($object->getPackagingType(), 'json', $context); - if ($object->isInitialized('dangerousGoodsIndicator') && null !== $object->getDangerousGoodsIndicator()) { - $data['DangerousGoodsIndicator'] = $object->getDangerousGoodsIndicator(); - } - if ($object->isInitialized('commodityValue') && null !== $object->getCommodityValue()) { - $data['CommodityValue'] = $this->normalizer->normalize($object->getCommodityValue(), 'json', $context); - } - if ($object->isInitialized('freightClass') && null !== $object->getFreightClass()) { - $data['FreightClass'] = $object->getFreightClass(); - } - if ($object->isInitialized('nMFCCommodityCode') && null !== $object->getNMFCCommodityCode()) { - $data['NMFCCommodityCode'] = $object->getNMFCCommodityCode(); - } - if ($object->isInitialized('nMFCCommodity') && null !== $object->getNMFCCommodity()) { - $data['NMFCCommodity'] = $this->normalizer->normalize($object->getNMFCCommodity(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CommodityID', $data)) { + $object->setCommodityID($data['CommodityID']); + unset($data['CommodityID']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); + } + if (\array_key_exists('Weight', $data)) { + $object->setWeight($this->denormalizer->denormalize($data['Weight'], \ShipStream\Ups\Api\Model\CommodityWeight::class, 'json', $context)); + unset($data['Weight']); + } + if (\array_key_exists('AdjustedWeight', $data)) { + $object->setAdjustedWeight($this->denormalizer->denormalize($data['AdjustedWeight'], \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class, 'json', $context)); + unset($data['AdjustedWeight']); + } + if (\array_key_exists('Dimensions', $data)) { + $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\CommodityDimensions::class, 'json', $context)); + unset($data['Dimensions']); + } + if (\array_key_exists('NumberOfPieces', $data)) { + $object->setNumberOfPieces($data['NumberOfPieces']); + unset($data['NumberOfPieces']); + } + if (\array_key_exists('PackagingType', $data)) { + $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\CommodityPackagingType::class, 'json', $context)); + unset($data['PackagingType']); + } + if (\array_key_exists('DangerousGoodsIndicator', $data)) { + $object->setDangerousGoodsIndicator($data['DangerousGoodsIndicator']); + unset($data['DangerousGoodsIndicator']); + } + if (\array_key_exists('CommodityValue', $data)) { + $object->setCommodityValue($this->denormalizer->denormalize($data['CommodityValue'], \ShipStream\Ups\Api\Model\CommodityCommodityValue::class, 'json', $context)); + unset($data['CommodityValue']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class => false]; + if (\array_key_exists('FreightClass', $data)) { + $object->setFreightClass($data['FreightClass']); + unset($data['FreightClass']); } + if (\array_key_exists('NMFCCommodityCode', $data)) { + $object->setNMFCCommodityCode($data['NMFCCommodityCode']); + unset($data['NMFCCommodityCode']); + } + if (\array_key_exists('NMFCCommodity', $data)) { + $object->setNMFCCommodity($this->denormalizer->denormalize($data['NMFCCommodity'], \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class, 'json', $context)); + unset($data['NMFCCommodity']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightRateRequestCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class; + $dataArray = []; + if ($data->isInitialized('commodityID') && null !== $data->getCommodityID()) { + $dataArray['CommodityID'] = $data->getCommodityID(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class; + $dataArray['Description'] = $data->getDescription(); + $dataArray['Weight'] = $this->normalizer->normalize($data->getWeight(), 'json', $context); + if ($data->isInitialized('adjustedWeight') && null !== $data->getAdjustedWeight()) { + $dataArray['AdjustedWeight'] = $this->normalizer->normalize($data->getAdjustedWeight(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestCommodity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CommodityID', $data)) { - $object->setCommodityID($data['CommodityID']); - unset($data['CommodityID']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($this->denormalizer->denormalize($data['Weight'], \ShipStream\Ups\Api\Model\CommodityWeight::class, 'json', $context)); - unset($data['Weight']); - } - if (\array_key_exists('AdjustedWeight', $data)) { - $object->setAdjustedWeight($this->denormalizer->denormalize($data['AdjustedWeight'], \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class, 'json', $context)); - unset($data['AdjustedWeight']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\CommodityDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('NumberOfPieces', $data)) { - $object->setNumberOfPieces($data['NumberOfPieces']); - unset($data['NumberOfPieces']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\CommodityPackagingType::class, 'json', $context)); - unset($data['PackagingType']); - } - if (\array_key_exists('DangerousGoodsIndicator', $data)) { - $object->setDangerousGoodsIndicator($data['DangerousGoodsIndicator']); - unset($data['DangerousGoodsIndicator']); - } - if (\array_key_exists('CommodityValue', $data)) { - $object->setCommodityValue($this->denormalizer->denormalize($data['CommodityValue'], \ShipStream\Ups\Api\Model\CommodityCommodityValue::class, 'json', $context)); - unset($data['CommodityValue']); - } - if (\array_key_exists('FreightClass', $data)) { - $object->setFreightClass($data['FreightClass']); - unset($data['FreightClass']); - } - if (\array_key_exists('NMFCCommodityCode', $data)) { - $object->setNMFCCommodityCode($data['NMFCCommodityCode']); - unset($data['NMFCCommodityCode']); - } - if (\array_key_exists('NMFCCommodity', $data)) { - $object->setNMFCCommodity($this->denormalizer->denormalize($data['NMFCCommodity'], \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class, 'json', $context)); - unset($data['NMFCCommodity']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('dimensions') && null !== $data->getDimensions()) { + $dataArray['Dimensions'] = $this->normalizer->normalize($data->getDimensions(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('commodityID') && null !== $object->getCommodityID()) { - $data['CommodityID'] = $object->getCommodityID(); - } - $data['Description'] = $object->getDescription(); - $data['Weight'] = $this->normalizer->normalize($object->getWeight(), 'json', $context); - if ($object->isInitialized('adjustedWeight') && null !== $object->getAdjustedWeight()) { - $data['AdjustedWeight'] = $this->normalizer->normalize($object->getAdjustedWeight(), 'json', $context); - } - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - $data['NumberOfPieces'] = $object->getNumberOfPieces(); - $data['PackagingType'] = $this->normalizer->normalize($object->getPackagingType(), 'json', $context); - if ($object->isInitialized('dangerousGoodsIndicator') && null !== $object->getDangerousGoodsIndicator()) { - $data['DangerousGoodsIndicator'] = $object->getDangerousGoodsIndicator(); - } - if ($object->isInitialized('commodityValue') && null !== $object->getCommodityValue()) { - $data['CommodityValue'] = $this->normalizer->normalize($object->getCommodityValue(), 'json', $context); - } - if ($object->isInitialized('freightClass') && null !== $object->getFreightClass()) { - $data['FreightClass'] = $object->getFreightClass(); - } - if ($object->isInitialized('nMFCCommodityCode') && null !== $object->getNMFCCommodityCode()) { - $data['NMFCCommodityCode'] = $object->getNMFCCommodityCode(); - } - if ($object->isInitialized('nMFCCommodity') && null !== $object->getNMFCCommodity()) { - $data['NMFCCommodity'] = $this->normalizer->normalize($object->getNMFCCommodity(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + $dataArray['NumberOfPieces'] = $data->getNumberOfPieces(); + $dataArray['PackagingType'] = $this->normalizer->normalize($data->getPackagingType(), 'json', $context); + if ($data->isInitialized('dangerousGoodsIndicator') && null !== $data->getDangerousGoodsIndicator()) { + $dataArray['DangerousGoodsIndicator'] = $data->getDangerousGoodsIndicator(); + } + if ($data->isInitialized('commodityValue') && null !== $data->getCommodityValue()) { + $dataArray['CommodityValue'] = $this->normalizer->normalize($data->getCommodityValue(), 'json', $context); + } + if ($data->isInitialized('freightClass') && null !== $data->getFreightClass()) { + $dataArray['FreightClass'] = $data->getFreightClass(); + } + if ($data->isInitialized('nMFCCommodityCode') && null !== $data->getNMFCCommodityCode()) { + $dataArray['NMFCCommodityCode'] = $data->getNMFCCommodityCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class => false]; + if ($data->isInitialized('nMFCCommodity') && null !== $data->getNMFCCommodity()) { + $dataArray['NMFCCommodity'] = $this->normalizer->normalize($data->getNMFCCommodity(), 'json', $context); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestGFPOptionsNormalizer.php b/src/Api/Normalizer/FreightRateRequestGFPOptionsNormalizer.php index 8b3e4c11..7ba5beb9 100644 --- a/src/Api/Normalizer/FreightRateRequestGFPOptionsNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestGFPOptionsNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestGFPOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestGFPOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('GPFAccesorialRateIndicator', $data)) { - $object->setGPFAccesorialRateIndicator($data['GPFAccesorialRateIndicator']); - unset($data['GPFAccesorialRateIndicator']); - } - if (\array_key_exists('OnCallInformation', $data)) { - $object->setOnCallInformation($this->denormalizer->denormalize($data['OnCallInformation'], \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class, 'json', $context)); - unset($data['OnCallInformation']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('gPFAccesorialRateIndicator') && null !== $object->getGPFAccesorialRateIndicator()) { - $data['GPFAccesorialRateIndicator'] = $object->getGPFAccesorialRateIndicator(); - } - if ($object->isInitialized('onCallInformation') && null !== $object->getOnCallInformation()) { - $data['OnCallInformation'] = $this->normalizer->normalize($object->getOnCallInformation(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('GPFAccesorialRateIndicator', $data)) { + $object->setGPFAccesorialRateIndicator($data['GPFAccesorialRateIndicator']); + unset($data['GPFAccesorialRateIndicator']); + } + if (\array_key_exists('OnCallInformation', $data)) { + $object->setOnCallInformation($this->denormalizer->denormalize($data['OnCallInformation'], \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class, 'json', $context)); + unset($data['OnCallInformation']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FreightRateRequestGFPOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class; + $dataArray = []; + if ($data->isInitialized('gPFAccesorialRateIndicator') && null !== $data->getGPFAccesorialRateIndicator()) { + $dataArray['GPFAccesorialRateIndicator'] = $data->getGPFAccesorialRateIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('GPFAccesorialRateIndicator', $data)) { - $object->setGPFAccesorialRateIndicator($data['GPFAccesorialRateIndicator']); - unset($data['GPFAccesorialRateIndicator']); - } - if (\array_key_exists('OnCallInformation', $data)) { - $object->setOnCallInformation($this->denormalizer->denormalize($data['OnCallInformation'], \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class, 'json', $context)); - unset($data['OnCallInformation']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('onCallInformation') && null !== $data->getOnCallInformation()) { + $dataArray['OnCallInformation'] = $this->normalizer->normalize($data->getOnCallInformation(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('gPFAccesorialRateIndicator') && null !== $object->getGPFAccesorialRateIndicator()) { - $data['GPFAccesorialRateIndicator'] = $object->getGPFAccesorialRateIndicator(); - } - if ($object->isInitialized('onCallInformation') && null !== $object->getOnCallInformation()) { - $data['OnCallInformation'] = $this->normalizer->normalize($object->getOnCallInformation(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestHandlingUnitOneNormalizer.php b/src/Api/Normalizer/FreightRateRequestHandlingUnitOneNormalizer.php index 78c4881f..dc196acc 100644 --- a/src/Api/Normalizer/FreightRateRequestHandlingUnitOneNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestHandlingUnitOneNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestHandlingUnitOneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestHandlingUnitOneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitOneType::class, 'json', $context)); - unset($data['Type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class => false]; - } - } -} else { - class FreightRateRequestHandlingUnitOneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class; + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitOneType::class, 'json', $context)); + unset($data['Type']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitOneType::class, 'json', $context)); - unset($data['Type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Quantity'] = $data->getQuantity(); + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestHandlingUnitTwoNormalizer.php b/src/Api/Normalizer/FreightRateRequestHandlingUnitTwoNormalizer.php index 7dca9797..f354335f 100644 --- a/src/Api/Normalizer/FreightRateRequestHandlingUnitTwoNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestHandlingUnitTwoNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestHandlingUnitTwoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestHandlingUnitTwoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class, 'json', $context)); - unset($data['Type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class => false]; - } - } -} else { - class FreightRateRequestHandlingUnitTwoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class; + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class, 'json', $context)); + unset($data['Type']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class, 'json', $context)); - unset($data['Type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Quantity'] = $data->getQuantity(); + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestHandlingUnitWeightNormalizer.php b/src/Api/Normalizer/FreightRateRequestHandlingUnitWeightNormalizer.php index daea0933..0bb5c200 100644 --- a/src/Api/Normalizer/FreightRateRequestHandlingUnitWeightNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestHandlingUnitWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestHandlingUnitWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestHandlingUnitWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class => false]; - } - } -} else { - class FreightRateRequestHandlingUnitWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Value'] = $data->getValue(); + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestHandlingUnitsNormalizer.php b/src/Api/Normalizer/FreightRateRequestHandlingUnitsNormalizer.php index 55236077..3466dd78 100644 --- a/src/Api/Normalizer/FreightRateRequestHandlingUnitsNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestHandlingUnitsNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class => false]; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); + unset($data['Type']); } - } -} else { - class FreightRateRequestHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class; + if (\array_key_exists('Dimensions', $data)) { + $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); + unset($data['Dimensions']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Quantity'] = $data->getQuantity(); + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + $dataArray['Dimensions'] = $this->normalizer->normalize($data->getDimensions(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestNormalizer.php b/src/Api/Normalizer/FreightRateRequestNormalizer.php index 77ceff55..144ac9c8 100644 --- a/src/Api/Normalizer/FreightRateRequestNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestNormalizer.php @@ -5,390 +5,194 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequest::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('ShipFrom', $data)) { - $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class, 'json', $context)); - unset($data['ShipFrom']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('PaymentInformation', $data)) { - $object->setPaymentInformation($this->denormalizer->denormalize($data['PaymentInformation'], \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class, 'json', $context)); - unset($data['PaymentInformation']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\FreightRateRequestService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('HandlingUnitOne', $data)) { - $object->setHandlingUnitOne($this->denormalizer->denormalize($data['HandlingUnitOne'], \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class, 'json', $context)); - unset($data['HandlingUnitOne']); - } - if (\array_key_exists('HandlingUnitTwo', $data)) { - $object->setHandlingUnitTwo($this->denormalizer->denormalize($data['HandlingUnitTwo'], \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class, 'json', $context)); - unset($data['HandlingUnitTwo']); - } - if (\array_key_exists('Commodity', $data)) { - $values = []; - foreach ($data['Commodity'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class, 'json', $context); - } - $object->setCommodity($values); - unset($data['Commodity']); - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('PickupRequest', $data)) { - $object->setPickupRequest($this->denormalizer->denormalize($data['PickupRequest'], \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class, 'json', $context)); - unset($data['PickupRequest']); - } - if (\array_key_exists('AlternateRateOptions', $data)) { - $object->setAlternateRateOptions($this->denormalizer->denormalize($data['AlternateRateOptions'], \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class, 'json', $context)); - unset($data['AlternateRateOptions']); - } - if (\array_key_exists('GFPOptions', $data)) { - $object->setGFPOptions($this->denormalizer->denormalize($data['GFPOptions'], \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class, 'json', $context)); - unset($data['GFPOptions']); - } - if (\array_key_exists('HandlingUnitWeight', $data)) { - $object->setHandlingUnitWeight($this->denormalizer->denormalize($data['HandlingUnitWeight'], \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class, 'json', $context)); - unset($data['HandlingUnitWeight']); - } - if (\array_key_exists('AdjustedWeightIndicator', $data)) { - $object->setAdjustedWeightIndicator($data['AdjustedWeightIndicator']); - unset($data['AdjustedWeightIndicator']); - } - if (\array_key_exists('TimeInTransitIndicator', $data)) { - $object->setTimeInTransitIndicator($data['TimeInTransitIndicator']); - unset($data['TimeInTransitIndicator']); - } - if (\array_key_exists('HandlingUnits', $data)) { - $values_1 = []; - foreach ($data['HandlingUnits'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class, 'json', $context); - } - $object->setHandlingUnits($values_1); - unset($data['HandlingUnits']); - } - if (\array_key_exists('AdjustedHeightIndicator', $data)) { - $object->setAdjustedHeightIndicator($data['AdjustedHeightIndicator']); - unset($data['AdjustedHeightIndicator']); - } - if (\array_key_exists('DensityEligibleIndicator', $data)) { - $object->setDensityEligibleIndicator($data['DensityEligibleIndicator']); - unset($data['DensityEligibleIndicator']); - } - if (\array_key_exists('QuoteNumberIndicator', $data)) { - $object->setQuoteNumberIndicator($data['QuoteNumberIndicator']); - unset($data['QuoteNumberIndicator']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + return $type === \ShipStream\Ups\Api\Model\FreightRateRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['ShipFrom'] = $this->normalizer->normalize($object->getShipFrom(), 'json', $context); - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - $data['PaymentInformation'] = $this->normalizer->normalize($object->getPaymentInformation(), 'json', $context); - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - if ($object->isInitialized('handlingUnitOne') && null !== $object->getHandlingUnitOne()) { - $data['HandlingUnitOne'] = $this->normalizer->normalize($object->getHandlingUnitOne(), 'json', $context); - } - if ($object->isInitialized('handlingUnitTwo') && null !== $object->getHandlingUnitTwo()) { - $data['HandlingUnitTwo'] = $this->normalizer->normalize($object->getHandlingUnitTwo(), 'json', $context); - } + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class, 'json', $context)); + unset($data['Request']); + } + if (\array_key_exists('ShipFrom', $data)) { + $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class, 'json', $context)); + unset($data['ShipFrom']); + } + if (\array_key_exists('ShipTo', $data)) { + $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class, 'json', $context)); + unset($data['ShipTo']); + } + if (\array_key_exists('PaymentInformation', $data)) { + $object->setPaymentInformation($this->denormalizer->denormalize($data['PaymentInformation'], \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class, 'json', $context)); + unset($data['PaymentInformation']); + } + if (\array_key_exists('Service', $data)) { + $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\FreightRateRequestService::class, 'json', $context)); + unset($data['Service']); + } + if (\array_key_exists('HandlingUnitOne', $data)) { + $object->setHandlingUnitOne($this->denormalizer->denormalize($data['HandlingUnitOne'], \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class, 'json', $context)); + unset($data['HandlingUnitOne']); + } + if (\array_key_exists('HandlingUnitTwo', $data)) { + $object->setHandlingUnitTwo($this->denormalizer->denormalize($data['HandlingUnitTwo'], \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class, 'json', $context)); + unset($data['HandlingUnitTwo']); + } + if (\array_key_exists('Commodity', $data)) { $values = []; - foreach ($object->getCommodity() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Commodity'] = $values; - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('pickupRequest') && null !== $object->getPickupRequest()) { - $data['PickupRequest'] = $this->normalizer->normalize($object->getPickupRequest(), 'json', $context); - } - if ($object->isInitialized('alternateRateOptions') && null !== $object->getAlternateRateOptions()) { - $data['AlternateRateOptions'] = $this->normalizer->normalize($object->getAlternateRateOptions(), 'json', $context); - } - if ($object->isInitialized('gFPOptions') && null !== $object->getGFPOptions()) { - $data['GFPOptions'] = $this->normalizer->normalize($object->getGFPOptions(), 'json', $context); - } - if ($object->isInitialized('handlingUnitWeight') && null !== $object->getHandlingUnitWeight()) { - $data['HandlingUnitWeight'] = $this->normalizer->normalize($object->getHandlingUnitWeight(), 'json', $context); - } - if ($object->isInitialized('adjustedWeightIndicator') && null !== $object->getAdjustedWeightIndicator()) { - $data['AdjustedWeightIndicator'] = $object->getAdjustedWeightIndicator(); + foreach ($data['Commodity'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class, 'json', $context); } - if ($object->isInitialized('timeInTransitIndicator') && null !== $object->getTimeInTransitIndicator()) { - $data['TimeInTransitIndicator'] = $object->getTimeInTransitIndicator(); - } - if ($object->isInitialized('handlingUnits') && null !== $object->getHandlingUnits()) { - $values_1 = []; - foreach ($object->getHandlingUnits() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['HandlingUnits'] = $values_1; - } - if ($object->isInitialized('adjustedHeightIndicator') && null !== $object->getAdjustedHeightIndicator()) { - $data['AdjustedHeightIndicator'] = $object->getAdjustedHeightIndicator(); - } - if ($object->isInitialized('densityEligibleIndicator') && null !== $object->getDensityEligibleIndicator()) { - $data['DensityEligibleIndicator'] = $object->getDensityEligibleIndicator(); - } - if ($object->isInitialized('quoteNumberIndicator') && null !== $object->getQuoteNumberIndicator()) { - $data['QuoteNumberIndicator'] = $object->getQuoteNumberIndicator(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setCommodity($values); + unset($data['Commodity']); + } + if (\array_key_exists('ShipmentServiceOptions', $data)) { + $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class, 'json', $context)); + unset($data['ShipmentServiceOptions']); + } + if (\array_key_exists('PickupRequest', $data)) { + $object->setPickupRequest($this->denormalizer->denormalize($data['PickupRequest'], \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class, 'json', $context)); + unset($data['PickupRequest']); + } + if (\array_key_exists('AlternateRateOptions', $data)) { + $object->setAlternateRateOptions($this->denormalizer->denormalize($data['AlternateRateOptions'], \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class, 'json', $context)); + unset($data['AlternateRateOptions']); + } + if (\array_key_exists('GFPOptions', $data)) { + $object->setGFPOptions($this->denormalizer->denormalize($data['GFPOptions'], \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class, 'json', $context)); + unset($data['GFPOptions']); + } + if (\array_key_exists('HandlingUnitWeight', $data)) { + $object->setHandlingUnitWeight($this->denormalizer->denormalize($data['HandlingUnitWeight'], \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class, 'json', $context)); + unset($data['HandlingUnitWeight']); + } + if (\array_key_exists('AdjustedWeightIndicator', $data)) { + $object->setAdjustedWeightIndicator($data['AdjustedWeightIndicator']); + unset($data['AdjustedWeightIndicator']); + } + if (\array_key_exists('TimeInTransitIndicator', $data)) { + $object->setTimeInTransitIndicator($data['TimeInTransitIndicator']); + unset($data['TimeInTransitIndicator']); + } + if (\array_key_exists('HandlingUnits', $data)) { + $values_1 = []; + foreach ($data['HandlingUnits'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class, 'json', $context); } - return $data; + $object->setHandlingUnits($values_1); + unset($data['HandlingUnits']); + } + if (\array_key_exists('AdjustedHeightIndicator', $data)) { + $object->setAdjustedHeightIndicator($data['AdjustedHeightIndicator']); + unset($data['AdjustedHeightIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequest::class => false]; + if (\array_key_exists('DensityEligibleIndicator', $data)) { + $object->setDensityEligibleIndicator($data['DensityEligibleIndicator']); + unset($data['DensityEligibleIndicator']); } + if (\array_key_exists('QuoteNumberIndicator', $data)) { + $object->setQuoteNumberIndicator($data['QuoteNumberIndicator']); + unset($data['QuoteNumberIndicator']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } -} else { - class FreightRateRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('ShipFrom', $data)) { - $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class, 'json', $context)); - unset($data['ShipFrom']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('PaymentInformation', $data)) { - $object->setPaymentInformation($this->denormalizer->denormalize($data['PaymentInformation'], \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class, 'json', $context)); - unset($data['PaymentInformation']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\FreightRateRequestService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('HandlingUnitOne', $data)) { - $object->setHandlingUnitOne($this->denormalizer->denormalize($data['HandlingUnitOne'], \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class, 'json', $context)); - unset($data['HandlingUnitOne']); - } - if (\array_key_exists('HandlingUnitTwo', $data)) { - $object->setHandlingUnitTwo($this->denormalizer->denormalize($data['HandlingUnitTwo'], \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class, 'json', $context)); - unset($data['HandlingUnitTwo']); - } - if (\array_key_exists('Commodity', $data)) { - $values = []; - foreach ($data['Commodity'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class, 'json', $context); - } - $object->setCommodity($values); - unset($data['Commodity']); - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('PickupRequest', $data)) { - $object->setPickupRequest($this->denormalizer->denormalize($data['PickupRequest'], \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class, 'json', $context)); - unset($data['PickupRequest']); - } - if (\array_key_exists('AlternateRateOptions', $data)) { - $object->setAlternateRateOptions($this->denormalizer->denormalize($data['AlternateRateOptions'], \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class, 'json', $context)); - unset($data['AlternateRateOptions']); - } - if (\array_key_exists('GFPOptions', $data)) { - $object->setGFPOptions($this->denormalizer->denormalize($data['GFPOptions'], \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class, 'json', $context)); - unset($data['GFPOptions']); - } - if (\array_key_exists('HandlingUnitWeight', $data)) { - $object->setHandlingUnitWeight($this->denormalizer->denormalize($data['HandlingUnitWeight'], \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class, 'json', $context)); - unset($data['HandlingUnitWeight']); - } - if (\array_key_exists('AdjustedWeightIndicator', $data)) { - $object->setAdjustedWeightIndicator($data['AdjustedWeightIndicator']); - unset($data['AdjustedWeightIndicator']); - } - if (\array_key_exists('TimeInTransitIndicator', $data)) { - $object->setTimeInTransitIndicator($data['TimeInTransitIndicator']); - unset($data['TimeInTransitIndicator']); - } - if (\array_key_exists('HandlingUnits', $data)) { - $values_1 = []; - foreach ($data['HandlingUnits'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class, 'json', $context); - } - $object->setHandlingUnits($values_1); - unset($data['HandlingUnits']); - } - if (\array_key_exists('AdjustedHeightIndicator', $data)) { - $object->setAdjustedHeightIndicator($data['AdjustedHeightIndicator']); - unset($data['AdjustedHeightIndicator']); - } - if (\array_key_exists('DensityEligibleIndicator', $data)) { - $object->setDensityEligibleIndicator($data['DensityEligibleIndicator']); - unset($data['DensityEligibleIndicator']); - } - if (\array_key_exists('QuoteNumberIndicator', $data)) { - $object->setQuoteNumberIndicator($data['QuoteNumberIndicator']); - unset($data['QuoteNumberIndicator']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['ShipFrom'] = $this->normalizer->normalize($data->getShipFrom(), 'json', $context); + $dataArray['ShipTo'] = $this->normalizer->normalize($data->getShipTo(), 'json', $context); + $dataArray['PaymentInformation'] = $this->normalizer->normalize($data->getPaymentInformation(), 'json', $context); + $dataArray['Service'] = $this->normalizer->normalize($data->getService(), 'json', $context); + if ($data->isInitialized('handlingUnitOne') && null !== $data->getHandlingUnitOne()) { + $dataArray['HandlingUnitOne'] = $this->normalizer->normalize($data->getHandlingUnitOne(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['ShipFrom'] = $this->normalizer->normalize($object->getShipFrom(), 'json', $context); - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - $data['PaymentInformation'] = $this->normalizer->normalize($object->getPaymentInformation(), 'json', $context); - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - if ($object->isInitialized('handlingUnitOne') && null !== $object->getHandlingUnitOne()) { - $data['HandlingUnitOne'] = $this->normalizer->normalize($object->getHandlingUnitOne(), 'json', $context); - } - if ($object->isInitialized('handlingUnitTwo') && null !== $object->getHandlingUnitTwo()) { - $data['HandlingUnitTwo'] = $this->normalizer->normalize($object->getHandlingUnitTwo(), 'json', $context); - } - $values = []; - foreach ($object->getCommodity() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Commodity'] = $values; - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('pickupRequest') && null !== $object->getPickupRequest()) { - $data['PickupRequest'] = $this->normalizer->normalize($object->getPickupRequest(), 'json', $context); - } - if ($object->isInitialized('alternateRateOptions') && null !== $object->getAlternateRateOptions()) { - $data['AlternateRateOptions'] = $this->normalizer->normalize($object->getAlternateRateOptions(), 'json', $context); - } - if ($object->isInitialized('gFPOptions') && null !== $object->getGFPOptions()) { - $data['GFPOptions'] = $this->normalizer->normalize($object->getGFPOptions(), 'json', $context); - } - if ($object->isInitialized('handlingUnitWeight') && null !== $object->getHandlingUnitWeight()) { - $data['HandlingUnitWeight'] = $this->normalizer->normalize($object->getHandlingUnitWeight(), 'json', $context); - } - if ($object->isInitialized('adjustedWeightIndicator') && null !== $object->getAdjustedWeightIndicator()) { - $data['AdjustedWeightIndicator'] = $object->getAdjustedWeightIndicator(); - } - if ($object->isInitialized('timeInTransitIndicator') && null !== $object->getTimeInTransitIndicator()) { - $data['TimeInTransitIndicator'] = $object->getTimeInTransitIndicator(); - } - if ($object->isInitialized('handlingUnits') && null !== $object->getHandlingUnits()) { - $values_1 = []; - foreach ($object->getHandlingUnits() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['HandlingUnits'] = $values_1; - } - if ($object->isInitialized('adjustedHeightIndicator') && null !== $object->getAdjustedHeightIndicator()) { - $data['AdjustedHeightIndicator'] = $object->getAdjustedHeightIndicator(); - } - if ($object->isInitialized('densityEligibleIndicator') && null !== $object->getDensityEligibleIndicator()) { - $data['DensityEligibleIndicator'] = $object->getDensityEligibleIndicator(); - } - if ($object->isInitialized('quoteNumberIndicator') && null !== $object->getQuoteNumberIndicator()) { - $data['QuoteNumberIndicator'] = $object->getQuoteNumberIndicator(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + if ($data->isInitialized('handlingUnitTwo') && null !== $data->getHandlingUnitTwo()) { + $dataArray['HandlingUnitTwo'] = $this->normalizer->normalize($data->getHandlingUnitTwo(), 'json', $context); + } + $values = []; + foreach ($data->getCommodity() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Commodity'] = $values; + if ($data->isInitialized('shipmentServiceOptions') && null !== $data->getShipmentServiceOptions()) { + $dataArray['ShipmentServiceOptions'] = $this->normalizer->normalize($data->getShipmentServiceOptions(), 'json', $context); + } + if ($data->isInitialized('pickupRequest') && null !== $data->getPickupRequest()) { + $dataArray['PickupRequest'] = $this->normalizer->normalize($data->getPickupRequest(), 'json', $context); + } + if ($data->isInitialized('alternateRateOptions') && null !== $data->getAlternateRateOptions()) { + $dataArray['AlternateRateOptions'] = $this->normalizer->normalize($data->getAlternateRateOptions(), 'json', $context); + } + if ($data->isInitialized('gFPOptions') && null !== $data->getGFPOptions()) { + $dataArray['GFPOptions'] = $this->normalizer->normalize($data->getGFPOptions(), 'json', $context); + } + if ($data->isInitialized('handlingUnitWeight') && null !== $data->getHandlingUnitWeight()) { + $dataArray['HandlingUnitWeight'] = $this->normalizer->normalize($data->getHandlingUnitWeight(), 'json', $context); + } + if ($data->isInitialized('adjustedWeightIndicator') && null !== $data->getAdjustedWeightIndicator()) { + $dataArray['AdjustedWeightIndicator'] = $data->getAdjustedWeightIndicator(); + } + if ($data->isInitialized('timeInTransitIndicator') && null !== $data->getTimeInTransitIndicator()) { + $dataArray['TimeInTransitIndicator'] = $data->getTimeInTransitIndicator(); + } + if ($data->isInitialized('handlingUnits') && null !== $data->getHandlingUnits()) { + $values_1 = []; + foreach ($data->getHandlingUnits() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['HandlingUnits'] = $values_1; + } + if ($data->isInitialized('adjustedHeightIndicator') && null !== $data->getAdjustedHeightIndicator()) { + $dataArray['AdjustedHeightIndicator'] = $data->getAdjustedHeightIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequest::class => false]; + if ($data->isInitialized('densityEligibleIndicator') && null !== $data->getDensityEligibleIndicator()) { + $dataArray['DensityEligibleIndicator'] = $data->getDensityEligibleIndicator(); } + if ($data->isInitialized('quoteNumberIndicator') && null !== $data->getQuoteNumberIndicator()) { + $dataArray['QuoteNumberIndicator'] = $data->getQuoteNumberIndicator(); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestPaymentInformationNormalizer.php b/src/Api/Normalizer/FreightRateRequestPaymentInformationNormalizer.php index c88097f4..9b4866b1 100644 --- a/src/Api/Normalizer/FreightRateRequestPaymentInformationNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestPaymentInformationNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Payer', $data)) { - $object->setPayer($this->denormalizer->denormalize($data['Payer'], \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class, 'json', $context)); - unset($data['Payer']); - } - if (\array_key_exists('ShipmentBillingOption', $data)) { - $object->setShipmentBillingOption($this->denormalizer->denormalize($data['ShipmentBillingOption'], \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class, 'json', $context)); - unset($data['ShipmentBillingOption']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Payer'] = $this->normalizer->normalize($object->getPayer(), 'json', $context); - $data['ShipmentBillingOption'] = $this->normalizer->normalize($object->getShipmentBillingOption(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class => false]; - } - } -} else { - class FreightRateRequestPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class; + if (\array_key_exists('Payer', $data)) { + $object->setPayer($this->denormalizer->denormalize($data['Payer'], \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class, 'json', $context)); + unset($data['Payer']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class; + if (\array_key_exists('ShipmentBillingOption', $data)) { + $object->setShipmentBillingOption($this->denormalizer->denormalize($data['ShipmentBillingOption'], \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class, 'json', $context)); + unset($data['ShipmentBillingOption']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Payer', $data)) { - $object->setPayer($this->denormalizer->denormalize($data['Payer'], \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class, 'json', $context)); - unset($data['Payer']); - } - if (\array_key_exists('ShipmentBillingOption', $data)) { - $object->setShipmentBillingOption($this->denormalizer->denormalize($data['ShipmentBillingOption'], \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class, 'json', $context)); - unset($data['ShipmentBillingOption']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Payer'] = $this->normalizer->normalize($object->getPayer(), 'json', $context); - $data['ShipmentBillingOption'] = $this->normalizer->normalize($object->getShipmentBillingOption(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Payer'] = $this->normalizer->normalize($data->getPayer(), 'json', $context); + $dataArray['ShipmentBillingOption'] = $this->normalizer->normalize($data->getShipmentBillingOption(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestPickupRequestNormalizer.php b/src/Api/Normalizer/FreightRateRequestPickupRequestNormalizer.php index 06724f01..f74e3331 100644 --- a/src/Api/Normalizer/FreightRateRequestPickupRequestNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestPickupRequestNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestPickupRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestPickupRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - if (\array_key_exists('AdditionalComments', $data)) { - $object->setAdditionalComments($data['AdditionalComments']); - unset($data['AdditionalComments']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupDate'] = $object->getPickupDate(); - if ($object->isInitialized('additionalComments') && null !== $object->getAdditionalComments()) { - $data['AdditionalComments'] = $object->getAdditionalComments(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupDate', $data)) { + $object->setPickupDate($data['PickupDate']); + unset($data['PickupDate']); + } + if (\array_key_exists('AdditionalComments', $data)) { + $object->setAdditionalComments($data['AdditionalComments']); + unset($data['AdditionalComments']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FreightRateRequestPickupRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class; + $dataArray = []; + $dataArray['PickupDate'] = $data->getPickupDate(); + if ($data->isInitialized('additionalComments') && null !== $data->getAdditionalComments()) { + $dataArray['AdditionalComments'] = $data->getAdditionalComments(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('AdditionalComments', $data)) { - $object->setAdditionalComments($data['AdditionalComments']); - unset($data['AdditionalComments']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupDate'] = $object->getPickupDate(); - if ($object->isInitialized('additionalComments') && null !== $object->getAdditionalComments()) { - $data['AdditionalComments'] = $object->getAdditionalComments(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestRequestNormalizer.php b/src/Api/Normalizer/FreightRateRequestRequestNormalizer.php index b1cc397f..30cee16d 100644 --- a/src/Api/Normalizer/FreightRateRequestRequestNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestRequestNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); + } + if (\array_key_exists('SubVersion', $data)) { + $object->setSubVersion($data['SubVersion']); + unset($data['SubVersion']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestRequest::class => false]; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightRateRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('requestOption') && null !== $data->getRequestOption()) { + $dataArray['RequestOption'] = $data->getRequestOption(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class; + if ($data->isInitialized('subVersion') && null !== $data->getSubVersion()) { + $dataArray['SubVersion'] = $data->getSubVersion(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestServiceNormalizer.php b/src/Api/Normalizer/FreightRateRequestServiceNormalizer.php index d3067262..1a2249d2 100644 --- a/src/Api/Normalizer/FreightRateRequestServiceNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestServiceNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestService::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestService::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestService::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestService::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestService(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestService::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FreightRateRequestServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestService::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestService::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestService::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestService::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestShipFromNormalizer.php b/src/Api/Normalizer/FreightRateRequestShipFromNormalizer.php index 0a802944..ba953b0d 100644 --- a/src/Api/Normalizer/FreightRateRequestShipFromNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestShipFromNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class => false]; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class, 'json', $context)); + unset($data['Address']); } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightRateRequestShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class; + $dataArray = []; + if ($data->isInitialized('name') && null !== $data->getName()) { + $dataArray['Name'] = $data->getName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class; + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestShipToNormalizer.php b/src/Api/Normalizer/FreightRateRequestShipToNormalizer.php index ee6f2246..8148eea2 100644 --- a/src/Api/Normalizer/FreightRateRequestShipToNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestShipToNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestShipTo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class => false]; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class, 'json', $context)); + unset($data['Address']); } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightRateRequestShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class; + $dataArray = []; + if ($data->isInitialized('name') && null !== $data->getName()) { + $dataArray['Name'] = $data->getName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class; + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateRequestShipmentServiceOptionsNormalizer.php b/src/Api/Normalizer/FreightRateRequestShipmentServiceOptionsNormalizer.php index 481840fa..1575f559 100644 --- a/src/Api/Normalizer/FreightRateRequestShipmentServiceOptionsNormalizer.php +++ b/src/Api/Normalizer/FreightRateRequestShipmentServiceOptionsNormalizer.php @@ -5,284 +5,141 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateRequestShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateRequestShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupOptions', $data)) { - $object->setPickupOptions($this->denormalizer->denormalize($data['PickupOptions'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class, 'json', $context)); - unset($data['PickupOptions']); - } - if (\array_key_exists('DeliveryOptions', $data)) { - $object->setDeliveryOptions($this->denormalizer->denormalize($data['DeliveryOptions'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class, 'json', $context)); - unset($data['DeliveryOptions']); - } - if (\array_key_exists('OverSeasLeg', $data)) { - $object->setOverSeasLeg($this->denormalizer->denormalize($data['OverSeasLeg'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class, 'json', $context)); - unset($data['OverSeasLeg']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('DangerousGoods', $data)) { - $object->setDangerousGoods($this->denormalizer->denormalize($data['DangerousGoods'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class, 'json', $context)); - unset($data['DangerousGoods']); - } - if (\array_key_exists('SortingAndSegregating', $data)) { - $object->setSortingAndSegregating($this->denormalizer->denormalize($data['SortingAndSegregating'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class, 'json', $context)); - unset($data['SortingAndSegregating']); - } - if (\array_key_exists('ExcessDeclaredValue', $data)) { - $object->setExcessDeclaredValue($this->denormalizer->denormalize($data['ExcessDeclaredValue'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class, 'json', $context)); - unset($data['ExcessDeclaredValue']); - } - if (\array_key_exists('HandlingCharge', $data)) { - $object->setHandlingCharge($this->denormalizer->denormalize($data['HandlingCharge'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class, 'json', $context)); - unset($data['HandlingCharge']); - } - if (\array_key_exists('FreezableProtectionIndicator', $data)) { - $object->setFreezableProtectionIndicator($data['FreezableProtectionIndicator']); - unset($data['FreezableProtectionIndicator']); - } - if (\array_key_exists('ExtremeLengthIndicator', $data)) { - $object->setExtremeLengthIndicator($data['ExtremeLengthIndicator']); - unset($data['ExtremeLengthIndicator']); - } - if (\array_key_exists('LinearFeet', $data)) { - $object->setLinearFeet($data['LinearFeet']); - unset($data['LinearFeet']); - } - if (\array_key_exists('AdjustedHeight', $data)) { - $object->setAdjustedHeight($this->denormalizer->denormalize($data['AdjustedHeight'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class, 'json', $context)); - unset($data['AdjustedHeight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('pickupOptions') && null !== $object->getPickupOptions()) { - $data['PickupOptions'] = $this->normalizer->normalize($object->getPickupOptions(), 'json', $context); - } - if ($object->isInitialized('deliveryOptions') && null !== $object->getDeliveryOptions()) { - $data['DeliveryOptions'] = $this->normalizer->normalize($object->getDeliveryOptions(), 'json', $context); - } - if ($object->isInitialized('overSeasLeg') && null !== $object->getOverSeasLeg()) { - $data['OverSeasLeg'] = $this->normalizer->normalize($object->getOverSeasLeg(), 'json', $context); - } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('dangerousGoods') && null !== $object->getDangerousGoods()) { - $data['DangerousGoods'] = $this->normalizer->normalize($object->getDangerousGoods(), 'json', $context); - } - if ($object->isInitialized('sortingAndSegregating') && null !== $object->getSortingAndSegregating()) { - $data['SortingAndSegregating'] = $this->normalizer->normalize($object->getSortingAndSegregating(), 'json', $context); - } - if ($object->isInitialized('excessDeclaredValue') && null !== $object->getExcessDeclaredValue()) { - $data['ExcessDeclaredValue'] = $this->normalizer->normalize($object->getExcessDeclaredValue(), 'json', $context); - } - if ($object->isInitialized('handlingCharge') && null !== $object->getHandlingCharge()) { - $data['HandlingCharge'] = $this->normalizer->normalize($object->getHandlingCharge(), 'json', $context); - } - if ($object->isInitialized('freezableProtectionIndicator') && null !== $object->getFreezableProtectionIndicator()) { - $data['FreezableProtectionIndicator'] = $object->getFreezableProtectionIndicator(); - } - if ($object->isInitialized('extremeLengthIndicator') && null !== $object->getExtremeLengthIndicator()) { - $data['ExtremeLengthIndicator'] = $object->getExtremeLengthIndicator(); - } - if ($object->isInitialized('linearFeet') && null !== $object->getLinearFeet()) { - $data['LinearFeet'] = $object->getLinearFeet(); - } - if ($object->isInitialized('adjustedHeight') && null !== $object->getAdjustedHeight()) { - $data['AdjustedHeight'] = $this->normalizer->normalize($object->getAdjustedHeight(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupOptions', $data)) { + $object->setPickupOptions($this->denormalizer->denormalize($data['PickupOptions'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class, 'json', $context)); + unset($data['PickupOptions']); + } + if (\array_key_exists('DeliveryOptions', $data)) { + $object->setDeliveryOptions($this->denormalizer->denormalize($data['DeliveryOptions'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class, 'json', $context)); + unset($data['DeliveryOptions']); + } + if (\array_key_exists('OverSeasLeg', $data)) { + $object->setOverSeasLeg($this->denormalizer->denormalize($data['OverSeasLeg'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class, 'json', $context)); + unset($data['OverSeasLeg']); + } + if (\array_key_exists('COD', $data)) { + $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class, 'json', $context)); + unset($data['COD']); + } + if (\array_key_exists('DangerousGoods', $data)) { + $object->setDangerousGoods($this->denormalizer->denormalize($data['DangerousGoods'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class, 'json', $context)); + unset($data['DangerousGoods']); + } + if (\array_key_exists('SortingAndSegregating', $data)) { + $object->setSortingAndSegregating($this->denormalizer->denormalize($data['SortingAndSegregating'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class, 'json', $context)); + unset($data['SortingAndSegregating']); + } + if (\array_key_exists('ExcessDeclaredValue', $data)) { + $object->setExcessDeclaredValue($this->denormalizer->denormalize($data['ExcessDeclaredValue'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class, 'json', $context)); + unset($data['ExcessDeclaredValue']); + } + if (\array_key_exists('HandlingCharge', $data)) { + $object->setHandlingCharge($this->denormalizer->denormalize($data['HandlingCharge'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class, 'json', $context)); + unset($data['HandlingCharge']); + } + if (\array_key_exists('FreezableProtectionIndicator', $data)) { + $object->setFreezableProtectionIndicator($data['FreezableProtectionIndicator']); + unset($data['FreezableProtectionIndicator']); + } + if (\array_key_exists('ExtremeLengthIndicator', $data)) { + $object->setExtremeLengthIndicator($data['ExtremeLengthIndicator']); + unset($data['ExtremeLengthIndicator']); + } + if (\array_key_exists('LinearFeet', $data)) { + $object->setLinearFeet($data['LinearFeet']); + unset($data['LinearFeet']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class => false]; + if (\array_key_exists('AdjustedHeight', $data)) { + $object->setAdjustedHeight($this->denormalizer->denormalize($data['AdjustedHeight'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class, 'json', $context)); + unset($data['AdjustedHeight']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightRateRequestShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class; + $dataArray = []; + if ($data->isInitialized('pickupOptions') && null !== $data->getPickupOptions()) { + $dataArray['PickupOptions'] = $this->normalizer->normalize($data->getPickupOptions(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class; + if ($data->isInitialized('deliveryOptions') && null !== $data->getDeliveryOptions()) { + $dataArray['DeliveryOptions'] = $this->normalizer->normalize($data->getDeliveryOptions(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupOptions', $data)) { - $object->setPickupOptions($this->denormalizer->denormalize($data['PickupOptions'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class, 'json', $context)); - unset($data['PickupOptions']); - } - if (\array_key_exists('DeliveryOptions', $data)) { - $object->setDeliveryOptions($this->denormalizer->denormalize($data['DeliveryOptions'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class, 'json', $context)); - unset($data['DeliveryOptions']); - } - if (\array_key_exists('OverSeasLeg', $data)) { - $object->setOverSeasLeg($this->denormalizer->denormalize($data['OverSeasLeg'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class, 'json', $context)); - unset($data['OverSeasLeg']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('DangerousGoods', $data)) { - $object->setDangerousGoods($this->denormalizer->denormalize($data['DangerousGoods'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class, 'json', $context)); - unset($data['DangerousGoods']); - } - if (\array_key_exists('SortingAndSegregating', $data)) { - $object->setSortingAndSegregating($this->denormalizer->denormalize($data['SortingAndSegregating'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class, 'json', $context)); - unset($data['SortingAndSegregating']); - } - if (\array_key_exists('ExcessDeclaredValue', $data)) { - $object->setExcessDeclaredValue($this->denormalizer->denormalize($data['ExcessDeclaredValue'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class, 'json', $context)); - unset($data['ExcessDeclaredValue']); - } - if (\array_key_exists('HandlingCharge', $data)) { - $object->setHandlingCharge($this->denormalizer->denormalize($data['HandlingCharge'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class, 'json', $context)); - unset($data['HandlingCharge']); - } - if (\array_key_exists('FreezableProtectionIndicator', $data)) { - $object->setFreezableProtectionIndicator($data['FreezableProtectionIndicator']); - unset($data['FreezableProtectionIndicator']); - } - if (\array_key_exists('ExtremeLengthIndicator', $data)) { - $object->setExtremeLengthIndicator($data['ExtremeLengthIndicator']); - unset($data['ExtremeLengthIndicator']); - } - if (\array_key_exists('LinearFeet', $data)) { - $object->setLinearFeet($data['LinearFeet']); - unset($data['LinearFeet']); - } - if (\array_key_exists('AdjustedHeight', $data)) { - $object->setAdjustedHeight($this->denormalizer->denormalize($data['AdjustedHeight'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class, 'json', $context)); - unset($data['AdjustedHeight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('overSeasLeg') && null !== $data->getOverSeasLeg()) { + $dataArray['OverSeasLeg'] = $this->normalizer->normalize($data->getOverSeasLeg(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('pickupOptions') && null !== $object->getPickupOptions()) { - $data['PickupOptions'] = $this->normalizer->normalize($object->getPickupOptions(), 'json', $context); - } - if ($object->isInitialized('deliveryOptions') && null !== $object->getDeliveryOptions()) { - $data['DeliveryOptions'] = $this->normalizer->normalize($object->getDeliveryOptions(), 'json', $context); - } - if ($object->isInitialized('overSeasLeg') && null !== $object->getOverSeasLeg()) { - $data['OverSeasLeg'] = $this->normalizer->normalize($object->getOverSeasLeg(), 'json', $context); - } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('dangerousGoods') && null !== $object->getDangerousGoods()) { - $data['DangerousGoods'] = $this->normalizer->normalize($object->getDangerousGoods(), 'json', $context); - } - if ($object->isInitialized('sortingAndSegregating') && null !== $object->getSortingAndSegregating()) { - $data['SortingAndSegregating'] = $this->normalizer->normalize($object->getSortingAndSegregating(), 'json', $context); - } - if ($object->isInitialized('excessDeclaredValue') && null !== $object->getExcessDeclaredValue()) { - $data['ExcessDeclaredValue'] = $this->normalizer->normalize($object->getExcessDeclaredValue(), 'json', $context); - } - if ($object->isInitialized('handlingCharge') && null !== $object->getHandlingCharge()) { - $data['HandlingCharge'] = $this->normalizer->normalize($object->getHandlingCharge(), 'json', $context); - } - if ($object->isInitialized('freezableProtectionIndicator') && null !== $object->getFreezableProtectionIndicator()) { - $data['FreezableProtectionIndicator'] = $object->getFreezableProtectionIndicator(); - } - if ($object->isInitialized('extremeLengthIndicator') && null !== $object->getExtremeLengthIndicator()) { - $data['ExtremeLengthIndicator'] = $object->getExtremeLengthIndicator(); - } - if ($object->isInitialized('linearFeet') && null !== $object->getLinearFeet()) { - $data['LinearFeet'] = $object->getLinearFeet(); - } - if ($object->isInitialized('adjustedHeight') && null !== $object->getAdjustedHeight()) { - $data['AdjustedHeight'] = $this->normalizer->normalize($object->getAdjustedHeight(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('cOD') && null !== $data->getCOD()) { + $dataArray['COD'] = $this->normalizer->normalize($data->getCOD(), 'json', $context); + } + if ($data->isInitialized('dangerousGoods') && null !== $data->getDangerousGoods()) { + $dataArray['DangerousGoods'] = $this->normalizer->normalize($data->getDangerousGoods(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class => false]; + if ($data->isInitialized('sortingAndSegregating') && null !== $data->getSortingAndSegregating()) { + $dataArray['SortingAndSegregating'] = $this->normalizer->normalize($data->getSortingAndSegregating(), 'json', $context); } + if ($data->isInitialized('excessDeclaredValue') && null !== $data->getExcessDeclaredValue()) { + $dataArray['ExcessDeclaredValue'] = $this->normalizer->normalize($data->getExcessDeclaredValue(), 'json', $context); + } + if ($data->isInitialized('handlingCharge') && null !== $data->getHandlingCharge()) { + $dataArray['HandlingCharge'] = $this->normalizer->normalize($data->getHandlingCharge(), 'json', $context); + } + if ($data->isInitialized('freezableProtectionIndicator') && null !== $data->getFreezableProtectionIndicator()) { + $dataArray['FreezableProtectionIndicator'] = $data->getFreezableProtectionIndicator(); + } + if ($data->isInitialized('extremeLengthIndicator') && null !== $data->getExtremeLengthIndicator()) { + $dataArray['ExtremeLengthIndicator'] = $data->getExtremeLengthIndicator(); + } + if ($data->isInitialized('linearFeet') && null !== $data->getLinearFeet()) { + $dataArray['LinearFeet'] = $data->getLinearFeet(); + } + if ($data->isInitialized('adjustedHeight') && null !== $data->getAdjustedHeight()) { + $dataArray['AdjustedHeight'] = $this->normalizer->normalize($data->getAdjustedHeight(), 'json', $context); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateResponseAlternateRatesResponseNormalizer.php b/src/Api/Normalizer/FreightRateResponseAlternateRatesResponseNormalizer.php index 183d0bbf..f6b53e8e 100644 --- a/src/Api/Normalizer/FreightRateResponseAlternateRatesResponseNormalizer.php +++ b/src/Api/Normalizer/FreightRateResponseAlternateRatesResponseNormalizer.php @@ -5,194 +5,96 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseAlternateRatesResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateResponseAlternateRatesResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AlternateRateType', $data)) { - $object->setAlternateRateType($this->denormalizer->denormalize($data['AlternateRateType'], \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class, 'json', $context)); - unset($data['AlternateRateType']); - } - if (\array_key_exists('Rate', $data)) { - $values = []; - foreach ($data['Rate'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class, 'json', $context); - } - $object->setRate($values); - unset($data['Rate']); - } - if (\array_key_exists('FreightDensityRate', $data)) { - $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class, 'json', $context)); - unset($data['FreightDensityRate']); - } - if (\array_key_exists('BillableShipmentWeight', $data)) { - $object->setBillableShipmentWeight($this->denormalizer->denormalize($data['BillableShipmentWeight'], \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class, 'json', $context)); - unset($data['BillableShipmentWeight']); - } - if (\array_key_exists('TimeInTransit', $data)) { - $object->setTimeInTransit($this->denormalizer->denormalize($data['TimeInTransit'], \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class, 'json', $context)); - unset($data['TimeInTransit']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AlternateRateType'] = $this->normalizer->normalize($object->getAlternateRateType(), 'json', $context); + if (\array_key_exists('AlternateRateType', $data)) { + $object->setAlternateRateType($this->denormalizer->denormalize($data['AlternateRateType'], \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class, 'json', $context)); + unset($data['AlternateRateType']); + } + if (\array_key_exists('Rate', $data)) { $values = []; - foreach ($object->getRate() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Rate'] = $values; - if ($object->isInitialized('freightDensityRate') && null !== $object->getFreightDensityRate()) { - $data['FreightDensityRate'] = $this->normalizer->normalize($object->getFreightDensityRate(), 'json', $context); - } - if ($object->isInitialized('billableShipmentWeight') && null !== $object->getBillableShipmentWeight()) { - $data['BillableShipmentWeight'] = $this->normalizer->normalize($object->getBillableShipmentWeight(), 'json', $context); + foreach ($data['Rate'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class, 'json', $context); } - if ($object->isInitialized('timeInTransit') && null !== $object->getTimeInTransit()) { - $data['TimeInTransit'] = $this->normalizer->normalize($object->getTimeInTransit(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setRate($values); + unset($data['Rate']); + } + if (\array_key_exists('FreightDensityRate', $data)) { + $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class, 'json', $context)); + unset($data['FreightDensityRate']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class => false]; + if (\array_key_exists('BillableShipmentWeight', $data)) { + $object->setBillableShipmentWeight($this->denormalizer->denormalize($data['BillableShipmentWeight'], \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class, 'json', $context)); + unset($data['BillableShipmentWeight']); } + if (\array_key_exists('TimeInTransit', $data)) { + $object->setTimeInTransit($this->denormalizer->denormalize($data['TimeInTransit'], \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class, 'json', $context)); + unset($data['TimeInTransit']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class FreightRateResponseAlternateRatesResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class; + $dataArray = []; + $dataArray['AlternateRateType'] = $this->normalizer->normalize($data->getAlternateRateType(), 'json', $context); + $values = []; + foreach ($data->getRate() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class; + $dataArray['Rate'] = $values; + if ($data->isInitialized('freightDensityRate') && null !== $data->getFreightDensityRate()) { + $dataArray['FreightDensityRate'] = $this->normalizer->normalize($data->getFreightDensityRate(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AlternateRateType', $data)) { - $object->setAlternateRateType($this->denormalizer->denormalize($data['AlternateRateType'], \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class, 'json', $context)); - unset($data['AlternateRateType']); - } - if (\array_key_exists('Rate', $data)) { - $values = []; - foreach ($data['Rate'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class, 'json', $context); - } - $object->setRate($values); - unset($data['Rate']); - } - if (\array_key_exists('FreightDensityRate', $data)) { - $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class, 'json', $context)); - unset($data['FreightDensityRate']); - } - if (\array_key_exists('BillableShipmentWeight', $data)) { - $object->setBillableShipmentWeight($this->denormalizer->denormalize($data['BillableShipmentWeight'], \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class, 'json', $context)); - unset($data['BillableShipmentWeight']); - } - if (\array_key_exists('TimeInTransit', $data)) { - $object->setTimeInTransit($this->denormalizer->denormalize($data['TimeInTransit'], \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class, 'json', $context)); - unset($data['TimeInTransit']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('billableShipmentWeight') && null !== $data->getBillableShipmentWeight()) { + $dataArray['BillableShipmentWeight'] = $this->normalizer->normalize($data->getBillableShipmentWeight(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AlternateRateType'] = $this->normalizer->normalize($object->getAlternateRateType(), 'json', $context); - $values = []; - foreach ($object->getRate() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Rate'] = $values; - if ($object->isInitialized('freightDensityRate') && null !== $object->getFreightDensityRate()) { - $data['FreightDensityRate'] = $this->normalizer->normalize($object->getFreightDensityRate(), 'json', $context); - } - if ($object->isInitialized('billableShipmentWeight') && null !== $object->getBillableShipmentWeight()) { - $data['BillableShipmentWeight'] = $this->normalizer->normalize($object->getBillableShipmentWeight(), 'json', $context); - } - if ($object->isInitialized('timeInTransit') && null !== $object->getTimeInTransit()) { - $data['TimeInTransit'] = $this->normalizer->normalize($object->getTimeInTransit(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('timeInTransit') && null !== $data->getTimeInTransit()) { + $dataArray['TimeInTransit'] = $this->normalizer->normalize($data->getTimeInTransit(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateResponseBillableShipmentWeightNormalizer.php b/src/Api/Normalizer/FreightRateResponseBillableShipmentWeightNormalizer.php index 756e5382..4b8063cc 100644 --- a/src/Api/Normalizer/FreightRateResponseBillableShipmentWeightNormalizer.php +++ b/src/Api/Normalizer/FreightRateResponseBillableShipmentWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseBillableShipmentWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateResponseBillableShipmentWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class => false]; - } - } -} else { - class FreightRateResponseBillableShipmentWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Value'] = $data->getValue(); + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateResponseCommodityNormalizer.php b/src/Api/Normalizer/FreightRateResponseCommodityNormalizer.php index 67915ab7..9ec111cc 100644 --- a/src/Api/Normalizer/FreightRateResponseCommodityNormalizer.php +++ b/src/Api/Normalizer/FreightRateResponseCommodityNormalizer.php @@ -5,164 +5,81 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateResponseCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseCommodity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CommodityID', $data)) { - $object->setCommodityID($data['CommodityID']); - unset($data['CommodityID']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($this->denormalizer->denormalize($data['Weight'], \ShipStream\Ups\Api\Model\CommodityWeight::class, 'json', $context)); - unset($data['Weight']); - } - if (\array_key_exists('AdjustedWeight', $data)) { - $object->setAdjustedWeight($this->denormalizer->denormalize($data['AdjustedWeight'], \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class, 'json', $context)); - unset($data['AdjustedWeight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateResponseCommodity(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('commodityID') && null !== $object->getCommodityID()) { - $data['CommodityID'] = $object->getCommodityID(); - } - $data['Description'] = $object->getDescription(); - $data['Weight'] = $this->normalizer->normalize($object->getWeight(), 'json', $context); - if ($object->isInitialized('adjustedWeight') && null !== $object->getAdjustedWeight()) { - $data['AdjustedWeight'] = $this->normalizer->normalize($object->getAdjustedWeight(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CommodityID', $data)) { + $object->setCommodityID($data['CommodityID']); + unset($data['CommodityID']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class => false]; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - } -} else { - class FreightRateResponseCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($this->denormalizer->denormalize($data['Weight'], \ShipStream\Ups\Api\Model\CommodityWeight::class, 'json', $context)); + unset($data['Weight']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class; + if (\array_key_exists('AdjustedWeight', $data)) { + $object->setAdjustedWeight($this->denormalizer->denormalize($data['AdjustedWeight'], \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class, 'json', $context)); + unset($data['AdjustedWeight']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseCommodity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CommodityID', $data)) { - $object->setCommodityID($data['CommodityID']); - unset($data['CommodityID']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($this->denormalizer->denormalize($data['Weight'], \ShipStream\Ups\Api\Model\CommodityWeight::class, 'json', $context)); - unset($data['Weight']); - } - if (\array_key_exists('AdjustedWeight', $data)) { - $object->setAdjustedWeight($this->denormalizer->denormalize($data['AdjustedWeight'], \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class, 'json', $context)); - unset($data['AdjustedWeight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('commodityID') && null !== $object->getCommodityID()) { - $data['CommodityID'] = $object->getCommodityID(); - } - $data['Description'] = $object->getDescription(); - $data['Weight'] = $this->normalizer->normalize($object->getWeight(), 'json', $context); - if ($object->isInitialized('adjustedWeight') && null !== $object->getAdjustedWeight()) { - $data['AdjustedWeight'] = $this->normalizer->normalize($object->getAdjustedWeight(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('commodityID') && null !== $data->getCommodityID()) { + $dataArray['CommodityID'] = $data->getCommodityID(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class => false]; + $dataArray['Description'] = $data->getDescription(); + $dataArray['Weight'] = $this->normalizer->normalize($data->getWeight(), 'json', $context); + if ($data->isInitialized('adjustedWeight') && null !== $data->getAdjustedWeight()) { + $dataArray['AdjustedWeight'] = $this->normalizer->normalize($data->getAdjustedWeight(), 'json', $context); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateResponseDimensionalWeightNormalizer.php b/src/Api/Normalizer/FreightRateResponseDimensionalWeightNormalizer.php index 9f035d49..db8998fa 100644 --- a/src/Api/Normalizer/FreightRateResponseDimensionalWeightNormalizer.php +++ b/src/Api/Normalizer/FreightRateResponseDimensionalWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseDimensionalWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateResponseDimensionalWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class => false]; - } - } -} else { - class FreightRateResponseDimensionalWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Value'] = $data->getValue(); + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateResponseFreightDensityRateNormalizer.php b/src/Api/Normalizer/FreightRateResponseFreightDensityRateNormalizer.php index 7398ed62..9fd7ab61 100644 --- a/src/Api/Normalizer/FreightRateResponseFreightDensityRateNormalizer.php +++ b/src/Api/Normalizer/FreightRateResponseFreightDensityRateNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseFreightDensityRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateResponseFreightDensityRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Density', $data)) { - $object->setDensity($data['Density']); - unset($data['Density']); - } - if (\array_key_exists('TotalCubicFeet', $data)) { - $object->setTotalCubicFeet($data['TotalCubicFeet']); - unset($data['TotalCubicFeet']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Density'] = $object->getDensity(); - $data['TotalCubicFeet'] = $object->getTotalCubicFeet(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class => false]; - } - } -} else { - class FreightRateResponseFreightDensityRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class; + if (\array_key_exists('Density', $data)) { + $object->setDensity($data['Density']); + unset($data['Density']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class; + if (\array_key_exists('TotalCubicFeet', $data)) { + $object->setTotalCubicFeet($data['TotalCubicFeet']); + unset($data['TotalCubicFeet']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Density', $data)) { - $object->setDensity($data['Density']); - unset($data['Density']); - } - if (\array_key_exists('TotalCubicFeet', $data)) { - $object->setTotalCubicFeet($data['TotalCubicFeet']); - unset($data['TotalCubicFeet']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Density'] = $object->getDensity(); - $data['TotalCubicFeet'] = $object->getTotalCubicFeet(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Density'] = $data->getDensity(); + $dataArray['TotalCubicFeet'] = $data->getTotalCubicFeet(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateResponseHandlingUnitsNormalizer.php b/src/Api/Normalizer/FreightRateResponseHandlingUnitsNormalizer.php index c9fd03bb..c2b0f389 100644 --- a/src/Api/Normalizer/FreightRateResponseHandlingUnitsNormalizer.php +++ b/src/Api/Normalizer/FreightRateResponseHandlingUnitsNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateResponseHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('AdjustedHeight', $data)) { - $object->setAdjustedHeight($this->denormalizer->denormalize($data['AdjustedHeight'], \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class, 'json', $context)); - unset($data['AdjustedHeight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - $data['AdjustedHeight'] = $this->normalizer->normalize($object->getAdjustedHeight(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class => false]; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); + unset($data['Type']); } - } -} else { - class FreightRateResponseHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class; + if (\array_key_exists('Dimensions', $data)) { + $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); + unset($data['Dimensions']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class; + if (\array_key_exists('AdjustedHeight', $data)) { + $object->setAdjustedHeight($this->denormalizer->denormalize($data['AdjustedHeight'], \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class, 'json', $context)); + unset($data['AdjustedHeight']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('AdjustedHeight', $data)) { - $object->setAdjustedHeight($this->denormalizer->denormalize($data['AdjustedHeight'], \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class, 'json', $context)); - unset($data['AdjustedHeight']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - $data['AdjustedHeight'] = $this->normalizer->normalize($object->getAdjustedHeight(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Quantity'] = $data->getQuantity(); + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + $dataArray['Dimensions'] = $this->normalizer->normalize($data->getDimensions(), 'json', $context); + $dataArray['AdjustedHeight'] = $this->normalizer->normalize($data->getAdjustedHeight(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateResponseNormalizer.php b/src/Api/Normalizer/FreightRateResponseNormalizer.php index 85257ce8..b21ac6d2 100644 --- a/src/Api/Normalizer/FreightRateResponseNormalizer.php +++ b/src/Api/Normalizer/FreightRateResponseNormalizer.php @@ -5,352 +5,175 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponse::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('Rate', $data)) { - $values = []; - foreach ($data['Rate'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightRateResponseRate::class, 'json', $context); - } - $object->setRate($values); - unset($data['Rate']); - } - if (\array_key_exists('FreightDensityRate', $data)) { - $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class, 'json', $context)); - unset($data['FreightDensityRate']); - } - if (\array_key_exists('Commodity', $data)) { - $values_1 = []; - foreach ($data['Commodity'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class, 'json', $context); - } - $object->setCommodity($values_1); - unset($data['Commodity']); - } - if (\array_key_exists('TotalShipmentCharge', $data)) { - $object->setTotalShipmentCharge($this->denormalizer->denormalize($data['TotalShipmentCharge'], \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class, 'json', $context)); - unset($data['TotalShipmentCharge']); - } - if (\array_key_exists('BillableShipmentWeight', $data)) { - $object->setBillableShipmentWeight($this->denormalizer->denormalize($data['BillableShipmentWeight'], \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class, 'json', $context)); - unset($data['BillableShipmentWeight']); - } - if (\array_key_exists('DimensionalWeight', $data)) { - $object->setDimensionalWeight($this->denormalizer->denormalize($data['DimensionalWeight'], \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class, 'json', $context)); - unset($data['DimensionalWeight']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\FreightRateResponseService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('GuaranteedIndicator', $data)) { - $object->setGuaranteedIndicator($data['GuaranteedIndicator']); - unset($data['GuaranteedIndicator']); - } - if (\array_key_exists('MinimumChargeAppliedIndicator', $data)) { - $object->setMinimumChargeAppliedIndicator($data['MinimumChargeAppliedIndicator']); - unset($data['MinimumChargeAppliedIndicator']); - } - if (\array_key_exists('AlternateRatesResponse', $data)) { - $values_2 = []; - foreach ($data['AlternateRatesResponse'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class, 'json', $context); - } - $object->setAlternateRatesResponse($values_2); - unset($data['AlternateRatesResponse']); - } - if (\array_key_exists('TimeInTransit', $data)) { - $object->setTimeInTransit($this->denormalizer->denormalize($data['TimeInTransit'], \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class, 'json', $context)); - unset($data['TimeInTransit']); - } - if (\array_key_exists('HandlingUnits', $data)) { - $object->setHandlingUnits($this->denormalizer->denormalize($data['HandlingUnits'], \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class, 'json', $context)); - unset($data['HandlingUnits']); - } - if (\array_key_exists('QuoteNumber', $data)) { - $object->setQuoteNumber($data['QuoteNumber']); - unset($data['QuoteNumber']); - } - foreach ($data as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_3; - } - } + return $type === \ShipStream\Ups\Api\Model\FreightRateResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\FreightRateResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('rate') && null !== $object->getRate()) { - $values = []; - foreach ($object->getRate() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Rate'] = $values; - } - if ($object->isInitialized('freightDensityRate') && null !== $object->getFreightDensityRate()) { - $data['FreightDensityRate'] = $this->normalizer->normalize($object->getFreightDensityRate(), 'json', $context); + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class, 'json', $context)); + unset($data['Response']); + } + if (\array_key_exists('Rate', $data)) { + $values = []; + foreach ($data['Rate'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightRateResponseRate::class, 'json', $context); } + $object->setRate($values); + unset($data['Rate']); + } + if (\array_key_exists('FreightDensityRate', $data)) { + $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class, 'json', $context)); + unset($data['FreightDensityRate']); + } + if (\array_key_exists('Commodity', $data)) { $values_1 = []; - foreach ($object->getCommodity() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Commodity'] = $values_1; - if ($object->isInitialized('totalShipmentCharge') && null !== $object->getTotalShipmentCharge()) { - $data['TotalShipmentCharge'] = $this->normalizer->normalize($object->getTotalShipmentCharge(), 'json', $context); - } - if ($object->isInitialized('billableShipmentWeight') && null !== $object->getBillableShipmentWeight()) { - $data['BillableShipmentWeight'] = $this->normalizer->normalize($object->getBillableShipmentWeight(), 'json', $context); - } - if ($object->isInitialized('dimensionalWeight') && null !== $object->getDimensionalWeight()) { - $data['DimensionalWeight'] = $this->normalizer->normalize($object->getDimensionalWeight(), 'json', $context); - } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - } - if ($object->isInitialized('guaranteedIndicator') && null !== $object->getGuaranteedIndicator()) { - $data['GuaranteedIndicator'] = $object->getGuaranteedIndicator(); - } - if ($object->isInitialized('minimumChargeAppliedIndicator') && null !== $object->getMinimumChargeAppliedIndicator()) { - $data['MinimumChargeAppliedIndicator'] = $object->getMinimumChargeAppliedIndicator(); - } - if ($object->isInitialized('alternateRatesResponse') && null !== $object->getAlternateRatesResponse()) { - $values_2 = []; - foreach ($object->getAlternateRatesResponse() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['AlternateRatesResponse'] = $values_2; - } - if ($object->isInitialized('timeInTransit') && null !== $object->getTimeInTransit()) { - $data['TimeInTransit'] = $this->normalizer->normalize($object->getTimeInTransit(), 'json', $context); + foreach ($data['Commodity'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class, 'json', $context); } - if ($object->isInitialized('handlingUnits') && null !== $object->getHandlingUnits()) { - $data['HandlingUnits'] = $this->normalizer->normalize($object->getHandlingUnits(), 'json', $context); - } - if ($object->isInitialized('quoteNumber') && null !== $object->getQuoteNumber()) { - $data['QuoteNumber'] = $object->getQuoteNumber(); - } - foreach ($object as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_3; - } + $object->setCommodity($values_1); + unset($data['Commodity']); + } + if (\array_key_exists('TotalShipmentCharge', $data)) { + $object->setTotalShipmentCharge($this->denormalizer->denormalize($data['TotalShipmentCharge'], \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class, 'json', $context)); + unset($data['TotalShipmentCharge']); + } + if (\array_key_exists('BillableShipmentWeight', $data)) { + $object->setBillableShipmentWeight($this->denormalizer->denormalize($data['BillableShipmentWeight'], \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class, 'json', $context)); + unset($data['BillableShipmentWeight']); + } + if (\array_key_exists('DimensionalWeight', $data)) { + $object->setDimensionalWeight($this->denormalizer->denormalize($data['DimensionalWeight'], \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class, 'json', $context)); + unset($data['DimensionalWeight']); + } + if (\array_key_exists('Service', $data)) { + $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\FreightRateResponseService::class, 'json', $context)); + unset($data['Service']); + } + if (\array_key_exists('GuaranteedIndicator', $data)) { + $object->setGuaranteedIndicator($data['GuaranteedIndicator']); + unset($data['GuaranteedIndicator']); + } + if (\array_key_exists('MinimumChargeAppliedIndicator', $data)) { + $object->setMinimumChargeAppliedIndicator($data['MinimumChargeAppliedIndicator']); + unset($data['MinimumChargeAppliedIndicator']); + } + if (\array_key_exists('AlternateRatesResponse', $data)) { + $values_2 = []; + foreach ($data['AlternateRatesResponse'] as $value_2) { + $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class, 'json', $context); } - return $data; + $object->setAlternateRatesResponse($values_2); + unset($data['AlternateRatesResponse']); + } + if (\array_key_exists('TimeInTransit', $data)) { + $object->setTimeInTransit($this->denormalizer->denormalize($data['TimeInTransit'], \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class, 'json', $context)); + unset($data['TimeInTransit']); + } + if (\array_key_exists('HandlingUnits', $data)) { + $object->setHandlingUnits($this->denormalizer->denormalize($data['HandlingUnits'], \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class, 'json', $context)); + unset($data['HandlingUnits']); + } + if (\array_key_exists('QuoteNumber', $data)) { + $object->setQuoteNumber($data['QuoteNumber']); + unset($data['QuoteNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponse::class => false]; + foreach ($data as $key => $value_3) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_3; + } } + return $object; } -} else { - class FreightRateResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('Rate', $data)) { - $values = []; - foreach ($data['Rate'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightRateResponseRate::class, 'json', $context); - } - $object->setRate($values); - unset($data['Rate']); - } - if (\array_key_exists('FreightDensityRate', $data)) { - $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class, 'json', $context)); - unset($data['FreightDensityRate']); - } - if (\array_key_exists('Commodity', $data)) { - $values_1 = []; - foreach ($data['Commodity'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class, 'json', $context); - } - $object->setCommodity($values_1); - unset($data['Commodity']); - } - if (\array_key_exists('TotalShipmentCharge', $data)) { - $object->setTotalShipmentCharge($this->denormalizer->denormalize($data['TotalShipmentCharge'], \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class, 'json', $context)); - unset($data['TotalShipmentCharge']); - } - if (\array_key_exists('BillableShipmentWeight', $data)) { - $object->setBillableShipmentWeight($this->denormalizer->denormalize($data['BillableShipmentWeight'], \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class, 'json', $context)); - unset($data['BillableShipmentWeight']); - } - if (\array_key_exists('DimensionalWeight', $data)) { - $object->setDimensionalWeight($this->denormalizer->denormalize($data['DimensionalWeight'], \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class, 'json', $context)); - unset($data['DimensionalWeight']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\FreightRateResponseService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('GuaranteedIndicator', $data)) { - $object->setGuaranteedIndicator($data['GuaranteedIndicator']); - unset($data['GuaranteedIndicator']); - } - if (\array_key_exists('MinimumChargeAppliedIndicator', $data)) { - $object->setMinimumChargeAppliedIndicator($data['MinimumChargeAppliedIndicator']); - unset($data['MinimumChargeAppliedIndicator']); - } - if (\array_key_exists('AlternateRatesResponse', $data)) { - $values_2 = []; - foreach ($data['AlternateRatesResponse'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class, 'json', $context); - } - $object->setAlternateRatesResponse($values_2); - unset($data['AlternateRatesResponse']); - } - if (\array_key_exists('TimeInTransit', $data)) { - $object->setTimeInTransit($this->denormalizer->denormalize($data['TimeInTransit'], \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class, 'json', $context)); - unset($data['TimeInTransit']); - } - if (\array_key_exists('HandlingUnits', $data)) { - $object->setHandlingUnits($this->denormalizer->denormalize($data['HandlingUnits'], \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class, 'json', $context)); - unset($data['HandlingUnits']); - } - if (\array_key_exists('QuoteNumber', $data)) { - $object->setQuoteNumber($data['QuoteNumber']); - unset($data['QuoteNumber']); - } - foreach ($data as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_3; - } - } - return $object; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + if ($data->isInitialized('rate') && null !== $data->getRate()) { + $values = []; + foreach ($data->getRate() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Rate'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('rate') && null !== $object->getRate()) { - $values = []; - foreach ($object->getRate() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Rate'] = $values; - } - if ($object->isInitialized('freightDensityRate') && null !== $object->getFreightDensityRate()) { - $data['FreightDensityRate'] = $this->normalizer->normalize($object->getFreightDensityRate(), 'json', $context); - } - $values_1 = []; - foreach ($object->getCommodity() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Commodity'] = $values_1; - if ($object->isInitialized('totalShipmentCharge') && null !== $object->getTotalShipmentCharge()) { - $data['TotalShipmentCharge'] = $this->normalizer->normalize($object->getTotalShipmentCharge(), 'json', $context); - } - if ($object->isInitialized('billableShipmentWeight') && null !== $object->getBillableShipmentWeight()) { - $data['BillableShipmentWeight'] = $this->normalizer->normalize($object->getBillableShipmentWeight(), 'json', $context); - } - if ($object->isInitialized('dimensionalWeight') && null !== $object->getDimensionalWeight()) { - $data['DimensionalWeight'] = $this->normalizer->normalize($object->getDimensionalWeight(), 'json', $context); - } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - } - if ($object->isInitialized('guaranteedIndicator') && null !== $object->getGuaranteedIndicator()) { - $data['GuaranteedIndicator'] = $object->getGuaranteedIndicator(); - } - if ($object->isInitialized('minimumChargeAppliedIndicator') && null !== $object->getMinimumChargeAppliedIndicator()) { - $data['MinimumChargeAppliedIndicator'] = $object->getMinimumChargeAppliedIndicator(); - } - if ($object->isInitialized('alternateRatesResponse') && null !== $object->getAlternateRatesResponse()) { - $values_2 = []; - foreach ($object->getAlternateRatesResponse() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['AlternateRatesResponse'] = $values_2; - } - if ($object->isInitialized('timeInTransit') && null !== $object->getTimeInTransit()) { - $data['TimeInTransit'] = $this->normalizer->normalize($object->getTimeInTransit(), 'json', $context); - } - if ($object->isInitialized('handlingUnits') && null !== $object->getHandlingUnits()) { - $data['HandlingUnits'] = $this->normalizer->normalize($object->getHandlingUnits(), 'json', $context); - } - if ($object->isInitialized('quoteNumber') && null !== $object->getQuoteNumber()) { - $data['QuoteNumber'] = $object->getQuoteNumber(); - } - foreach ($object as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_3; - } + if ($data->isInitialized('freightDensityRate') && null !== $data->getFreightDensityRate()) { + $dataArray['FreightDensityRate'] = $this->normalizer->normalize($data->getFreightDensityRate(), 'json', $context); + } + $values_1 = []; + foreach ($data->getCommodity() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + } + $dataArray['Commodity'] = $values_1; + if ($data->isInitialized('totalShipmentCharge') && null !== $data->getTotalShipmentCharge()) { + $dataArray['TotalShipmentCharge'] = $this->normalizer->normalize($data->getTotalShipmentCharge(), 'json', $context); + } + if ($data->isInitialized('billableShipmentWeight') && null !== $data->getBillableShipmentWeight()) { + $dataArray['BillableShipmentWeight'] = $this->normalizer->normalize($data->getBillableShipmentWeight(), 'json', $context); + } + if ($data->isInitialized('dimensionalWeight') && null !== $data->getDimensionalWeight()) { + $dataArray['DimensionalWeight'] = $this->normalizer->normalize($data->getDimensionalWeight(), 'json', $context); + } + if ($data->isInitialized('service') && null !== $data->getService()) { + $dataArray['Service'] = $this->normalizer->normalize($data->getService(), 'json', $context); + } + if ($data->isInitialized('guaranteedIndicator') && null !== $data->getGuaranteedIndicator()) { + $dataArray['GuaranteedIndicator'] = $data->getGuaranteedIndicator(); + } + if ($data->isInitialized('minimumChargeAppliedIndicator') && null !== $data->getMinimumChargeAppliedIndicator()) { + $dataArray['MinimumChargeAppliedIndicator'] = $data->getMinimumChargeAppliedIndicator(); + } + if ($data->isInitialized('alternateRatesResponse') && null !== $data->getAlternateRatesResponse()) { + $values_2 = []; + foreach ($data->getAlternateRatesResponse() as $value_2) { + $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); } - return $data; + $dataArray['AlternateRatesResponse'] = $values_2; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponse::class => false]; + if ($data->isInitialized('timeInTransit') && null !== $data->getTimeInTransit()) { + $dataArray['TimeInTransit'] = $this->normalizer->normalize($data->getTimeInTransit(), 'json', $context); } + if ($data->isInitialized('handlingUnits') && null !== $data->getHandlingUnits()) { + $dataArray['HandlingUnits'] = $this->normalizer->normalize($data->getHandlingUnits(), 'json', $context); + } + if ($data->isInitialized('quoteNumber') && null !== $data->getQuoteNumber()) { + $dataArray['QuoteNumber'] = $data->getQuoteNumber(); + } + foreach ($data as $key => $value_3) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_3; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateResponseRateNormalizer.php b/src/Api/Normalizer/FreightRateResponseRateNormalizer.php index 310adc22..c3d03f4d 100644 --- a/src/Api/Normalizer/FreightRateResponseRateNormalizer.php +++ b/src/Api/Normalizer/FreightRateResponseRateNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateResponseRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseRate::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateResponseRate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseRate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseRate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\RateType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Factor', $data)) { - $object->setFactor($this->denormalizer->denormalize($data['Factor'], \ShipStream\Ups\Api\Model\RateFactor::class, 'json', $context)); - unset($data['Factor']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateResponseRate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Factor'] = $this->normalizer->normalize($object->getFactor(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseRate::class => false]; - } - } -} else { - class FreightRateResponseRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseRate::class; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\RateType::class, 'json', $context)); + unset($data['Type']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseRate::class; + if (\array_key_exists('Factor', $data)) { + $object->setFactor($this->denormalizer->denormalize($data['Factor'], \ShipStream\Ups\Api\Model\RateFactor::class, 'json', $context)); + unset($data['Factor']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\RateType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Factor', $data)) { - $object->setFactor($this->denormalizer->denormalize($data['Factor'], \ShipStream\Ups\Api\Model\RateFactor::class, 'json', $context)); - unset($data['Factor']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Factor'] = $this->normalizer->normalize($object->getFactor(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + $dataArray['Factor'] = $this->normalizer->normalize($data->getFactor(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseRate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateResponseRate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateResponseResponseNormalizer.php b/src/Api/Normalizer/FreightRateResponseResponseNormalizer.php index 27c0b77e..8946215e 100644 --- a/src/Api/Normalizer/FreightRateResponseResponseNormalizer.php +++ b/src/Api/Normalizer/FreightRateResponseResponseNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); + } + if (\array_key_exists('Alert', $data)) { + $values = []; + foreach ($data['Alert'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); } - return $data; + $object->setAlert($values); + unset($data['Alert']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class FreightRateResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $values = []; + foreach ($data->getAlert() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Alert'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateResponseServiceNormalizer.php b/src/Api/Normalizer/FreightRateResponseServiceNormalizer.php index 0edbe958..4a458e26 100644 --- a/src/Api/Normalizer/FreightRateResponseServiceNormalizer.php +++ b/src/Api/Normalizer/FreightRateResponseServiceNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateResponseServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseService::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateResponseService::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseService::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseService::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateResponseService(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseService::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FreightRateResponseServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseService::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseService::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseService::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateResponseService::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateResponseTimeInTransitNormalizer.php b/src/Api/Normalizer/FreightRateResponseTimeInTransitNormalizer.php index a9a7fb29..daf0fb83 100644 --- a/src/Api/Normalizer/FreightRateResponseTimeInTransitNormalizer.php +++ b/src/Api/Normalizer/FreightRateResponseTimeInTransitNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseTimeInTransitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateResponseTimeInTransitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DaysInTransit', $data)) { - $object->setDaysInTransit($data['DaysInTransit']); - unset($data['DaysInTransit']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['DaysInTransit'] = $object->getDaysInTransit(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DaysInTransit', $data)) { + $object->setDaysInTransit($data['DaysInTransit']); + unset($data['DaysInTransit']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class FreightRateResponseTimeInTransitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['DaysInTransit'] = $data->getDaysInTransit(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('DaysInTransit', $data)) { - $object->setDaysInTransit($data['DaysInTransit']); - unset($data['DaysInTransit']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['DaysInTransit'] = $object->getDaysInTransit(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateResponseTotalShipmentChargeNormalizer.php b/src/Api/Normalizer/FreightRateResponseTotalShipmentChargeNormalizer.php index 9b1492ef..256b9369 100644 --- a/src/Api/Normalizer/FreightRateResponseTotalShipmentChargeNormalizer.php +++ b/src/Api/Normalizer/FreightRateResponseTotalShipmentChargeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseTotalShipmentChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateResponseTotalShipmentChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class; + return $type === \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class => false]; - } - } -} else { - class FreightRateResponseTotalShipmentChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateShipFromAddressNormalizer.php b/src/Api/Normalizer/FreightRateShipFromAddressNormalizer.php index 108f3827..a850ad47 100644 --- a/src/Api/Normalizer/FreightRateShipFromAddressNormalizer.php +++ b/src/Api/Normalizer/FreightRateShipFromAddressNormalizer.php @@ -5,218 +5,108 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateShipFromAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialAddressIndicator', $data)) { - $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); - unset($data['ResidentialAddressIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\FreightRateShipFromAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - if ($object->isInitialized('residentialAddressIndicator') && null !== $object->getResidentialAddressIndicator()) { - $data['ResidentialAddressIndicator'] = $object->getResidentialAddressIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('Town', $data)) { + $object->setTown($data['Town']); + unset($data['Town']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class => false]; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + if (\array_key_exists('ResidentialAddressIndicator', $data)) { + $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); + unset($data['ResidentialAddressIndicator']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class FreightRateShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateShipFromAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialAddressIndicator', $data)) { - $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); - unset($data['ResidentialAddressIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - if ($object->isInitialized('residentialAddressIndicator') && null !== $object->getResidentialAddressIndicator()) { - $data['ResidentialAddressIndicator'] = $object->getResidentialAddressIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class => false]; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['Town'] = $data->getTown(); } + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); + } + $dataArray['CountryCode'] = $data->getCountryCode(); + if ($data->isInitialized('residentialAddressIndicator') && null !== $data->getResidentialAddressIndicator()) { + $dataArray['ResidentialAddressIndicator'] = $data->getResidentialAddressIndicator(); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightRateShipToAddressNormalizer.php b/src/Api/Normalizer/FreightRateShipToAddressNormalizer.php index 6f2a2ae0..16da9359 100644 --- a/src/Api/Normalizer/FreightRateShipToAddressNormalizer.php +++ b/src/Api/Normalizer/FreightRateShipToAddressNormalizer.php @@ -5,218 +5,108 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightRateShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialAddressIndicator', $data)) { - $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); - unset($data['ResidentialAddressIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\FreightRateShipToAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - if ($object->isInitialized('residentialAddressIndicator') && null !== $object->getResidentialAddressIndicator()) { - $data['ResidentialAddressIndicator'] = $object->getResidentialAddressIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('Town', $data)) { + $object->setTown($data['Town']); + unset($data['Town']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateShipToAddress::class => false]; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + if (\array_key_exists('ResidentialAddressIndicator', $data)) { + $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); + unset($data['ResidentialAddressIndicator']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class FreightRateShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightRateShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialAddressIndicator', $data)) { - $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); - unset($data['ResidentialAddressIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - if ($object->isInitialized('residentialAddressIndicator') && null !== $object->getResidentialAddressIndicator()) { - $data['ResidentialAddressIndicator'] = $object->getResidentialAddressIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightRateShipToAddress::class => false]; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['Town'] = $data->getTown(); } + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); + } + $dataArray['CountryCode'] = $data->getCountryCode(); + if ($data->isInitialized('residentialAddressIndicator') && null !== $data->getResidentialAddressIndicator()) { + $dataArray['ResidentialAddressIndicator'] = $data->getResidentialAddressIndicator(); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightRateShipToAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipCommodityDimensionsNormalizer.php b/src/Api/Normalizer/FreightShipCommodityDimensionsNormalizer.php index 38a2f26c..abe7adec 100644 --- a/src/Api/Normalizer/FreightShipCommodityDimensionsNormalizer.php +++ b/src/Api/Normalizer/FreightShipCommodityDimensionsNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipCommodityDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipCommodityDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['Height'] = $object->getHeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Length', $data)) { + $object->setLength($data['Length']); + unset($data['Length']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class => false]; + if (\array_key_exists('Width', $data)) { + $object->setWidth($data['Width']); + unset($data['Width']); } - } -} else { - class FreightShipCommodityDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class; + if (\array_key_exists('Height', $data)) { + $object->setHeight($data['Height']); + unset($data['Height']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['Height'] = $object->getHeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Length'] = $data->getLength(); + $dataArray['Width'] = $data->getWidth(); + $dataArray['Height'] = $data->getHeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipPOMPickupNotificationsNormalizer.php b/src/Api/Normalizer/FreightShipPOMPickupNotificationsNormalizer.php index 94317dfd..02eee190 100644 --- a/src/Api/Normalizer/FreightShipPOMPickupNotificationsNormalizer.php +++ b/src/Api/Normalizer/FreightShipPOMPickupNotificationsNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipPOMPickupNotificationsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipPOMPickupNotificationsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('EMailNotification', $data)) { - $object->setEMailNotification($this->denormalizer->denormalize($data['EMailNotification'], \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class, 'json', $context)); - unset($data['EMailNotification']); - } - if (\array_key_exists('FailedEMail', $data)) { - $object->setFailedEMail($data['FailedEMail']); - unset($data['FailedEMail']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('companyName') && null !== $object->getCompanyName()) { - $data['CompanyName'] = $object->getCompanyName(); - } - $data['EMailNotification'] = $this->normalizer->normalize($object->getEMailNotification(), 'json', $context); - $data['FailedEMail'] = $object->getFailedEMail(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class => false]; + if (\array_key_exists('CompanyName', $data)) { + $object->setCompanyName($data['CompanyName']); + unset($data['CompanyName']); } - } -} else { - class FreightShipPOMPickupNotificationsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class; + if (\array_key_exists('EMailNotification', $data)) { + $object->setEMailNotification($this->denormalizer->denormalize($data['EMailNotification'], \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class, 'json', $context)); + unset($data['EMailNotification']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class; + if (\array_key_exists('FailedEMail', $data)) { + $object->setFailedEMail($data['FailedEMail']); + unset($data['FailedEMail']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('EMailNotification', $data)) { - $object->setEMailNotification($this->denormalizer->denormalize($data['EMailNotification'], \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class, 'json', $context)); - unset($data['EMailNotification']); - } - if (\array_key_exists('FailedEMail', $data)) { - $object->setFailedEMail($data['FailedEMail']); - unset($data['FailedEMail']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('companyName') && null !== $object->getCompanyName()) { - $data['CompanyName'] = $object->getCompanyName(); - } - $data['EMailNotification'] = $this->normalizer->normalize($object->getEMailNotification(), 'json', $context); - $data['FailedEMail'] = $object->getFailedEMail(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('companyName') && null !== $data->getCompanyName()) { + $dataArray['CompanyName'] = $data->getCompanyName(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class => false]; + $dataArray['EMailNotification'] = $this->normalizer->normalize($data->getEMailNotification(), 'json', $context); + $dataArray['FailedEMail'] = $data->getFailedEMail(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipPayerAddressNormalizer.php b/src/Api/Normalizer/FreightShipPayerAddressNormalizer.php index 6cd92b7d..70e9a371 100644 --- a/src/Api/Normalizer/FreightShipPayerAddressNormalizer.php +++ b/src/Api/Normalizer/FreightShipPayerAddressNormalizer.php @@ -5,188 +5,93 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipPayerAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipPayerAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipPayerAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipPayerAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AddressLine'] = $object->getAddressLine(); - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressLine', $data)) { + $object->setAddressLine($data['AddressLine']); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('Town', $data)) { + $object->setTown($data['Town']); + unset($data['Town']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipPayerAddress::class => false]; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightShipPayerAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class; + $dataArray = []; + $dataArray['AddressLine'] = $data->getAddressLine(); + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['Town'] = $data->getTown(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipPayerAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AddressLine'] = $object->getAddressLine(); - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipPayerAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipPayerAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipPickupNotificationsEMailNotificationNormalizer.php b/src/Api/Normalizer/FreightShipPickupNotificationsEMailNotificationNormalizer.php index 668efeb0..c6e7b4d0 100644 --- a/src/Api/Normalizer/FreightShipPickupNotificationsEMailNotificationNormalizer.php +++ b/src/Api/Normalizer/FreightShipPickupNotificationsEMailNotificationNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipPickupNotificationsEMailNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipPickupNotificationsEMailNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('EventType', $data)) { - $object->setEventType($data['EventType']); - unset($data['EventType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['EMailAddress'] = $object->getEMailAddress(); - $data['EventType'] = $object->getEventType(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class => false]; - } - } -} else { - class FreightShipPickupNotificationsEMailNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class; + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class; + if (\array_key_exists('EventType', $data)) { + $object->setEventType($data['EventType']); + unset($data['EventType']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('EventType', $data)) { - $object->setEventType($data['EventType']); - unset($data['EventType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['EMailAddress'] = $object->getEMailAddress(); - $data['EventType'] = $object->getEventType(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['EMailAddress'] = $data->getEMailAddress(); + $dataArray['EventType'] = $data->getEventType(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipRemitToAddressNormalizer.php b/src/Api/Normalizer/FreightShipRemitToAddressNormalizer.php index 3494283b..adbc3d7f 100644 --- a/src/Api/Normalizer/FreightShipRemitToAddressNormalizer.php +++ b/src/Api/Normalizer/FreightShipRemitToAddressNormalizer.php @@ -5,188 +5,93 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipRemitToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipRemitToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipRemitToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipRemitToAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AddressLine'] = $object->getAddressLine(); - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressLine', $data)) { + $object->setAddressLine($data['AddressLine']); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('Town', $data)) { + $object->setTown($data['Town']); + unset($data['Town']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class => false]; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightShipRemitToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class; + $dataArray = []; + $dataArray['AddressLine'] = $data->getAddressLine(); + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['Town'] = $data->getTown(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipRemitToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AddressLine'] = $object->getAddressLine(); - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipRequestNormalizer.php b/src/Api/Normalizer/FreightShipRequestNormalizer.php index dc623636..c7107696 100644 --- a/src/Api/Normalizer/FreightShipRequestNormalizer.php +++ b/src/Api/Normalizer/FreightShipRequestNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipRequest::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('Shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class, 'json', $context)); - unset($data['Shipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['Shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipRequest::class => false]; - } - } -} else { - class FreightShipRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipRequest::class; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class, 'json', $context)); + unset($data['Request']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipRequest::class; + if (\array_key_exists('Shipment', $data)) { + $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class, 'json', $context)); + unset($data['Shipment']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('Shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class, 'json', $context)); - unset($data['Shipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['Shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['Shipment'] = $this->normalizer->normalize($data->getShipment(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipRequestRequestNormalizer.php b/src/Api/Normalizer/FreightShipRequestRequestNormalizer.php index 18930799..fd7b1755 100644 --- a/src/Api/Normalizer/FreightShipRequestRequestNormalizer.php +++ b/src/Api/Normalizer/FreightShipRequestRequestNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['RequestOption'] = $object->getRequestOption(); - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipRequestRequest::class => false]; + if (\array_key_exists('SubVersion', $data)) { + $object->setSubVersion($data['SubVersion']); + unset($data['SubVersion']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightShipRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class; + $dataArray = []; + $dataArray['RequestOption'] = $data->getRequestOption(); + if ($data->isInitialized('subVersion') && null !== $data->getSubVersion()) { + $dataArray['SubVersion'] = $data->getSubVersion(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['RequestOption'] = $object->getRequestOption(); - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipRequestShipmentNormalizer.php b/src/Api/Normalizer/FreightShipRequestShipmentNormalizer.php index 62be8b39..eb11eae2 100644 --- a/src/Api/Normalizer/FreightShipRequestShipmentNormalizer.php +++ b/src/Api/Normalizer/FreightShipRequestShipmentNormalizer.php @@ -5,390 +5,194 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipRequestShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipFrom', $data)) { - $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class, 'json', $context)); - unset($data['ShipFrom']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('PaymentInformation', $data)) { - $object->setPaymentInformation($this->denormalizer->denormalize($data['PaymentInformation'], \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class, 'json', $context)); - unset($data['PaymentInformation']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('HandlingUnitOne', $data)) { - $object->setHandlingUnitOne($this->denormalizer->denormalize($data['HandlingUnitOne'], \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class, 'json', $context)); - unset($data['HandlingUnitOne']); - } - if (\array_key_exists('HandlingUnitTwo', $data)) { - $object->setHandlingUnitTwo($this->denormalizer->denormalize($data['HandlingUnitTwo'], \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class, 'json', $context)); - unset($data['HandlingUnitTwo']); - } - if (\array_key_exists('ExistingShipmentID', $data)) { - $object->setExistingShipmentID($this->denormalizer->denormalize($data['ExistingShipmentID'], \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class, 'json', $context)); - unset($data['ExistingShipmentID']); - } - if (\array_key_exists('HandlingInstructions', $data)) { - $object->setHandlingInstructions($data['HandlingInstructions']); - unset($data['HandlingInstructions']); - } - if (\array_key_exists('DeliveryInstructions', $data)) { - $object->setDeliveryInstructions($data['DeliveryInstructions']); - unset($data['DeliveryInstructions']); - } - if (\array_key_exists('PickupInstructions', $data)) { - $object->setPickupInstructions($data['PickupInstructions']); - unset($data['PickupInstructions']); - } - if (\array_key_exists('Commodity', $data)) { - $values = []; - foreach ($data['Commodity'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentCommodity::class, 'json', $context); - } - $object->setCommodity($values); - unset($data['Commodity']); - } - if (\array_key_exists('Reference', $data)) { - $values_1 = []; - foreach ($data['Reference'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentReference::class, 'json', $context); - } - $object->setReference($values_1); - unset($data['Reference']); - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('PickupRequest', $data)) { - $object->setPickupRequest($this->denormalizer->denormalize($data['PickupRequest'], \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class, 'json', $context)); - unset($data['PickupRequest']); - } - if (\array_key_exists('Documents', $data)) { - $object->setDocuments($this->denormalizer->denormalize($data['Documents'], \ShipStream\Ups\Api\Model\ShipmentDocuments::class, 'json', $context)); - unset($data['Documents']); - } - if (\array_key_exists('TimeInTransitIndicator', $data)) { - $object->setTimeInTransitIndicator($data['TimeInTransitIndicator']); - unset($data['TimeInTransitIndicator']); - } - if (\array_key_exists('HandlingUnits', $data)) { - $object->setHandlingUnits($this->denormalizer->denormalize($data['HandlingUnits'], \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class, 'json', $context)); - unset($data['HandlingUnits']); - } - if (\array_key_exists('DensityEligibleIndicator', $data)) { - $object->setDensityEligibleIndicator($data['DensityEligibleIndicator']); - unset($data['DensityEligibleIndicator']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + return $type === \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\FreightShipRequestShipment(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ShipFrom'] = $this->normalizer->normalize($object->getShipFrom(), 'json', $context); - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - $data['PaymentInformation'] = $this->normalizer->normalize($object->getPaymentInformation(), 'json', $context); - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - if ($object->isInitialized('handlingUnitOne') && null !== $object->getHandlingUnitOne()) { - $data['HandlingUnitOne'] = $this->normalizer->normalize($object->getHandlingUnitOne(), 'json', $context); - } - if ($object->isInitialized('handlingUnitTwo') && null !== $object->getHandlingUnitTwo()) { - $data['HandlingUnitTwo'] = $this->normalizer->normalize($object->getHandlingUnitTwo(), 'json', $context); - } - if ($object->isInitialized('existingShipmentID') && null !== $object->getExistingShipmentID()) { - $data['ExistingShipmentID'] = $this->normalizer->normalize($object->getExistingShipmentID(), 'json', $context); - } - if ($object->isInitialized('handlingInstructions') && null !== $object->getHandlingInstructions()) { - $data['HandlingInstructions'] = $object->getHandlingInstructions(); - } - if ($object->isInitialized('deliveryInstructions') && null !== $object->getDeliveryInstructions()) { - $data['DeliveryInstructions'] = $object->getDeliveryInstructions(); - } - if ($object->isInitialized('pickupInstructions') && null !== $object->getPickupInstructions()) { - $data['PickupInstructions'] = $object->getPickupInstructions(); - } + if (\array_key_exists('ShipFrom', $data)) { + $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class, 'json', $context)); + unset($data['ShipFrom']); + } + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); + } + if (\array_key_exists('ShipTo', $data)) { + $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class, 'json', $context)); + unset($data['ShipTo']); + } + if (\array_key_exists('PaymentInformation', $data)) { + $object->setPaymentInformation($this->denormalizer->denormalize($data['PaymentInformation'], \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class, 'json', $context)); + unset($data['PaymentInformation']); + } + if (\array_key_exists('Service', $data)) { + $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); + unset($data['Service']); + } + if (\array_key_exists('HandlingUnitOne', $data)) { + $object->setHandlingUnitOne($this->denormalizer->denormalize($data['HandlingUnitOne'], \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class, 'json', $context)); + unset($data['HandlingUnitOne']); + } + if (\array_key_exists('HandlingUnitTwo', $data)) { + $object->setHandlingUnitTwo($this->denormalizer->denormalize($data['HandlingUnitTwo'], \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class, 'json', $context)); + unset($data['HandlingUnitTwo']); + } + if (\array_key_exists('ExistingShipmentID', $data)) { + $object->setExistingShipmentID($this->denormalizer->denormalize($data['ExistingShipmentID'], \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class, 'json', $context)); + unset($data['ExistingShipmentID']); + } + if (\array_key_exists('HandlingInstructions', $data)) { + $object->setHandlingInstructions($data['HandlingInstructions']); + unset($data['HandlingInstructions']); + } + if (\array_key_exists('DeliveryInstructions', $data)) { + $object->setDeliveryInstructions($data['DeliveryInstructions']); + unset($data['DeliveryInstructions']); + } + if (\array_key_exists('PickupInstructions', $data)) { + $object->setPickupInstructions($data['PickupInstructions']); + unset($data['PickupInstructions']); + } + if (\array_key_exists('Commodity', $data)) { $values = []; - foreach ($object->getCommodity() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Commodity'] = $values; - if ($object->isInitialized('reference') && null !== $object->getReference()) { - $values_1 = []; - foreach ($object->getReference() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Reference'] = $values_1; - } - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('pickupRequest') && null !== $object->getPickupRequest()) { - $data['PickupRequest'] = $this->normalizer->normalize($object->getPickupRequest(), 'json', $context); - } - if ($object->isInitialized('documents') && null !== $object->getDocuments()) { - $data['Documents'] = $this->normalizer->normalize($object->getDocuments(), 'json', $context); - } - if ($object->isInitialized('timeInTransitIndicator') && null !== $object->getTimeInTransitIndicator()) { - $data['TimeInTransitIndicator'] = $object->getTimeInTransitIndicator(); + foreach ($data['Commodity'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentCommodity::class, 'json', $context); } - if ($object->isInitialized('handlingUnits') && null !== $object->getHandlingUnits()) { - $data['HandlingUnits'] = $this->normalizer->normalize($object->getHandlingUnits(), 'json', $context); - } - if ($object->isInitialized('densityEligibleIndicator') && null !== $object->getDensityEligibleIndicator()) { - $data['DensityEligibleIndicator'] = $object->getDensityEligibleIndicator(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setCommodity($values); + unset($data['Commodity']); + } + if (\array_key_exists('Reference', $data)) { + $values_1 = []; + foreach ($data['Reference'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentReference::class, 'json', $context); } - return $data; + $object->setReference($values_1); + unset($data['Reference']); + } + if (\array_key_exists('ShipmentServiceOptions', $data)) { + $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class, 'json', $context)); + unset($data['ShipmentServiceOptions']); + } + if (\array_key_exists('PickupRequest', $data)) { + $object->setPickupRequest($this->denormalizer->denormalize($data['PickupRequest'], \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class, 'json', $context)); + unset($data['PickupRequest']); + } + if (\array_key_exists('Documents', $data)) { + $object->setDocuments($this->denormalizer->denormalize($data['Documents'], \ShipStream\Ups\Api\Model\ShipmentDocuments::class, 'json', $context)); + unset($data['Documents']); + } + if (\array_key_exists('TimeInTransitIndicator', $data)) { + $object->setTimeInTransitIndicator($data['TimeInTransitIndicator']); + unset($data['TimeInTransitIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipRequestShipment::class => false]; + if (\array_key_exists('HandlingUnits', $data)) { + $object->setHandlingUnits($this->denormalizer->denormalize($data['HandlingUnits'], \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class, 'json', $context)); + unset($data['HandlingUnits']); } + if (\array_key_exists('DensityEligibleIndicator', $data)) { + $object->setDensityEligibleIndicator($data['DensityEligibleIndicator']); + unset($data['DensityEligibleIndicator']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } -} else { - class FreightShipRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipRequestShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipFrom', $data)) { - $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class, 'json', $context)); - unset($data['ShipFrom']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('PaymentInformation', $data)) { - $object->setPaymentInformation($this->denormalizer->denormalize($data['PaymentInformation'], \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class, 'json', $context)); - unset($data['PaymentInformation']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('HandlingUnitOne', $data)) { - $object->setHandlingUnitOne($this->denormalizer->denormalize($data['HandlingUnitOne'], \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class, 'json', $context)); - unset($data['HandlingUnitOne']); - } - if (\array_key_exists('HandlingUnitTwo', $data)) { - $object->setHandlingUnitTwo($this->denormalizer->denormalize($data['HandlingUnitTwo'], \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class, 'json', $context)); - unset($data['HandlingUnitTwo']); - } - if (\array_key_exists('ExistingShipmentID', $data)) { - $object->setExistingShipmentID($this->denormalizer->denormalize($data['ExistingShipmentID'], \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class, 'json', $context)); - unset($data['ExistingShipmentID']); - } - if (\array_key_exists('HandlingInstructions', $data)) { - $object->setHandlingInstructions($data['HandlingInstructions']); - unset($data['HandlingInstructions']); - } - if (\array_key_exists('DeliveryInstructions', $data)) { - $object->setDeliveryInstructions($data['DeliveryInstructions']); - unset($data['DeliveryInstructions']); - } - if (\array_key_exists('PickupInstructions', $data)) { - $object->setPickupInstructions($data['PickupInstructions']); - unset($data['PickupInstructions']); - } - if (\array_key_exists('Commodity', $data)) { - $values = []; - foreach ($data['Commodity'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentCommodity::class, 'json', $context); - } - $object->setCommodity($values); - unset($data['Commodity']); - } - if (\array_key_exists('Reference', $data)) { - $values_1 = []; - foreach ($data['Reference'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentReference::class, 'json', $context); - } - $object->setReference($values_1); - unset($data['Reference']); - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('PickupRequest', $data)) { - $object->setPickupRequest($this->denormalizer->denormalize($data['PickupRequest'], \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class, 'json', $context)); - unset($data['PickupRequest']); - } - if (\array_key_exists('Documents', $data)) { - $object->setDocuments($this->denormalizer->denormalize($data['Documents'], \ShipStream\Ups\Api\Model\ShipmentDocuments::class, 'json', $context)); - unset($data['Documents']); - } - if (\array_key_exists('TimeInTransitIndicator', $data)) { - $object->setTimeInTransitIndicator($data['TimeInTransitIndicator']); - unset($data['TimeInTransitIndicator']); - } - if (\array_key_exists('HandlingUnits', $data)) { - $object->setHandlingUnits($this->denormalizer->denormalize($data['HandlingUnits'], \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class, 'json', $context)); - unset($data['HandlingUnits']); - } - if (\array_key_exists('DensityEligibleIndicator', $data)) { - $object->setDensityEligibleIndicator($data['DensityEligibleIndicator']); - unset($data['DensityEligibleIndicator']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray = []; + $dataArray['ShipFrom'] = $this->normalizer->normalize($data->getShipFrom(), 'json', $context); + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + $dataArray['ShipTo'] = $this->normalizer->normalize($data->getShipTo(), 'json', $context); + $dataArray['PaymentInformation'] = $this->normalizer->normalize($data->getPaymentInformation(), 'json', $context); + $dataArray['Service'] = $this->normalizer->normalize($data->getService(), 'json', $context); + if ($data->isInitialized('handlingUnitOne') && null !== $data->getHandlingUnitOne()) { + $dataArray['HandlingUnitOne'] = $this->normalizer->normalize($data->getHandlingUnitOne(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ShipFrom'] = $this->normalizer->normalize($object->getShipFrom(), 'json', $context); - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - $data['PaymentInformation'] = $this->normalizer->normalize($object->getPaymentInformation(), 'json', $context); - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - if ($object->isInitialized('handlingUnitOne') && null !== $object->getHandlingUnitOne()) { - $data['HandlingUnitOne'] = $this->normalizer->normalize($object->getHandlingUnitOne(), 'json', $context); - } - if ($object->isInitialized('handlingUnitTwo') && null !== $object->getHandlingUnitTwo()) { - $data['HandlingUnitTwo'] = $this->normalizer->normalize($object->getHandlingUnitTwo(), 'json', $context); - } - if ($object->isInitialized('existingShipmentID') && null !== $object->getExistingShipmentID()) { - $data['ExistingShipmentID'] = $this->normalizer->normalize($object->getExistingShipmentID(), 'json', $context); - } - if ($object->isInitialized('handlingInstructions') && null !== $object->getHandlingInstructions()) { - $data['HandlingInstructions'] = $object->getHandlingInstructions(); - } - if ($object->isInitialized('deliveryInstructions') && null !== $object->getDeliveryInstructions()) { - $data['DeliveryInstructions'] = $object->getDeliveryInstructions(); - } - if ($object->isInitialized('pickupInstructions') && null !== $object->getPickupInstructions()) { - $data['PickupInstructions'] = $object->getPickupInstructions(); - } - $values = []; - foreach ($object->getCommodity() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Commodity'] = $values; - if ($object->isInitialized('reference') && null !== $object->getReference()) { - $values_1 = []; - foreach ($object->getReference() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Reference'] = $values_1; - } - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('pickupRequest') && null !== $object->getPickupRequest()) { - $data['PickupRequest'] = $this->normalizer->normalize($object->getPickupRequest(), 'json', $context); - } - if ($object->isInitialized('documents') && null !== $object->getDocuments()) { - $data['Documents'] = $this->normalizer->normalize($object->getDocuments(), 'json', $context); - } - if ($object->isInitialized('timeInTransitIndicator') && null !== $object->getTimeInTransitIndicator()) { - $data['TimeInTransitIndicator'] = $object->getTimeInTransitIndicator(); - } - if ($object->isInitialized('handlingUnits') && null !== $object->getHandlingUnits()) { - $data['HandlingUnits'] = $this->normalizer->normalize($object->getHandlingUnits(), 'json', $context); - } - if ($object->isInitialized('densityEligibleIndicator') && null !== $object->getDensityEligibleIndicator()) { - $data['DensityEligibleIndicator'] = $object->getDensityEligibleIndicator(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + if ($data->isInitialized('handlingUnitTwo') && null !== $data->getHandlingUnitTwo()) { + $dataArray['HandlingUnitTwo'] = $this->normalizer->normalize($data->getHandlingUnitTwo(), 'json', $context); + } + if ($data->isInitialized('existingShipmentID') && null !== $data->getExistingShipmentID()) { + $dataArray['ExistingShipmentID'] = $this->normalizer->normalize($data->getExistingShipmentID(), 'json', $context); + } + if ($data->isInitialized('handlingInstructions') && null !== $data->getHandlingInstructions()) { + $dataArray['HandlingInstructions'] = $data->getHandlingInstructions(); + } + if ($data->isInitialized('deliveryInstructions') && null !== $data->getDeliveryInstructions()) { + $dataArray['DeliveryInstructions'] = $data->getDeliveryInstructions(); + } + if ($data->isInitialized('pickupInstructions') && null !== $data->getPickupInstructions()) { + $dataArray['PickupInstructions'] = $data->getPickupInstructions(); + } + $values = []; + foreach ($data->getCommodity() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Commodity'] = $values; + if ($data->isInitialized('reference') && null !== $data->getReference()) { + $values_1 = []; + foreach ($data->getReference() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['Reference'] = $values_1; + } + if ($data->isInitialized('shipmentServiceOptions') && null !== $data->getShipmentServiceOptions()) { + $dataArray['ShipmentServiceOptions'] = $this->normalizer->normalize($data->getShipmentServiceOptions(), 'json', $context); + } + if ($data->isInitialized('pickupRequest') && null !== $data->getPickupRequest()) { + $dataArray['PickupRequest'] = $this->normalizer->normalize($data->getPickupRequest(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipRequestShipment::class => false]; + if ($data->isInitialized('documents') && null !== $data->getDocuments()) { + $dataArray['Documents'] = $this->normalizer->normalize($data->getDocuments(), 'json', $context); } + if ($data->isInitialized('timeInTransitIndicator') && null !== $data->getTimeInTransitIndicator()) { + $dataArray['TimeInTransitIndicator'] = $data->getTimeInTransitIndicator(); + } + if ($data->isInitialized('handlingUnits') && null !== $data->getHandlingUnits()) { + $dataArray['HandlingUnits'] = $this->normalizer->normalize($data->getHandlingUnits(), 'json', $context); + } + if ($data->isInitialized('densityEligibleIndicator') && null !== $data->getDensityEligibleIndicator()) { + $dataArray['DensityEligibleIndicator'] = $data->getDensityEligibleIndicator(); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipRequestShipment::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipResponseNormalizer.php b/src/Api/Normalizer/FreightShipResponseNormalizer.php index ca487824..b51fbf73 100644 --- a/src/Api/Normalizer/FreightShipResponseNormalizer.php +++ b/src/Api/Normalizer/FreightShipResponseNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipResponse::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('ShipmentResults', $data)) { - $object->setShipmentResults($this->denormalizer->denormalize($data['ShipmentResults'], \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class, 'json', $context)); - unset($data['ShipmentResults']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['ShipmentResults'] = $this->normalizer->normalize($object->getShipmentResults(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipResponse::class => false]; - } - } -} else { - class FreightShipResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipResponse::class; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class, 'json', $context)); + unset($data['Response']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipResponse::class; + if (\array_key_exists('ShipmentResults', $data)) { + $object->setShipmentResults($this->denormalizer->denormalize($data['ShipmentResults'], \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class, 'json', $context)); + unset($data['ShipmentResults']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('ShipmentResults', $data)) { - $object->setShipmentResults($this->denormalizer->denormalize($data['ShipmentResults'], \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class, 'json', $context)); - unset($data['ShipmentResults']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['ShipmentResults'] = $this->normalizer->normalize($object->getShipmentResults(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + $dataArray['ShipmentResults'] = $this->normalizer->normalize($data->getShipmentResults(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipResponseResponseNormalizer.php b/src/Api/Normalizer/FreightShipResponseResponseNormalizer.php index 458d6ce2..6b892b41 100644 --- a/src/Api/Normalizer/FreightShipResponseResponseNormalizer.php +++ b/src/Api/Normalizer/FreightShipResponseResponseNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipResponseResponse::class => false]; + if (\array_key_exists('Alert', $data)) { + $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); + unset($data['Alert']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightShipResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $dataArray['Alert'] = $this->normalizer->normalize($data->getAlert(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipResponseShipmentResultsNormalizer.php b/src/Api/Normalizer/FreightShipResponseShipmentResultsNormalizer.php index 855fbecd..f6d61e57 100644 --- a/src/Api/Normalizer/FreightShipResponseShipmentResultsNormalizer.php +++ b/src/Api/Normalizer/FreightShipResponseShipmentResultsNormalizer.php @@ -5,314 +5,156 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipResponseShipmentResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipResponseShipmentResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupRequestConfirmationNumber', $data)) { - $object->setPickupRequestConfirmationNumber($data['PickupRequestConfirmationNumber']); - unset($data['PickupRequestConfirmationNumber']); - } - if (\array_key_exists('DeliveryDate', $data)) { - $object->setDeliveryDate($data['DeliveryDate']); - unset($data['DeliveryDate']); - } - if (\array_key_exists('ShipmentNumber', $data)) { - $object->setShipmentNumber($data['ShipmentNumber']); - unset($data['ShipmentNumber']); - } - if (\array_key_exists('BOLID', $data)) { - $object->setBOLID($data['BOLID']); - unset($data['BOLID']); - } - if (\array_key_exists('GuaranteedIndicator', $data)) { - $object->setGuaranteedIndicator($data['GuaranteedIndicator']); - unset($data['GuaranteedIndicator']); - } - if (\array_key_exists('MinimumChargeAppliedIndicator', $data)) { - $object->setMinimumChargeAppliedIndicator($data['MinimumChargeAppliedIndicator']); - unset($data['MinimumChargeAppliedIndicator']); - } - if (\array_key_exists('Rate', $data)) { - $values = []; - foreach ($data['Rate'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentResultsRate::class, 'json', $context); - } - $object->setRate($values); - unset($data['Rate']); - } - if (\array_key_exists('FreightDensityRate', $data)) { - $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class, 'json', $context)); - unset($data['FreightDensityRate']); - } - if (\array_key_exists('TotalShipmentCharge', $data)) { - $object->setTotalShipmentCharge($this->denormalizer->denormalize($data['TotalShipmentCharge'], \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class, 'json', $context)); - unset($data['TotalShipmentCharge']); - } - if (\array_key_exists('BillableShipmentWeight', $data)) { - $object->setBillableShipmentWeight($this->denormalizer->denormalize($data['BillableShipmentWeight'], \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class, 'json', $context)); - unset($data['BillableShipmentWeight']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentResultsService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('Documents', $data)) { - $object->setDocuments($this->denormalizer->denormalize($data['Documents'], \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class, 'json', $context)); - unset($data['Documents']); - } - if (\array_key_exists('TimeInTransit', $data)) { - $object->setTimeInTransit($this->denormalizer->denormalize($data['TimeInTransit'], \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class, 'json', $context)); - unset($data['TimeInTransit']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('pickupRequestConfirmationNumber') && null !== $object->getPickupRequestConfirmationNumber()) { - $data['PickupRequestConfirmationNumber'] = $object->getPickupRequestConfirmationNumber(); - } - if ($object->isInitialized('deliveryDate') && null !== $object->getDeliveryDate()) { - $data['DeliveryDate'] = $object->getDeliveryDate(); - } - if ($object->isInitialized('shipmentNumber') && null !== $object->getShipmentNumber()) { - $data['ShipmentNumber'] = $object->getShipmentNumber(); - } - if ($object->isInitialized('bOLID') && null !== $object->getBOLID()) { - $data['BOLID'] = $object->getBOLID(); - } - if ($object->isInitialized('guaranteedIndicator') && null !== $object->getGuaranteedIndicator()) { - $data['GuaranteedIndicator'] = $object->getGuaranteedIndicator(); - } - if ($object->isInitialized('minimumChargeAppliedIndicator') && null !== $object->getMinimumChargeAppliedIndicator()) { - $data['MinimumChargeAppliedIndicator'] = $object->getMinimumChargeAppliedIndicator(); - } - if ($object->isInitialized('rate') && null !== $object->getRate()) { - $values = []; - foreach ($object->getRate() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Rate'] = $values; - } - if ($object->isInitialized('freightDensityRate') && null !== $object->getFreightDensityRate()) { - $data['FreightDensityRate'] = $this->normalizer->normalize($object->getFreightDensityRate(), 'json', $context); - } - if ($object->isInitialized('totalShipmentCharge') && null !== $object->getTotalShipmentCharge()) { - $data['TotalShipmentCharge'] = $this->normalizer->normalize($object->getTotalShipmentCharge(), 'json', $context); - } - if ($object->isInitialized('billableShipmentWeight') && null !== $object->getBillableShipmentWeight()) { - $data['BillableShipmentWeight'] = $this->normalizer->normalize($object->getBillableShipmentWeight(), 'json', $context); - } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - } - if ($object->isInitialized('documents') && null !== $object->getDocuments()) { - $data['Documents'] = $this->normalizer->normalize($object->getDocuments(), 'json', $context); - } - if ($object->isInitialized('timeInTransit') && null !== $object->getTimeInTransit()) { - $data['TimeInTransit'] = $this->normalizer->normalize($object->getTimeInTransit(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('PickupRequestConfirmationNumber', $data)) { + $object->setPickupRequestConfirmationNumber($data['PickupRequestConfirmationNumber']); + unset($data['PickupRequestConfirmationNumber']); + } + if (\array_key_exists('DeliveryDate', $data)) { + $object->setDeliveryDate($data['DeliveryDate']); + unset($data['DeliveryDate']); + } + if (\array_key_exists('ShipmentNumber', $data)) { + $object->setShipmentNumber($data['ShipmentNumber']); + unset($data['ShipmentNumber']); + } + if (\array_key_exists('BOLID', $data)) { + $object->setBOLID($data['BOLID']); + unset($data['BOLID']); + } + if (\array_key_exists('GuaranteedIndicator', $data)) { + $object->setGuaranteedIndicator($data['GuaranteedIndicator']); + unset($data['GuaranteedIndicator']); + } + if (\array_key_exists('MinimumChargeAppliedIndicator', $data)) { + $object->setMinimumChargeAppliedIndicator($data['MinimumChargeAppliedIndicator']); + unset($data['MinimumChargeAppliedIndicator']); + } + if (\array_key_exists('Rate', $data)) { + $values = []; + foreach ($data['Rate'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentResultsRate::class, 'json', $context); } - return $data; + $object->setRate($values); + unset($data['Rate']); + } + if (\array_key_exists('FreightDensityRate', $data)) { + $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class, 'json', $context)); + unset($data['FreightDensityRate']); + } + if (\array_key_exists('TotalShipmentCharge', $data)) { + $object->setTotalShipmentCharge($this->denormalizer->denormalize($data['TotalShipmentCharge'], \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class, 'json', $context)); + unset($data['TotalShipmentCharge']); + } + if (\array_key_exists('BillableShipmentWeight', $data)) { + $object->setBillableShipmentWeight($this->denormalizer->denormalize($data['BillableShipmentWeight'], \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class, 'json', $context)); + unset($data['BillableShipmentWeight']); + } + if (\array_key_exists('Service', $data)) { + $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentResultsService::class, 'json', $context)); + unset($data['Service']); + } + if (\array_key_exists('Documents', $data)) { + $object->setDocuments($this->denormalizer->denormalize($data['Documents'], \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class, 'json', $context)); + unset($data['Documents']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class => false]; + if (\array_key_exists('TimeInTransit', $data)) { + $object->setTimeInTransit($this->denormalizer->denormalize($data['TimeInTransit'], \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class, 'json', $context)); + unset($data['TimeInTransit']); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class FreightShipResponseShipmentResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class; + $dataArray = []; + if ($data->isInitialized('pickupRequestConfirmationNumber') && null !== $data->getPickupRequestConfirmationNumber()) { + $dataArray['PickupRequestConfirmationNumber'] = $data->getPickupRequestConfirmationNumber(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class; + if ($data->isInitialized('deliveryDate') && null !== $data->getDeliveryDate()) { + $dataArray['DeliveryDate'] = $data->getDeliveryDate(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupRequestConfirmationNumber', $data)) { - $object->setPickupRequestConfirmationNumber($data['PickupRequestConfirmationNumber']); - unset($data['PickupRequestConfirmationNumber']); - } - if (\array_key_exists('DeliveryDate', $data)) { - $object->setDeliveryDate($data['DeliveryDate']); - unset($data['DeliveryDate']); - } - if (\array_key_exists('ShipmentNumber', $data)) { - $object->setShipmentNumber($data['ShipmentNumber']); - unset($data['ShipmentNumber']); - } - if (\array_key_exists('BOLID', $data)) { - $object->setBOLID($data['BOLID']); - unset($data['BOLID']); - } - if (\array_key_exists('GuaranteedIndicator', $data)) { - $object->setGuaranteedIndicator($data['GuaranteedIndicator']); - unset($data['GuaranteedIndicator']); - } - if (\array_key_exists('MinimumChargeAppliedIndicator', $data)) { - $object->setMinimumChargeAppliedIndicator($data['MinimumChargeAppliedIndicator']); - unset($data['MinimumChargeAppliedIndicator']); - } - if (\array_key_exists('Rate', $data)) { - $values = []; - foreach ($data['Rate'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentResultsRate::class, 'json', $context); - } - $object->setRate($values); - unset($data['Rate']); - } - if (\array_key_exists('FreightDensityRate', $data)) { - $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class, 'json', $context)); - unset($data['FreightDensityRate']); - } - if (\array_key_exists('TotalShipmentCharge', $data)) { - $object->setTotalShipmentCharge($this->denormalizer->denormalize($data['TotalShipmentCharge'], \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class, 'json', $context)); - unset($data['TotalShipmentCharge']); - } - if (\array_key_exists('BillableShipmentWeight', $data)) { - $object->setBillableShipmentWeight($this->denormalizer->denormalize($data['BillableShipmentWeight'], \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class, 'json', $context)); - unset($data['BillableShipmentWeight']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentResultsService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('Documents', $data)) { - $object->setDocuments($this->denormalizer->denormalize($data['Documents'], \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class, 'json', $context)); - unset($data['Documents']); - } - if (\array_key_exists('TimeInTransit', $data)) { - $object->setTimeInTransit($this->denormalizer->denormalize($data['TimeInTransit'], \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class, 'json', $context)); - unset($data['TimeInTransit']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('shipmentNumber') && null !== $data->getShipmentNumber()) { + $dataArray['ShipmentNumber'] = $data->getShipmentNumber(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('pickupRequestConfirmationNumber') && null !== $object->getPickupRequestConfirmationNumber()) { - $data['PickupRequestConfirmationNumber'] = $object->getPickupRequestConfirmationNumber(); - } - if ($object->isInitialized('deliveryDate') && null !== $object->getDeliveryDate()) { - $data['DeliveryDate'] = $object->getDeliveryDate(); - } - if ($object->isInitialized('shipmentNumber') && null !== $object->getShipmentNumber()) { - $data['ShipmentNumber'] = $object->getShipmentNumber(); - } - if ($object->isInitialized('bOLID') && null !== $object->getBOLID()) { - $data['BOLID'] = $object->getBOLID(); - } - if ($object->isInitialized('guaranteedIndicator') && null !== $object->getGuaranteedIndicator()) { - $data['GuaranteedIndicator'] = $object->getGuaranteedIndicator(); - } - if ($object->isInitialized('minimumChargeAppliedIndicator') && null !== $object->getMinimumChargeAppliedIndicator()) { - $data['MinimumChargeAppliedIndicator'] = $object->getMinimumChargeAppliedIndicator(); - } - if ($object->isInitialized('rate') && null !== $object->getRate()) { - $values = []; - foreach ($object->getRate() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Rate'] = $values; - } - if ($object->isInitialized('freightDensityRate') && null !== $object->getFreightDensityRate()) { - $data['FreightDensityRate'] = $this->normalizer->normalize($object->getFreightDensityRate(), 'json', $context); - } - if ($object->isInitialized('totalShipmentCharge') && null !== $object->getTotalShipmentCharge()) { - $data['TotalShipmentCharge'] = $this->normalizer->normalize($object->getTotalShipmentCharge(), 'json', $context); - } - if ($object->isInitialized('billableShipmentWeight') && null !== $object->getBillableShipmentWeight()) { - $data['BillableShipmentWeight'] = $this->normalizer->normalize($object->getBillableShipmentWeight(), 'json', $context); - } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - } - if ($object->isInitialized('documents') && null !== $object->getDocuments()) { - $data['Documents'] = $this->normalizer->normalize($object->getDocuments(), 'json', $context); - } - if ($object->isInitialized('timeInTransit') && null !== $object->getTimeInTransit()) { - $data['TimeInTransit'] = $this->normalizer->normalize($object->getTimeInTransit(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if ($data->isInitialized('bOLID') && null !== $data->getBOLID()) { + $dataArray['BOLID'] = $data->getBOLID(); + } + if ($data->isInitialized('guaranteedIndicator') && null !== $data->getGuaranteedIndicator()) { + $dataArray['GuaranteedIndicator'] = $data->getGuaranteedIndicator(); + } + if ($data->isInitialized('minimumChargeAppliedIndicator') && null !== $data->getMinimumChargeAppliedIndicator()) { + $dataArray['MinimumChargeAppliedIndicator'] = $data->getMinimumChargeAppliedIndicator(); + } + if ($data->isInitialized('rate') && null !== $data->getRate()) { + $values = []; + foreach ($data->getRate() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $data; + $dataArray['Rate'] = $values; + } + if ($data->isInitialized('freightDensityRate') && null !== $data->getFreightDensityRate()) { + $dataArray['FreightDensityRate'] = $this->normalizer->normalize($data->getFreightDensityRate(), 'json', $context); + } + if ($data->isInitialized('totalShipmentCharge') && null !== $data->getTotalShipmentCharge()) { + $dataArray['TotalShipmentCharge'] = $this->normalizer->normalize($data->getTotalShipmentCharge(), 'json', $context); + } + if ($data->isInitialized('billableShipmentWeight') && null !== $data->getBillableShipmentWeight()) { + $dataArray['BillableShipmentWeight'] = $this->normalizer->normalize($data->getBillableShipmentWeight(), 'json', $context); + } + if ($data->isInitialized('service') && null !== $data->getService()) { + $dataArray['Service'] = $this->normalizer->normalize($data->getService(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class => false]; + if ($data->isInitialized('documents') && null !== $data->getDocuments()) { + $dataArray['Documents'] = $this->normalizer->normalize($data->getDocuments(), 'json', $context); } + if ($data->isInitialized('timeInTransit') && null !== $data->getTimeInTransit()) { + $dataArray['TimeInTransit'] = $this->normalizer->normalize($data->getTimeInTransit(), 'json', $context); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipShipFromAddressNormalizer.php b/src/Api/Normalizer/FreightShipShipFromAddressNormalizer.php index 85dbe37c..a5d04228 100644 --- a/src/Api/Normalizer/FreightShipShipFromAddressNormalizer.php +++ b/src/Api/Normalizer/FreightShipShipFromAddressNormalizer.php @@ -5,188 +5,93 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipFromAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipShipFromAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AddressLine'] = $object->getAddressLine(); - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressLine', $data)) { + $object->setAddressLine($data['AddressLine']); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('Town', $data)) { + $object->setTown($data['Town']); + unset($data['Town']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class => false]; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightShipShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class; + $dataArray = []; + $dataArray['AddressLine'] = $data->getAddressLine(); + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['Town'] = $data->getTown(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipFromAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AddressLine'] = $object->getAddressLine(); - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipShipToAddressNormalizer.php b/src/Api/Normalizer/FreightShipShipToAddressNormalizer.php index 0880b394..24b03e93 100644 --- a/src/Api/Normalizer/FreightShipShipToAddressNormalizer.php +++ b/src/Api/Normalizer/FreightShipShipToAddressNormalizer.php @@ -5,188 +5,93 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipShipToAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AddressLine'] = $object->getAddressLine(); - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressLine', $data)) { + $object->setAddressLine($data['AddressLine']); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('Town', $data)) { + $object->setTown($data['Town']); + unset($data['Town']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipToAddress::class => false]; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightShipShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class; + $dataArray = []; + $dataArray['AddressLine'] = $data->getAddressLine(); + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['Town'] = $data->getTown(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AddressLine'] = $object->getAddressLine(); - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipToAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipShipToAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipShipmentPaymentInformationNormalizer.php b/src/Api/Normalizer/FreightShipShipmentPaymentInformationNormalizer.php index 60b68bf7..8b1570ac 100644 --- a/src/Api/Normalizer/FreightShipShipmentPaymentInformationNormalizer.php +++ b/src/Api/Normalizer/FreightShipShipmentPaymentInformationNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipShipmentPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipShipmentPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Payer', $data)) { - $object->setPayer($this->denormalizer->denormalize($data['Payer'], \ShipStream\Ups\Api\Model\PaymentInformationPayer::class, 'json', $context)); - unset($data['Payer']); - } - if (\array_key_exists('ShipmentBillingOption', $data)) { - $object->setShipmentBillingOption($this->denormalizer->denormalize($data['ShipmentBillingOption'], \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class, 'json', $context)); - unset($data['ShipmentBillingOption']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Payer'] = $this->normalizer->normalize($object->getPayer(), 'json', $context); - $data['ShipmentBillingOption'] = $this->normalizer->normalize($object->getShipmentBillingOption(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class => false]; - } - } -} else { - class FreightShipShipmentPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class; + if (\array_key_exists('Payer', $data)) { + $object->setPayer($this->denormalizer->denormalize($data['Payer'], \ShipStream\Ups\Api\Model\PaymentInformationPayer::class, 'json', $context)); + unset($data['Payer']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class; + if (\array_key_exists('ShipmentBillingOption', $data)) { + $object->setShipmentBillingOption($this->denormalizer->denormalize($data['ShipmentBillingOption'], \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class, 'json', $context)); + unset($data['ShipmentBillingOption']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Payer', $data)) { - $object->setPayer($this->denormalizer->denormalize($data['Payer'], \ShipStream\Ups\Api\Model\PaymentInformationPayer::class, 'json', $context)); - unset($data['Payer']); - } - if (\array_key_exists('ShipmentBillingOption', $data)) { - $object->setShipmentBillingOption($this->denormalizer->denormalize($data['ShipmentBillingOption'], \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class, 'json', $context)); - unset($data['ShipmentBillingOption']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Payer'] = $this->normalizer->normalize($object->getPayer(), 'json', $context); - $data['ShipmentBillingOption'] = $this->normalizer->normalize($object->getShipmentBillingOption(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Payer'] = $this->normalizer->normalize($data->getPayer(), 'json', $context); + $dataArray['ShipmentBillingOption'] = $this->normalizer->normalize($data->getShipmentBillingOption(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipShipmentServiceOptionsDangerousGoodsNormalizer.php b/src/Api/Normalizer/FreightShipShipmentServiceOptionsDangerousGoodsNormalizer.php index b5b00a19..3315d6af 100644 --- a/src/Api/Normalizer/FreightShipShipmentServiceOptionsDangerousGoodsNormalizer.php +++ b/src/Api/Normalizer/FreightShipShipmentServiceOptionsDangerousGoodsNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipShipmentServiceOptionsDangerousGoodsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipShipmentServiceOptionsDangerousGoodsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class, 'json', $context)); - unset($data['Phone']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class => false]; - } - } -} else { - class FreightShipShipmentServiceOptionsDangerousGoodsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class; + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class, 'json', $context)); + unset($data['Phone']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class, 'json', $context)); - unset($data['Phone']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Name'] = $data->getName(); + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipShipmentShipFromNormalizer.php b/src/Api/Normalizer/FreightShipShipmentShipFromNormalizer.php index f790510a..afc1fab4 100644 --- a/src/Api/Normalizer/FreightShipShipmentShipFromNormalizer.php +++ b/src/Api/Normalizer/FreightShipShipmentShipFromNormalizer.php @@ -5,206 +5,102 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipShipmentShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipShipmentShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipFromPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('TaxIdentificationNumber', $data)) { + $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); + unset($data['TaxIdentificationNumber']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class, 'json', $context)); + unset($data['Address']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipFromPhone::class, 'json', $context)); + unset($data['Phone']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class => false]; + if (\array_key_exists('FaxNumber', $data)) { + $object->setFaxNumber($data['FaxNumber']); + unset($data['FaxNumber']); } + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightShipShipmentShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipFromPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Name'] = $data->getName(); + if ($data->isInitialized('taxIdentificationNumber') && null !== $data->getTaxIdentificationNumber()) { + $dataArray['TaxIdentificationNumber'] = $data->getTaxIdentificationNumber(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('address') && null !== $data->getAddress()) { + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class => false]; + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); + if ($data->isInitialized('faxNumber') && null !== $data->getFaxNumber()) { + $dataArray['FaxNumber'] = $data->getFaxNumber(); + } + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipShipmentShipToNormalizer.php b/src/Api/Normalizer/FreightShipShipmentShipToNormalizer.php index e0b9e4ad..11c1c30c 100644 --- a/src/Api/Normalizer/FreightShipShipmentShipToNormalizer.php +++ b/src/Api/Normalizer/FreightShipShipmentShipToNormalizer.php @@ -5,210 +5,104 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipShipmentShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipShipmentShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipToPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('TaxIdentificationNumber', $data)) { + $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); + unset($data['TaxIdentificationNumber']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class, 'json', $context)); + unset($data['Address']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipToPhone::class, 'json', $context)); + unset($data['Phone']); + } + if (\array_key_exists('FaxNumber', $data)) { + $object->setFaxNumber($data['FaxNumber']); + unset($data['FaxNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class => false]; + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightShipShipmentShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipToPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Name'] = $data->getName(); + if ($data->isInitialized('taxIdentificationNumber') && null !== $data->getTaxIdentificationNumber()) { + $dataArray['TaxIdentificationNumber'] = $data->getTaxIdentificationNumber(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('address') && null !== $data->getAddress()) { + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class => false]; + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } + if ($data->isInitialized('phone') && null !== $data->getPhone()) { + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); + } + if ($data->isInitialized('faxNumber') && null !== $data->getFaxNumber()) { + $dataArray['FaxNumber'] = $data->getFaxNumber(); + } + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipShipmentShipmentServiceOptionsNormalizer.php b/src/Api/Normalizer/FreightShipShipmentShipmentServiceOptionsNormalizer.php index b174c09b..5d40252f 100644 --- a/src/Api/Normalizer/FreightShipShipmentShipmentServiceOptionsNormalizer.php +++ b/src/Api/Normalizer/FreightShipShipmentShipmentServiceOptionsNormalizer.php @@ -5,314 +5,156 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipShipmentShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipShipmentShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailInformation', $data)) { - $values = []; - foreach ($data['EMailInformation'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class, 'json', $context); - } - $object->setEMailInformation($values); - unset($data['EMailInformation']); - } - if (\array_key_exists('PickupOptions', $data)) { - $object->setPickupOptions($this->denormalizer->denormalize($data['PickupOptions'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class, 'json', $context)); - unset($data['PickupOptions']); - } - if (\array_key_exists('DeliveryOptions', $data)) { - $object->setDeliveryOptions($this->denormalizer->denormalize($data['DeliveryOptions'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class, 'json', $context)); - unset($data['DeliveryOptions']); - } - if (\array_key_exists('OverSeasLeg', $data)) { - $object->setOverSeasLeg($this->denormalizer->denormalize($data['OverSeasLeg'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class, 'json', $context)); - unset($data['OverSeasLeg']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('DangerousGoods', $data)) { - $object->setDangerousGoods($this->denormalizer->denormalize($data['DangerousGoods'], \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class, 'json', $context)); - unset($data['DangerousGoods']); - } - if (\array_key_exists('SortingAndSegregating', $data)) { - $object->setSortingAndSegregating($this->denormalizer->denormalize($data['SortingAndSegregating'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class, 'json', $context)); - unset($data['SortingAndSegregating']); - } - if (\array_key_exists('DeclaredValue', $data)) { - $object->setDeclaredValue($this->denormalizer->denormalize($data['DeclaredValue'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class, 'json', $context)); - unset($data['DeclaredValue']); - } - if (\array_key_exists('ExcessDeclaredValue', $data)) { - $object->setExcessDeclaredValue($this->denormalizer->denormalize($data['ExcessDeclaredValue'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class, 'json', $context)); - unset($data['ExcessDeclaredValue']); - } - if (\array_key_exists('HandlingCharge', $data)) { - $object->setHandlingCharge($this->denormalizer->denormalize($data['HandlingCharge'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class, 'json', $context)); - unset($data['HandlingCharge']); - } - if (\array_key_exists('FreezableProtectionIndicator', $data)) { - $object->setFreezableProtectionIndicator($data['FreezableProtectionIndicator']); - unset($data['FreezableProtectionIndicator']); - } - if (\array_key_exists('ExtremeLengthIndicator', $data)) { - $object->setExtremeLengthIndicator($data['ExtremeLengthIndicator']); - unset($data['ExtremeLengthIndicator']); - } - if (\array_key_exists('LinearFeet', $data)) { - $object->setLinearFeet($data['LinearFeet']); - unset($data['LinearFeet']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('eMailInformation') && null !== $object->getEMailInformation()) { - $values = []; - foreach ($object->getEMailInformation() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['EMailInformation'] = $values; - } - if ($object->isInitialized('pickupOptions') && null !== $object->getPickupOptions()) { - $data['PickupOptions'] = $this->normalizer->normalize($object->getPickupOptions(), 'json', $context); - } - if ($object->isInitialized('deliveryOptions') && null !== $object->getDeliveryOptions()) { - $data['DeliveryOptions'] = $this->normalizer->normalize($object->getDeliveryOptions(), 'json', $context); + if (\array_key_exists('EMailInformation', $data)) { + $values = []; + foreach ($data['EMailInformation'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class, 'json', $context); } - if ($object->isInitialized('overSeasLeg') && null !== $object->getOverSeasLeg()) { - $data['OverSeasLeg'] = $this->normalizer->normalize($object->getOverSeasLeg(), 'json', $context); - } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('dangerousGoods') && null !== $object->getDangerousGoods()) { - $data['DangerousGoods'] = $this->normalizer->normalize($object->getDangerousGoods(), 'json', $context); - } - if ($object->isInitialized('sortingAndSegregating') && null !== $object->getSortingAndSegregating()) { - $data['SortingAndSegregating'] = $this->normalizer->normalize($object->getSortingAndSegregating(), 'json', $context); - } - if ($object->isInitialized('declaredValue') && null !== $object->getDeclaredValue()) { - $data['DeclaredValue'] = $this->normalizer->normalize($object->getDeclaredValue(), 'json', $context); - } - if ($object->isInitialized('excessDeclaredValue') && null !== $object->getExcessDeclaredValue()) { - $data['ExcessDeclaredValue'] = $this->normalizer->normalize($object->getExcessDeclaredValue(), 'json', $context); - } - if ($object->isInitialized('handlingCharge') && null !== $object->getHandlingCharge()) { - $data['HandlingCharge'] = $this->normalizer->normalize($object->getHandlingCharge(), 'json', $context); - } - if ($object->isInitialized('freezableProtectionIndicator') && null !== $object->getFreezableProtectionIndicator()) { - $data['FreezableProtectionIndicator'] = $object->getFreezableProtectionIndicator(); - } - if ($object->isInitialized('extremeLengthIndicator') && null !== $object->getExtremeLengthIndicator()) { - $data['ExtremeLengthIndicator'] = $object->getExtremeLengthIndicator(); - } - if ($object->isInitialized('linearFeet') && null !== $object->getLinearFeet()) { - $data['LinearFeet'] = $object->getLinearFeet(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setEMailInformation($values); + unset($data['EMailInformation']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class => false]; + if (\array_key_exists('PickupOptions', $data)) { + $object->setPickupOptions($this->denormalizer->denormalize($data['PickupOptions'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class, 'json', $context)); + unset($data['PickupOptions']); } - } -} else { - class FreightShipShipmentShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class; + if (\array_key_exists('DeliveryOptions', $data)) { + $object->setDeliveryOptions($this->denormalizer->denormalize($data['DeliveryOptions'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class, 'json', $context)); + unset($data['DeliveryOptions']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class; + if (\array_key_exists('OverSeasLeg', $data)) { + $object->setOverSeasLeg($this->denormalizer->denormalize($data['OverSeasLeg'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class, 'json', $context)); + unset($data['OverSeasLeg']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailInformation', $data)) { - $values = []; - foreach ($data['EMailInformation'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class, 'json', $context); - } - $object->setEMailInformation($values); - unset($data['EMailInformation']); - } - if (\array_key_exists('PickupOptions', $data)) { - $object->setPickupOptions($this->denormalizer->denormalize($data['PickupOptions'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class, 'json', $context)); - unset($data['PickupOptions']); - } - if (\array_key_exists('DeliveryOptions', $data)) { - $object->setDeliveryOptions($this->denormalizer->denormalize($data['DeliveryOptions'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class, 'json', $context)); - unset($data['DeliveryOptions']); - } - if (\array_key_exists('OverSeasLeg', $data)) { - $object->setOverSeasLeg($this->denormalizer->denormalize($data['OverSeasLeg'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class, 'json', $context)); - unset($data['OverSeasLeg']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('DangerousGoods', $data)) { - $object->setDangerousGoods($this->denormalizer->denormalize($data['DangerousGoods'], \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class, 'json', $context)); - unset($data['DangerousGoods']); - } - if (\array_key_exists('SortingAndSegregating', $data)) { - $object->setSortingAndSegregating($this->denormalizer->denormalize($data['SortingAndSegregating'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class, 'json', $context)); - unset($data['SortingAndSegregating']); - } - if (\array_key_exists('DeclaredValue', $data)) { - $object->setDeclaredValue($this->denormalizer->denormalize($data['DeclaredValue'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class, 'json', $context)); - unset($data['DeclaredValue']); - } - if (\array_key_exists('ExcessDeclaredValue', $data)) { - $object->setExcessDeclaredValue($this->denormalizer->denormalize($data['ExcessDeclaredValue'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class, 'json', $context)); - unset($data['ExcessDeclaredValue']); - } - if (\array_key_exists('HandlingCharge', $data)) { - $object->setHandlingCharge($this->denormalizer->denormalize($data['HandlingCharge'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class, 'json', $context)); - unset($data['HandlingCharge']); - } - if (\array_key_exists('FreezableProtectionIndicator', $data)) { - $object->setFreezableProtectionIndicator($data['FreezableProtectionIndicator']); - unset($data['FreezableProtectionIndicator']); - } - if (\array_key_exists('ExtremeLengthIndicator', $data)) { - $object->setExtremeLengthIndicator($data['ExtremeLengthIndicator']); - unset($data['ExtremeLengthIndicator']); - } - if (\array_key_exists('LinearFeet', $data)) { - $object->setLinearFeet($data['LinearFeet']); - unset($data['LinearFeet']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if (\array_key_exists('COD', $data)) { + $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class, 'json', $context)); + unset($data['COD']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('eMailInformation') && null !== $object->getEMailInformation()) { - $values = []; - foreach ($object->getEMailInformation() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['EMailInformation'] = $values; - } - if ($object->isInitialized('pickupOptions') && null !== $object->getPickupOptions()) { - $data['PickupOptions'] = $this->normalizer->normalize($object->getPickupOptions(), 'json', $context); - } - if ($object->isInitialized('deliveryOptions') && null !== $object->getDeliveryOptions()) { - $data['DeliveryOptions'] = $this->normalizer->normalize($object->getDeliveryOptions(), 'json', $context); - } - if ($object->isInitialized('overSeasLeg') && null !== $object->getOverSeasLeg()) { - $data['OverSeasLeg'] = $this->normalizer->normalize($object->getOverSeasLeg(), 'json', $context); - } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('dangerousGoods') && null !== $object->getDangerousGoods()) { - $data['DangerousGoods'] = $this->normalizer->normalize($object->getDangerousGoods(), 'json', $context); - } - if ($object->isInitialized('sortingAndSegregating') && null !== $object->getSortingAndSegregating()) { - $data['SortingAndSegregating'] = $this->normalizer->normalize($object->getSortingAndSegregating(), 'json', $context); - } - if ($object->isInitialized('declaredValue') && null !== $object->getDeclaredValue()) { - $data['DeclaredValue'] = $this->normalizer->normalize($object->getDeclaredValue(), 'json', $context); - } - if ($object->isInitialized('excessDeclaredValue') && null !== $object->getExcessDeclaredValue()) { - $data['ExcessDeclaredValue'] = $this->normalizer->normalize($object->getExcessDeclaredValue(), 'json', $context); - } - if ($object->isInitialized('handlingCharge') && null !== $object->getHandlingCharge()) { - $data['HandlingCharge'] = $this->normalizer->normalize($object->getHandlingCharge(), 'json', $context); - } - if ($object->isInitialized('freezableProtectionIndicator') && null !== $object->getFreezableProtectionIndicator()) { - $data['FreezableProtectionIndicator'] = $object->getFreezableProtectionIndicator(); - } - if ($object->isInitialized('extremeLengthIndicator') && null !== $object->getExtremeLengthIndicator()) { - $data['ExtremeLengthIndicator'] = $object->getExtremeLengthIndicator(); - } - if ($object->isInitialized('linearFeet') && null !== $object->getLinearFeet()) { - $data['LinearFeet'] = $object->getLinearFeet(); + if (\array_key_exists('DangerousGoods', $data)) { + $object->setDangerousGoods($this->denormalizer->denormalize($data['DangerousGoods'], \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class, 'json', $context)); + unset($data['DangerousGoods']); + } + if (\array_key_exists('SortingAndSegregating', $data)) { + $object->setSortingAndSegregating($this->denormalizer->denormalize($data['SortingAndSegregating'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class, 'json', $context)); + unset($data['SortingAndSegregating']); + } + if (\array_key_exists('DeclaredValue', $data)) { + $object->setDeclaredValue($this->denormalizer->denormalize($data['DeclaredValue'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class, 'json', $context)); + unset($data['DeclaredValue']); + } + if (\array_key_exists('ExcessDeclaredValue', $data)) { + $object->setExcessDeclaredValue($this->denormalizer->denormalize($data['ExcessDeclaredValue'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class, 'json', $context)); + unset($data['ExcessDeclaredValue']); + } + if (\array_key_exists('HandlingCharge', $data)) { + $object->setHandlingCharge($this->denormalizer->denormalize($data['HandlingCharge'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class, 'json', $context)); + unset($data['HandlingCharge']); + } + if (\array_key_exists('FreezableProtectionIndicator', $data)) { + $object->setFreezableProtectionIndicator($data['FreezableProtectionIndicator']); + unset($data['FreezableProtectionIndicator']); + } + if (\array_key_exists('ExtremeLengthIndicator', $data)) { + $object->setExtremeLengthIndicator($data['ExtremeLengthIndicator']); + unset($data['ExtremeLengthIndicator']); + } + if (\array_key_exists('LinearFeet', $data)) { + $object->setLinearFeet($data['LinearFeet']); + unset($data['LinearFeet']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('eMailInformation') && null !== $data->getEMailInformation()) { + $values = []; + foreach ($data->getEMailInformation() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $data; + $dataArray['EMailInformation'] = $values; + } + if ($data->isInitialized('pickupOptions') && null !== $data->getPickupOptions()) { + $dataArray['PickupOptions'] = $this->normalizer->normalize($data->getPickupOptions(), 'json', $context); + } + if ($data->isInitialized('deliveryOptions') && null !== $data->getDeliveryOptions()) { + $dataArray['DeliveryOptions'] = $this->normalizer->normalize($data->getDeliveryOptions(), 'json', $context); + } + if ($data->isInitialized('overSeasLeg') && null !== $data->getOverSeasLeg()) { + $dataArray['OverSeasLeg'] = $this->normalizer->normalize($data->getOverSeasLeg(), 'json', $context); + } + if ($data->isInitialized('cOD') && null !== $data->getCOD()) { + $dataArray['COD'] = $this->normalizer->normalize($data->getCOD(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class => false]; + if ($data->isInitialized('dangerousGoods') && null !== $data->getDangerousGoods()) { + $dataArray['DangerousGoods'] = $this->normalizer->normalize($data->getDangerousGoods(), 'json', $context); } + if ($data->isInitialized('sortingAndSegregating') && null !== $data->getSortingAndSegregating()) { + $dataArray['SortingAndSegregating'] = $this->normalizer->normalize($data->getSortingAndSegregating(), 'json', $context); + } + if ($data->isInitialized('declaredValue') && null !== $data->getDeclaredValue()) { + $dataArray['DeclaredValue'] = $this->normalizer->normalize($data->getDeclaredValue(), 'json', $context); + } + if ($data->isInitialized('excessDeclaredValue') && null !== $data->getExcessDeclaredValue()) { + $dataArray['ExcessDeclaredValue'] = $this->normalizer->normalize($data->getExcessDeclaredValue(), 'json', $context); + } + if ($data->isInitialized('handlingCharge') && null !== $data->getHandlingCharge()) { + $dataArray['HandlingCharge'] = $this->normalizer->normalize($data->getHandlingCharge(), 'json', $context); + } + if ($data->isInitialized('freezableProtectionIndicator') && null !== $data->getFreezableProtectionIndicator()) { + $dataArray['FreezableProtectionIndicator'] = $data->getFreezableProtectionIndicator(); + } + if ($data->isInitialized('extremeLengthIndicator') && null !== $data->getExtremeLengthIndicator()) { + $dataArray['ExtremeLengthIndicator'] = $data->getExtremeLengthIndicator(); + } + if ($data->isInitialized('linearFeet') && null !== $data->getLinearFeet()) { + $dataArray['LinearFeet'] = $data->getLinearFeet(); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipmentInformationFreightDensityInfoNormalizer.php b/src/Api/Normalizer/FreightShipmentInformationFreightDensityInfoNormalizer.php index 49cdff5e..a207119d 100644 --- a/src/Api/Normalizer/FreightShipmentInformationFreightDensityInfoNormalizer.php +++ b/src/Api/Normalizer/FreightShipmentInformationFreightDensityInfoNormalizer.php @@ -5,174 +5,86 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipmentInformationFreightDensityInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipmentInformationFreightDensityInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AdjustedHeightIndicator', $data)) { - $object->setAdjustedHeightIndicator($data['AdjustedHeightIndicator']); - unset($data['AdjustedHeightIndicator']); - } - if (\array_key_exists('AdjustedHeight', $data)) { - $object->setAdjustedHeight($this->denormalizer->denormalize($data['AdjustedHeight'], \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class, 'json', $context)); - unset($data['AdjustedHeight']); - } - if (\array_key_exists('HandlingUnits', $data)) { - $values = []; - foreach ($data['HandlingUnits'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class, 'json', $context); - } - $object->setHandlingUnits($values); - unset($data['HandlingUnits']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('adjustedHeightIndicator') && null !== $object->getAdjustedHeightIndicator()) { - $data['AdjustedHeightIndicator'] = $object->getAdjustedHeightIndicator(); - } - if ($object->isInitialized('adjustedHeight') && null !== $object->getAdjustedHeight()) { - $data['AdjustedHeight'] = $this->normalizer->normalize($object->getAdjustedHeight(), 'json', $context); - } - if ($object->isInitialized('handlingUnits') && null !== $object->getHandlingUnits()) { - $values = []; - foreach ($object->getHandlingUnits() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['HandlingUnits'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('AdjustedHeightIndicator', $data)) { + $object->setAdjustedHeightIndicator($data['AdjustedHeightIndicator']); + unset($data['AdjustedHeightIndicator']); + } + if (\array_key_exists('AdjustedHeight', $data)) { + $object->setAdjustedHeight($this->denormalizer->denormalize($data['AdjustedHeight'], \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class, 'json', $context)); + unset($data['AdjustedHeight']); + } + if (\array_key_exists('HandlingUnits', $data)) { + $values = []; + foreach ($data['HandlingUnits'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class, 'json', $context); } - return $data; + $object->setHandlingUnits($values); + unset($data['HandlingUnits']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class FreightShipmentInformationFreightDensityInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class; + $dataArray = []; + if ($data->isInitialized('adjustedHeightIndicator') && null !== $data->getAdjustedHeightIndicator()) { + $dataArray['AdjustedHeightIndicator'] = $data->getAdjustedHeightIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class; + if ($data->isInitialized('adjustedHeight') && null !== $data->getAdjustedHeight()) { + $dataArray['AdjustedHeight'] = $this->normalizer->normalize($data->getAdjustedHeight(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AdjustedHeightIndicator', $data)) { - $object->setAdjustedHeightIndicator($data['AdjustedHeightIndicator']); - unset($data['AdjustedHeightIndicator']); - } - if (\array_key_exists('AdjustedHeight', $data)) { - $object->setAdjustedHeight($this->denormalizer->denormalize($data['AdjustedHeight'], \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class, 'json', $context)); - unset($data['AdjustedHeight']); - } - if (\array_key_exists('HandlingUnits', $data)) { - $values = []; - foreach ($data['HandlingUnits'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class, 'json', $context); - } - $object->setHandlingUnits($values); - unset($data['HandlingUnits']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + if ($data->isInitialized('handlingUnits') && null !== $data->getHandlingUnits()) { + $values = []; + foreach ($data->getHandlingUnits() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['HandlingUnits'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('adjustedHeightIndicator') && null !== $object->getAdjustedHeightIndicator()) { - $data['AdjustedHeightIndicator'] = $object->getAdjustedHeightIndicator(); - } - if ($object->isInitialized('adjustedHeight') && null !== $object->getAdjustedHeight()) { - $data['AdjustedHeight'] = $this->normalizer->normalize($object->getAdjustedHeight(), 'json', $context); - } - if ($object->isInitialized('handlingUnits') && null !== $object->getHandlingUnits()) { - $values = []; - foreach ($object->getHandlingUnits() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['HandlingUnits'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipmentServiceOptionsCODNormalizer.php b/src/Api/Normalizer/FreightShipmentServiceOptionsCODNormalizer.php index fdc06536..c9d098b2 100644 --- a/src/Api/Normalizer/FreightShipmentServiceOptionsCODNormalizer.php +++ b/src/Api/Normalizer/FreightShipmentServiceOptionsCODNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipmentServiceOptionsCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipmentServiceOptionsCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class; + return $type === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CODValue', $data)) { - $object->setCODValue($this->denormalizer->denormalize($data['CODValue'], \ShipStream\Ups\Api\Model\CODCODValue::class, 'json', $context)); - unset($data['CODValue']); - } - if (\array_key_exists('CODPaymentMethod', $data)) { - $object->setCODPaymentMethod($this->denormalizer->denormalize($data['CODPaymentMethod'], \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class, 'json', $context)); - unset($data['CODPaymentMethod']); - } - if (\array_key_exists('CODBillingOption', $data)) { - $object->setCODBillingOption($this->denormalizer->denormalize($data['CODBillingOption'], \ShipStream\Ups\Api\Model\CODCODBillingOption::class, 'json', $context)); - unset($data['CODBillingOption']); - } - if (\array_key_exists('RemitTo', $data)) { - $object->setRemitTo($this->denormalizer->denormalize($data['RemitTo'], \ShipStream\Ups\Api\Model\CODRemitTo::class, 'json', $context)); - unset($data['RemitTo']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CODValue'] = $this->normalizer->normalize($object->getCODValue(), 'json', $context); - $data['CODPaymentMethod'] = $this->normalizer->normalize($object->getCODPaymentMethod(), 'json', $context); - $data['CODBillingOption'] = $this->normalizer->normalize($object->getCODBillingOption(), 'json', $context); - $data['RemitTo'] = $this->normalizer->normalize($object->getRemitTo(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CODValue', $data)) { + $object->setCODValue($this->denormalizer->denormalize($data['CODValue'], \ShipStream\Ups\Api\Model\CODCODValue::class, 'json', $context)); + unset($data['CODValue']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class => false]; + if (\array_key_exists('CODPaymentMethod', $data)) { + $object->setCODPaymentMethod($this->denormalizer->denormalize($data['CODPaymentMethod'], \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class, 'json', $context)); + unset($data['CODPaymentMethod']); } - } -} else { - class FreightShipmentServiceOptionsCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class; + if (\array_key_exists('CODBillingOption', $data)) { + $object->setCODBillingOption($this->denormalizer->denormalize($data['CODBillingOption'], \ShipStream\Ups\Api\Model\CODCODBillingOption::class, 'json', $context)); + unset($data['CODBillingOption']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class; + if (\array_key_exists('RemitTo', $data)) { + $object->setRemitTo($this->denormalizer->denormalize($data['RemitTo'], \ShipStream\Ups\Api\Model\CODRemitTo::class, 'json', $context)); + unset($data['RemitTo']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CODValue', $data)) { - $object->setCODValue($this->denormalizer->denormalize($data['CODValue'], \ShipStream\Ups\Api\Model\CODCODValue::class, 'json', $context)); - unset($data['CODValue']); - } - if (\array_key_exists('CODPaymentMethod', $data)) { - $object->setCODPaymentMethod($this->denormalizer->denormalize($data['CODPaymentMethod'], \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class, 'json', $context)); - unset($data['CODPaymentMethod']); - } - if (\array_key_exists('CODBillingOption', $data)) { - $object->setCODBillingOption($this->denormalizer->denormalize($data['CODBillingOption'], \ShipStream\Ups\Api\Model\CODCODBillingOption::class, 'json', $context)); - unset($data['CODBillingOption']); - } - if (\array_key_exists('RemitTo', $data)) { - $object->setRemitTo($this->denormalizer->denormalize($data['RemitTo'], \ShipStream\Ups\Api\Model\CODRemitTo::class, 'json', $context)); - unset($data['RemitTo']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CODValue'] = $this->normalizer->normalize($object->getCODValue(), 'json', $context); - $data['CODPaymentMethod'] = $this->normalizer->normalize($object->getCODPaymentMethod(), 'json', $context); - $data['CODBillingOption'] = $this->normalizer->normalize($object->getCODBillingOption(), 'json', $context); - $data['RemitTo'] = $this->normalizer->normalize($object->getRemitTo(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CODValue'] = $this->normalizer->normalize($data->getCODValue(), 'json', $context); + $dataArray['CODPaymentMethod'] = $this->normalizer->normalize($data->getCODPaymentMethod(), 'json', $context); + $dataArray['CODBillingOption'] = $this->normalizer->normalize($data->getCODBillingOption(), 'json', $context); + $dataArray['RemitTo'] = $this->normalizer->normalize($data->getRemitTo(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipmentServiceOptionsDeliveryOptionsNormalizer.php b/src/Api/Normalizer/FreightShipmentServiceOptionsDeliveryOptionsNormalizer.php index 657fa791..fafa7f2e 100644 --- a/src/Api/Normalizer/FreightShipmentServiceOptionsDeliveryOptionsNormalizer.php +++ b/src/Api/Normalizer/FreightShipmentServiceOptionsDeliveryOptionsNormalizer.php @@ -5,214 +5,106 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipmentServiceOptionsDeliveryOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipmentServiceOptionsDeliveryOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CallBeforeDeliveryIndicator', $data)) { - $object->setCallBeforeDeliveryIndicator($data['CallBeforeDeliveryIndicator']); - unset($data['CallBeforeDeliveryIndicator']); - } - if (\array_key_exists('HolidayDeliveryIndicator', $data)) { - $object->setHolidayDeliveryIndicator($data['HolidayDeliveryIndicator']); - unset($data['HolidayDeliveryIndicator']); - } - if (\array_key_exists('InsideDeliveryIndicator', $data)) { - $object->setInsideDeliveryIndicator($data['InsideDeliveryIndicator']); - unset($data['InsideDeliveryIndicator']); - } - if (\array_key_exists('ResidentialDeliveryIndicator', $data)) { - $object->setResidentialDeliveryIndicator($data['ResidentialDeliveryIndicator']); - unset($data['ResidentialDeliveryIndicator']); - } - if (\array_key_exists('WeekendDeliveryIndicator', $data)) { - $object->setWeekendDeliveryIndicator($data['WeekendDeliveryIndicator']); - unset($data['WeekendDeliveryIndicator']); - } - if (\array_key_exists('LiftGateRequiredIndicator', $data)) { - $object->setLiftGateRequiredIndicator($data['LiftGateRequiredIndicator']); - unset($data['LiftGateRequiredIndicator']); - } - if (\array_key_exists('LimitedAccessDeliveryIndicator', $data)) { - $object->setLimitedAccessDeliveryIndicator($data['LimitedAccessDeliveryIndicator']); - unset($data['LimitedAccessDeliveryIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('callBeforeDeliveryIndicator') && null !== $object->getCallBeforeDeliveryIndicator()) { - $data['CallBeforeDeliveryIndicator'] = $object->getCallBeforeDeliveryIndicator(); - } - if ($object->isInitialized('holidayDeliveryIndicator') && null !== $object->getHolidayDeliveryIndicator()) { - $data['HolidayDeliveryIndicator'] = $object->getHolidayDeliveryIndicator(); - } - if ($object->isInitialized('insideDeliveryIndicator') && null !== $object->getInsideDeliveryIndicator()) { - $data['InsideDeliveryIndicator'] = $object->getInsideDeliveryIndicator(); - } - if ($object->isInitialized('residentialDeliveryIndicator') && null !== $object->getResidentialDeliveryIndicator()) { - $data['ResidentialDeliveryIndicator'] = $object->getResidentialDeliveryIndicator(); - } - if ($object->isInitialized('weekendDeliveryIndicator') && null !== $object->getWeekendDeliveryIndicator()) { - $data['WeekendDeliveryIndicator'] = $object->getWeekendDeliveryIndicator(); - } - if ($object->isInitialized('liftGateRequiredIndicator') && null !== $object->getLiftGateRequiredIndicator()) { - $data['LiftGateRequiredIndicator'] = $object->getLiftGateRequiredIndicator(); - } - if ($object->isInitialized('limitedAccessDeliveryIndicator') && null !== $object->getLimitedAccessDeliveryIndicator()) { - $data['LimitedAccessDeliveryIndicator'] = $object->getLimitedAccessDeliveryIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CallBeforeDeliveryIndicator', $data)) { + $object->setCallBeforeDeliveryIndicator($data['CallBeforeDeliveryIndicator']); + unset($data['CallBeforeDeliveryIndicator']); + } + if (\array_key_exists('HolidayDeliveryIndicator', $data)) { + $object->setHolidayDeliveryIndicator($data['HolidayDeliveryIndicator']); + unset($data['HolidayDeliveryIndicator']); + } + if (\array_key_exists('InsideDeliveryIndicator', $data)) { + $object->setInsideDeliveryIndicator($data['InsideDeliveryIndicator']); + unset($data['InsideDeliveryIndicator']); + } + if (\array_key_exists('ResidentialDeliveryIndicator', $data)) { + $object->setResidentialDeliveryIndicator($data['ResidentialDeliveryIndicator']); + unset($data['ResidentialDeliveryIndicator']); + } + if (\array_key_exists('WeekendDeliveryIndicator', $data)) { + $object->setWeekendDeliveryIndicator($data['WeekendDeliveryIndicator']); + unset($data['WeekendDeliveryIndicator']); + } + if (\array_key_exists('LiftGateRequiredIndicator', $data)) { + $object->setLiftGateRequiredIndicator($data['LiftGateRequiredIndicator']); + unset($data['LiftGateRequiredIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class => false]; + if (\array_key_exists('LimitedAccessDeliveryIndicator', $data)) { + $object->setLimitedAccessDeliveryIndicator($data['LimitedAccessDeliveryIndicator']); + unset($data['LimitedAccessDeliveryIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightShipmentServiceOptionsDeliveryOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CallBeforeDeliveryIndicator', $data)) { - $object->setCallBeforeDeliveryIndicator($data['CallBeforeDeliveryIndicator']); - unset($data['CallBeforeDeliveryIndicator']); - } - if (\array_key_exists('HolidayDeliveryIndicator', $data)) { - $object->setHolidayDeliveryIndicator($data['HolidayDeliveryIndicator']); - unset($data['HolidayDeliveryIndicator']); - } - if (\array_key_exists('InsideDeliveryIndicator', $data)) { - $object->setInsideDeliveryIndicator($data['InsideDeliveryIndicator']); - unset($data['InsideDeliveryIndicator']); - } - if (\array_key_exists('ResidentialDeliveryIndicator', $data)) { - $object->setResidentialDeliveryIndicator($data['ResidentialDeliveryIndicator']); - unset($data['ResidentialDeliveryIndicator']); - } - if (\array_key_exists('WeekendDeliveryIndicator', $data)) { - $object->setWeekendDeliveryIndicator($data['WeekendDeliveryIndicator']); - unset($data['WeekendDeliveryIndicator']); - } - if (\array_key_exists('LiftGateRequiredIndicator', $data)) { - $object->setLiftGateRequiredIndicator($data['LiftGateRequiredIndicator']); - unset($data['LiftGateRequiredIndicator']); - } - if (\array_key_exists('LimitedAccessDeliveryIndicator', $data)) { - $object->setLimitedAccessDeliveryIndicator($data['LimitedAccessDeliveryIndicator']); - unset($data['LimitedAccessDeliveryIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('callBeforeDeliveryIndicator') && null !== $data->getCallBeforeDeliveryIndicator()) { + $dataArray['CallBeforeDeliveryIndicator'] = $data->getCallBeforeDeliveryIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('callBeforeDeliveryIndicator') && null !== $object->getCallBeforeDeliveryIndicator()) { - $data['CallBeforeDeliveryIndicator'] = $object->getCallBeforeDeliveryIndicator(); - } - if ($object->isInitialized('holidayDeliveryIndicator') && null !== $object->getHolidayDeliveryIndicator()) { - $data['HolidayDeliveryIndicator'] = $object->getHolidayDeliveryIndicator(); - } - if ($object->isInitialized('insideDeliveryIndicator') && null !== $object->getInsideDeliveryIndicator()) { - $data['InsideDeliveryIndicator'] = $object->getInsideDeliveryIndicator(); - } - if ($object->isInitialized('residentialDeliveryIndicator') && null !== $object->getResidentialDeliveryIndicator()) { - $data['ResidentialDeliveryIndicator'] = $object->getResidentialDeliveryIndicator(); - } - if ($object->isInitialized('weekendDeliveryIndicator') && null !== $object->getWeekendDeliveryIndicator()) { - $data['WeekendDeliveryIndicator'] = $object->getWeekendDeliveryIndicator(); - } - if ($object->isInitialized('liftGateRequiredIndicator') && null !== $object->getLiftGateRequiredIndicator()) { - $data['LiftGateRequiredIndicator'] = $object->getLiftGateRequiredIndicator(); - } - if ($object->isInitialized('limitedAccessDeliveryIndicator') && null !== $object->getLimitedAccessDeliveryIndicator()) { - $data['LimitedAccessDeliveryIndicator'] = $object->getLimitedAccessDeliveryIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('holidayDeliveryIndicator') && null !== $data->getHolidayDeliveryIndicator()) { + $dataArray['HolidayDeliveryIndicator'] = $data->getHolidayDeliveryIndicator(); + } + if ($data->isInitialized('insideDeliveryIndicator') && null !== $data->getInsideDeliveryIndicator()) { + $dataArray['InsideDeliveryIndicator'] = $data->getInsideDeliveryIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class => false]; + if ($data->isInitialized('residentialDeliveryIndicator') && null !== $data->getResidentialDeliveryIndicator()) { + $dataArray['ResidentialDeliveryIndicator'] = $data->getResidentialDeliveryIndicator(); } + if ($data->isInitialized('weekendDeliveryIndicator') && null !== $data->getWeekendDeliveryIndicator()) { + $dataArray['WeekendDeliveryIndicator'] = $data->getWeekendDeliveryIndicator(); + } + if ($data->isInitialized('liftGateRequiredIndicator') && null !== $data->getLiftGateRequiredIndicator()) { + $dataArray['LiftGateRequiredIndicator'] = $data->getLiftGateRequiredIndicator(); + } + if ($data->isInitialized('limitedAccessDeliveryIndicator') && null !== $data->getLimitedAccessDeliveryIndicator()) { + $dataArray['LimitedAccessDeliveryIndicator'] = $data->getLimitedAccessDeliveryIndicator(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightShipmentServiceOptionsPickupOptionsNormalizer.php b/src/Api/Normalizer/FreightShipmentServiceOptionsPickupOptionsNormalizer.php index 193eb279..9820fa5c 100644 --- a/src/Api/Normalizer/FreightShipmentServiceOptionsPickupOptionsNormalizer.php +++ b/src/Api/Normalizer/FreightShipmentServiceOptionsPickupOptionsNormalizer.php @@ -5,200 +5,99 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipmentServiceOptionsPickupOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightShipmentServiceOptionsPickupOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HolidayPickupIndicator', $data)) { - $object->setHolidayPickupIndicator($data['HolidayPickupIndicator']); - unset($data['HolidayPickupIndicator']); - } - if (\array_key_exists('InsidePickupIndicator', $data)) { - $object->setInsidePickupIndicator($data['InsidePickupIndicator']); - unset($data['InsidePickupIndicator']); - } - if (\array_key_exists('ResidentialPickupIndicator', $data)) { - $object->setResidentialPickupIndicator($data['ResidentialPickupIndicator']); - unset($data['ResidentialPickupIndicator']); - } - if (\array_key_exists('WeekendPickupIndicator', $data)) { - $object->setWeekendPickupIndicator($data['WeekendPickupIndicator']); - unset($data['WeekendPickupIndicator']); - } - if (\array_key_exists('LiftGateRequiredIndicator', $data)) { - $object->setLiftGateRequiredIndicator($data['LiftGateRequiredIndicator']); - unset($data['LiftGateRequiredIndicator']); - } - if (\array_key_exists('LimitedAccessPickupIndicator', $data)) { - $object->setLimitedAccessPickupIndicator($data['LimitedAccessPickupIndicator']); - unset($data['LimitedAccessPickupIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('holidayPickupIndicator') && null !== $object->getHolidayPickupIndicator()) { - $data['HolidayPickupIndicator'] = $object->getHolidayPickupIndicator(); - } - if ($object->isInitialized('insidePickupIndicator') && null !== $object->getInsidePickupIndicator()) { - $data['InsidePickupIndicator'] = $object->getInsidePickupIndicator(); - } - if ($object->isInitialized('residentialPickupIndicator') && null !== $object->getResidentialPickupIndicator()) { - $data['ResidentialPickupIndicator'] = $object->getResidentialPickupIndicator(); - } - if ($object->isInitialized('weekendPickupIndicator') && null !== $object->getWeekendPickupIndicator()) { - $data['WeekendPickupIndicator'] = $object->getWeekendPickupIndicator(); - } - if ($object->isInitialized('liftGateRequiredIndicator') && null !== $object->getLiftGateRequiredIndicator()) { - $data['LiftGateRequiredIndicator'] = $object->getLiftGateRequiredIndicator(); - } - if ($object->isInitialized('limitedAccessPickupIndicator') && null !== $object->getLimitedAccessPickupIndicator()) { - $data['LimitedAccessPickupIndicator'] = $object->getLimitedAccessPickupIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('HolidayPickupIndicator', $data)) { + $object->setHolidayPickupIndicator($data['HolidayPickupIndicator']); + unset($data['HolidayPickupIndicator']); + } + if (\array_key_exists('InsidePickupIndicator', $data)) { + $object->setInsidePickupIndicator($data['InsidePickupIndicator']); + unset($data['InsidePickupIndicator']); + } + if (\array_key_exists('ResidentialPickupIndicator', $data)) { + $object->setResidentialPickupIndicator($data['ResidentialPickupIndicator']); + unset($data['ResidentialPickupIndicator']); + } + if (\array_key_exists('WeekendPickupIndicator', $data)) { + $object->setWeekendPickupIndicator($data['WeekendPickupIndicator']); + unset($data['WeekendPickupIndicator']); + } + if (\array_key_exists('LiftGateRequiredIndicator', $data)) { + $object->setLiftGateRequiredIndicator($data['LiftGateRequiredIndicator']); + unset($data['LiftGateRequiredIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class => false]; + if (\array_key_exists('LimitedAccessPickupIndicator', $data)) { + $object->setLimitedAccessPickupIndicator($data['LimitedAccessPickupIndicator']); + unset($data['LimitedAccessPickupIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class FreightShipmentServiceOptionsPickupOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HolidayPickupIndicator', $data)) { - $object->setHolidayPickupIndicator($data['HolidayPickupIndicator']); - unset($data['HolidayPickupIndicator']); - } - if (\array_key_exists('InsidePickupIndicator', $data)) { - $object->setInsidePickupIndicator($data['InsidePickupIndicator']); - unset($data['InsidePickupIndicator']); - } - if (\array_key_exists('ResidentialPickupIndicator', $data)) { - $object->setResidentialPickupIndicator($data['ResidentialPickupIndicator']); - unset($data['ResidentialPickupIndicator']); - } - if (\array_key_exists('WeekendPickupIndicator', $data)) { - $object->setWeekendPickupIndicator($data['WeekendPickupIndicator']); - unset($data['WeekendPickupIndicator']); - } - if (\array_key_exists('LiftGateRequiredIndicator', $data)) { - $object->setLiftGateRequiredIndicator($data['LiftGateRequiredIndicator']); - unset($data['LiftGateRequiredIndicator']); - } - if (\array_key_exists('LimitedAccessPickupIndicator', $data)) { - $object->setLimitedAccessPickupIndicator($data['LimitedAccessPickupIndicator']); - unset($data['LimitedAccessPickupIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('holidayPickupIndicator') && null !== $data->getHolidayPickupIndicator()) { + $dataArray['HolidayPickupIndicator'] = $data->getHolidayPickupIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('holidayPickupIndicator') && null !== $object->getHolidayPickupIndicator()) { - $data['HolidayPickupIndicator'] = $object->getHolidayPickupIndicator(); - } - if ($object->isInitialized('insidePickupIndicator') && null !== $object->getInsidePickupIndicator()) { - $data['InsidePickupIndicator'] = $object->getInsidePickupIndicator(); - } - if ($object->isInitialized('residentialPickupIndicator') && null !== $object->getResidentialPickupIndicator()) { - $data['ResidentialPickupIndicator'] = $object->getResidentialPickupIndicator(); - } - if ($object->isInitialized('weekendPickupIndicator') && null !== $object->getWeekendPickupIndicator()) { - $data['WeekendPickupIndicator'] = $object->getWeekendPickupIndicator(); - } - if ($object->isInitialized('liftGateRequiredIndicator') && null !== $object->getLiftGateRequiredIndicator()) { - $data['LiftGateRequiredIndicator'] = $object->getLiftGateRequiredIndicator(); - } - if ($object->isInitialized('limitedAccessPickupIndicator') && null !== $object->getLimitedAccessPickupIndicator()) { - $data['LimitedAccessPickupIndicator'] = $object->getLimitedAccessPickupIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('insidePickupIndicator') && null !== $data->getInsidePickupIndicator()) { + $dataArray['InsidePickupIndicator'] = $data->getInsidePickupIndicator(); + } + if ($data->isInitialized('residentialPickupIndicator') && null !== $data->getResidentialPickupIndicator()) { + $dataArray['ResidentialPickupIndicator'] = $data->getResidentialPickupIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class => false]; + if ($data->isInitialized('weekendPickupIndicator') && null !== $data->getWeekendPickupIndicator()) { + $dataArray['WeekendPickupIndicator'] = $data->getWeekendPickupIndicator(); } + if ($data->isInitialized('liftGateRequiredIndicator') && null !== $data->getLiftGateRequiredIndicator()) { + $dataArray['LiftGateRequiredIndicator'] = $data->getLiftGateRequiredIndicator(); + } + if ($data->isInitialized('limitedAccessPickupIndicator') && null !== $data->getLimitedAccessPickupIndicator()) { + $dataArray['LimitedAccessPickupIndicator'] = $data->getLimitedAccessPickupIndicator(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/FreightWillCallSearchFacilityAddressNormalizer.php b/src/Api/Normalizer/FreightWillCallSearchFacilityAddressNormalizer.php index 3f355c8b..3b8c6b3e 100644 --- a/src/Api/Normalizer/FreightWillCallSearchFacilityAddressNormalizer.php +++ b/src/Api/Normalizer/FreightWillCallSearchFacilityAddressNormalizer.php @@ -5,226 +5,112 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightWillCallSearchFacilityAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class FreightWillCallSearchFacilityAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SLIC', $data)) { - $object->setSLIC($data['SLIC']); - unset($data['SLIC']); - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('PostalCodePrimaryLow', $data)) { - $object->setPostalCodePrimaryLow($data['PostalCodePrimaryLow']); - unset($data['PostalCodePrimaryLow']); - } - if (\array_key_exists('PostalCodeExtendedLow', $data)) { - $object->setPostalCodeExtendedLow($data['PostalCodeExtendedLow']); - unset($data['PostalCodeExtendedLow']); - } - if (\array_key_exists('State', $data)) { - $object->setState($data['State']); - unset($data['State']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('sLIC') && null !== $object->getSLIC()) { - $data['SLIC'] = $object->getSLIC(); - } - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('postalCodePrimaryLow') && null !== $object->getPostalCodePrimaryLow()) { - $data['PostalCodePrimaryLow'] = $object->getPostalCodePrimaryLow(); - } - if ($object->isInitialized('postalCodeExtendedLow') && null !== $object->getPostalCodeExtendedLow()) { - $data['PostalCodeExtendedLow'] = $object->getPostalCodeExtendedLow(); - } - if ($object->isInitialized('state') && null !== $object->getState()) { - $data['State'] = $object->getState(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('SLIC', $data)) { + $object->setSLIC($data['SLIC']); + unset($data['SLIC']); + } + if (\array_key_exists('AddressLine', $data)) { + $values = []; + foreach ($data['AddressLine'] as $value) { + $values[] = $value; } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('PostalCodePrimaryLow', $data)) { + $object->setPostalCodePrimaryLow($data['PostalCodePrimaryLow']); + unset($data['PostalCodePrimaryLow']); + } + if (\array_key_exists('PostalCodeExtendedLow', $data)) { + $object->setPostalCodeExtendedLow($data['PostalCodeExtendedLow']); + unset($data['PostalCodeExtendedLow']); + } + if (\array_key_exists('State', $data)) { + $object->setState($data['State']); + unset($data['State']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class => false]; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class FreightWillCallSearchFacilityAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SLIC', $data)) { - $object->setSLIC($data['SLIC']); - unset($data['SLIC']); - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('PostalCodePrimaryLow', $data)) { - $object->setPostalCodePrimaryLow($data['PostalCodePrimaryLow']); - unset($data['PostalCodePrimaryLow']); - } - if (\array_key_exists('PostalCodeExtendedLow', $data)) { - $object->setPostalCodeExtendedLow($data['PostalCodeExtendedLow']); - unset($data['PostalCodeExtendedLow']); - } - if (\array_key_exists('State', $data)) { - $object->setState($data['State']); - unset($data['State']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('sLIC') && null !== $data->getSLIC()) { + $dataArray['SLIC'] = $data->getSLIC(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('sLIC') && null !== $object->getSLIC()) { - $data['SLIC'] = $object->getSLIC(); + if ($data->isInitialized('addressLine') && null !== $data->getAddressLine()) { + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('postalCodePrimaryLow') && null !== $object->getPostalCodePrimaryLow()) { - $data['PostalCodePrimaryLow'] = $object->getPostalCodePrimaryLow(); - } - if ($object->isInitialized('postalCodeExtendedLow') && null !== $object->getPostalCodeExtendedLow()) { - $data['PostalCodeExtendedLow'] = $object->getPostalCodeExtendedLow(); - } - if ($object->isInitialized('state') && null !== $object->getState()) { - $data['State'] = $object->getState(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $dataArray['AddressLine'] = $values; + } + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class => false]; + if ($data->isInitialized('postalCodePrimaryLow') && null !== $data->getPostalCodePrimaryLow()) { + $dataArray['PostalCodePrimaryLow'] = $data->getPostalCodePrimaryLow(); } + if ($data->isInitialized('postalCodeExtendedLow') && null !== $data->getPostalCodeExtendedLow()) { + $dataArray['PostalCodeExtendedLow'] = $data->getPostalCodeExtendedLow(); + } + if ($data->isInitialized('state') && null !== $data->getState()) { + $dataArray['State'] = $data->getState(); + } + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/GFPOptionsOnCallInformationNormalizer.php b/src/Api/Normalizer/GFPOptionsOnCallInformationNormalizer.php index a890852f..99fc386e 100644 --- a/src/Api/Normalizer/GFPOptionsOnCallInformationNormalizer.php +++ b/src/Api/Normalizer/GFPOptionsOnCallInformationNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class GFPOptionsOnCallInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class GFPOptionsOnCallInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class; + return $type === \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('OnCallPickupIndicator', $data)) { - $object->setOnCallPickupIndicator($data['OnCallPickupIndicator']); - unset($data['OnCallPickupIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('onCallPickupIndicator') && null !== $object->getOnCallPickupIndicator()) { - $data['OnCallPickupIndicator'] = $object->getOnCallPickupIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('OnCallPickupIndicator', $data)) { + $object->setOnCallPickupIndicator($data['OnCallPickupIndicator']); + unset($data['OnCallPickupIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class GFPOptionsOnCallInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class; + $dataArray = []; + if ($data->isInitialized('onCallPickupIndicator') && null !== $data->getOnCallPickupIndicator()) { + $dataArray['OnCallPickupIndicator'] = $data->getOnCallPickupIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('OnCallPickupIndicator', $data)) { - $object->setOnCallPickupIndicator($data['OnCallPickupIndicator']); - unset($data['OnCallPickupIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('onCallPickupIndicator') && null !== $object->getOnCallPickupIndicator()) { - $data['OnCallPickupIndicator'] = $object->getOnCallPickupIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/GenerateTokenSuccessResponseNormalizer.php b/src/Api/Normalizer/GenerateTokenSuccessResponseNormalizer.php index 38ea6fb5..b30923a2 100644 --- a/src/Api/Normalizer/GenerateTokenSuccessResponseNormalizer.php +++ b/src/Api/Normalizer/GenerateTokenSuccessResponseNormalizer.php @@ -5,308 +5,153 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class GenerateTokenSuccessResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class GenerateTokenSuccessResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('refresh_token_expires_in', $data) && $data['refresh_token_expires_in'] !== null) { - $object->setRefreshTokenExpiresIn($data['refresh_token_expires_in']); - unset($data['refresh_token_expires_in']); - } - elseif (\array_key_exists('refresh_token_expires_in', $data) && $data['refresh_token_expires_in'] === null) { - $object->setRefreshTokenExpiresIn(null); - } - if (\array_key_exists('refresh_token_status', $data) && $data['refresh_token_status'] !== null) { - $object->setRefreshTokenStatus($data['refresh_token_status']); - unset($data['refresh_token_status']); - } - elseif (\array_key_exists('refresh_token_status', $data) && $data['refresh_token_status'] === null) { - $object->setRefreshTokenStatus(null); - } - if (\array_key_exists('token_type', $data)) { - $object->setTokenType($data['token_type']); - unset($data['token_type']); - } - if (\array_key_exists('issued_at', $data)) { - $object->setIssuedAt($data['issued_at']); - unset($data['issued_at']); - } - if (\array_key_exists('client_id', $data)) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } - if (\array_key_exists('access_token', $data)) { - $object->setAccessToken($data['access_token']); - unset($data['access_token']); - } - if (\array_key_exists('refresh_token', $data) && $data['refresh_token'] !== null) { - $object->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - elseif (\array_key_exists('refresh_token', $data) && $data['refresh_token'] === null) { - $object->setRefreshToken(null); - } - if (\array_key_exists('scope', $data)) { - $object->setScope($data['scope']); - unset($data['scope']); - } - if (\array_key_exists('refresh_token_issued_at', $data) && $data['refresh_token_issued_at'] !== null) { - $object->setRefreshTokenIssuedAt($data['refresh_token_issued_at']); - unset($data['refresh_token_issued_at']); - } - elseif (\array_key_exists('refresh_token_issued_at', $data) && $data['refresh_token_issued_at'] === null) { - $object->setRefreshTokenIssuedAt(null); - } - if (\array_key_exists('expires_in', $data)) { - $object->setExpiresIn($data['expires_in']); - unset($data['expires_in']); - } - if (\array_key_exists('refresh_count', $data)) { - $object->setRefreshCount($data['refresh_count']); - unset($data['refresh_count']); - } - if (\array_key_exists('status', $data)) { - $object->setStatus($data['status']); - unset($data['status']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('refreshTokenExpiresIn') && null !== $object->getRefreshTokenExpiresIn()) { - $data['refresh_token_expires_in'] = $object->getRefreshTokenExpiresIn(); - } - if ($object->isInitialized('refreshTokenStatus') && null !== $object->getRefreshTokenStatus()) { - $data['refresh_token_status'] = $object->getRefreshTokenStatus(); - } - if ($object->isInitialized('tokenType') && null !== $object->getTokenType()) { - $data['token_type'] = $object->getTokenType(); - } - if ($object->isInitialized('issuedAt') && null !== $object->getIssuedAt()) { - $data['issued_at'] = $object->getIssuedAt(); - } - if ($object->isInitialized('clientId') && null !== $object->getClientId()) { - $data['client_id'] = $object->getClientId(); - } - if ($object->isInitialized('accessToken') && null !== $object->getAccessToken()) { - $data['access_token'] = $object->getAccessToken(); - } - if ($object->isInitialized('refreshToken') && null !== $object->getRefreshToken()) { - $data['refresh_token'] = $object->getRefreshToken(); - } - if ($object->isInitialized('scope') && null !== $object->getScope()) { - $data['scope'] = $object->getScope(); - } - if ($object->isInitialized('refreshTokenIssuedAt') && null !== $object->getRefreshTokenIssuedAt()) { - $data['refresh_token_issued_at'] = $object->getRefreshTokenIssuedAt(); - } - if ($object->isInitialized('expiresIn') && null !== $object->getExpiresIn()) { - $data['expires_in'] = $object->getExpiresIn(); - } - if ($object->isInitialized('refreshCount') && null !== $object->getRefreshCount()) { - $data['refresh_count'] = $object->getRefreshCount(); - } - if ($object->isInitialized('status') && null !== $object->getStatus()) { - $data['status'] = $object->getStatus(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('refresh_token_expires_in', $data) && $data['refresh_token_expires_in'] !== null) { + $object->setRefreshTokenExpiresIn($data['refresh_token_expires_in']); + unset($data['refresh_token_expires_in']); + } + elseif (\array_key_exists('refresh_token_expires_in', $data) && $data['refresh_token_expires_in'] === null) { + $object->setRefreshTokenExpiresIn(null); + } + if (\array_key_exists('refresh_token_status', $data) && $data['refresh_token_status'] !== null) { + $object->setRefreshTokenStatus($data['refresh_token_status']); + unset($data['refresh_token_status']); + } + elseif (\array_key_exists('refresh_token_status', $data) && $data['refresh_token_status'] === null) { + $object->setRefreshTokenStatus(null); + } + if (\array_key_exists('token_type', $data)) { + $object->setTokenType($data['token_type']); + unset($data['token_type']); + } + if (\array_key_exists('issued_at', $data)) { + $object->setIssuedAt($data['issued_at']); + unset($data['issued_at']); + } + if (\array_key_exists('client_id', $data)) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } + if (\array_key_exists('access_token', $data)) { + $object->setAccessToken($data['access_token']); + unset($data['access_token']); + } + if (\array_key_exists('refresh_token', $data) && $data['refresh_token'] !== null) { + $object->setRefreshToken($data['refresh_token']); + unset($data['refresh_token']); + } + elseif (\array_key_exists('refresh_token', $data) && $data['refresh_token'] === null) { + $object->setRefreshToken(null); + } + if (\array_key_exists('scope', $data)) { + $object->setScope($data['scope']); + unset($data['scope']); + } + if (\array_key_exists('refresh_token_issued_at', $data) && $data['refresh_token_issued_at'] !== null) { + $object->setRefreshTokenIssuedAt($data['refresh_token_issued_at']); + unset($data['refresh_token_issued_at']); + } + elseif (\array_key_exists('refresh_token_issued_at', $data) && $data['refresh_token_issued_at'] === null) { + $object->setRefreshTokenIssuedAt(null); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class => false]; + if (\array_key_exists('expires_in', $data)) { + $object->setExpiresIn($data['expires_in']); + unset($data['expires_in']); } + if (\array_key_exists('refresh_count', $data)) { + $object->setRefreshCount($data['refresh_count']); + unset($data['refresh_count']); + } + if (\array_key_exists('status', $data)) { + $object->setStatus($data['status']); + unset($data['status']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class GenerateTokenSuccessResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('refresh_token_expires_in', $data) && $data['refresh_token_expires_in'] !== null) { - $object->setRefreshTokenExpiresIn($data['refresh_token_expires_in']); - unset($data['refresh_token_expires_in']); - } - elseif (\array_key_exists('refresh_token_expires_in', $data) && $data['refresh_token_expires_in'] === null) { - $object->setRefreshTokenExpiresIn(null); - } - if (\array_key_exists('refresh_token_status', $data) && $data['refresh_token_status'] !== null) { - $object->setRefreshTokenStatus($data['refresh_token_status']); - unset($data['refresh_token_status']); - } - elseif (\array_key_exists('refresh_token_status', $data) && $data['refresh_token_status'] === null) { - $object->setRefreshTokenStatus(null); - } - if (\array_key_exists('token_type', $data)) { - $object->setTokenType($data['token_type']); - unset($data['token_type']); - } - if (\array_key_exists('issued_at', $data)) { - $object->setIssuedAt($data['issued_at']); - unset($data['issued_at']); - } - if (\array_key_exists('client_id', $data)) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } - if (\array_key_exists('access_token', $data)) { - $object->setAccessToken($data['access_token']); - unset($data['access_token']); - } - if (\array_key_exists('refresh_token', $data) && $data['refresh_token'] !== null) { - $object->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - elseif (\array_key_exists('refresh_token', $data) && $data['refresh_token'] === null) { - $object->setRefreshToken(null); - } - if (\array_key_exists('scope', $data)) { - $object->setScope($data['scope']); - unset($data['scope']); - } - if (\array_key_exists('refresh_token_issued_at', $data) && $data['refresh_token_issued_at'] !== null) { - $object->setRefreshTokenIssuedAt($data['refresh_token_issued_at']); - unset($data['refresh_token_issued_at']); - } - elseif (\array_key_exists('refresh_token_issued_at', $data) && $data['refresh_token_issued_at'] === null) { - $object->setRefreshTokenIssuedAt(null); - } - if (\array_key_exists('expires_in', $data)) { - $object->setExpiresIn($data['expires_in']); - unset($data['expires_in']); - } - if (\array_key_exists('refresh_count', $data)) { - $object->setRefreshCount($data['refresh_count']); - unset($data['refresh_count']); - } - if (\array_key_exists('status', $data)) { - $object->setStatus($data['status']); - unset($data['status']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('refreshTokenExpiresIn')) { + $dataArray['refresh_token_expires_in'] = $data->getRefreshTokenExpiresIn(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('refreshTokenExpiresIn') && null !== $object->getRefreshTokenExpiresIn()) { - $data['refresh_token_expires_in'] = $object->getRefreshTokenExpiresIn(); - } - if ($object->isInitialized('refreshTokenStatus') && null !== $object->getRefreshTokenStatus()) { - $data['refresh_token_status'] = $object->getRefreshTokenStatus(); - } - if ($object->isInitialized('tokenType') && null !== $object->getTokenType()) { - $data['token_type'] = $object->getTokenType(); - } - if ($object->isInitialized('issuedAt') && null !== $object->getIssuedAt()) { - $data['issued_at'] = $object->getIssuedAt(); - } - if ($object->isInitialized('clientId') && null !== $object->getClientId()) { - $data['client_id'] = $object->getClientId(); - } - if ($object->isInitialized('accessToken') && null !== $object->getAccessToken()) { - $data['access_token'] = $object->getAccessToken(); - } - if ($object->isInitialized('refreshToken') && null !== $object->getRefreshToken()) { - $data['refresh_token'] = $object->getRefreshToken(); - } - if ($object->isInitialized('scope') && null !== $object->getScope()) { - $data['scope'] = $object->getScope(); - } - if ($object->isInitialized('refreshTokenIssuedAt') && null !== $object->getRefreshTokenIssuedAt()) { - $data['refresh_token_issued_at'] = $object->getRefreshTokenIssuedAt(); - } - if ($object->isInitialized('expiresIn') && null !== $object->getExpiresIn()) { - $data['expires_in'] = $object->getExpiresIn(); - } - if ($object->isInitialized('refreshCount') && null !== $object->getRefreshCount()) { - $data['refresh_count'] = $object->getRefreshCount(); - } - if ($object->isInitialized('status') && null !== $object->getStatus()) { - $data['status'] = $object->getStatus(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('refreshTokenStatus')) { + $dataArray['refresh_token_status'] = $data->getRefreshTokenStatus(); + } + if ($data->isInitialized('tokenType') && null !== $data->getTokenType()) { + $dataArray['token_type'] = $data->getTokenType(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class => false]; + if ($data->isInitialized('issuedAt') && null !== $data->getIssuedAt()) { + $dataArray['issued_at'] = $data->getIssuedAt(); } + if ($data->isInitialized('clientId') && null !== $data->getClientId()) { + $dataArray['client_id'] = $data->getClientId(); + } + if ($data->isInitialized('accessToken') && null !== $data->getAccessToken()) { + $dataArray['access_token'] = $data->getAccessToken(); + } + if ($data->isInitialized('refreshToken')) { + $dataArray['refresh_token'] = $data->getRefreshToken(); + } + if ($data->isInitialized('scope') && null !== $data->getScope()) { + $dataArray['scope'] = $data->getScope(); + } + if ($data->isInitialized('refreshTokenIssuedAt')) { + $dataArray['refresh_token_issued_at'] = $data->getRefreshTokenIssuedAt(); + } + if ($data->isInitialized('expiresIn') && null !== $data->getExpiresIn()) { + $dataArray['expires_in'] = $data->getExpiresIn(); + } + if ($data->isInitialized('refreshCount') && null !== $data->getRefreshCount()) { + $dataArray['refresh_count'] = $data->getRefreshCount(); + } + if ($data->isInitialized('status') && null !== $data->getStatus()) { + $dataArray['status'] = $data->getStatus(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/GenericActivityNormalizer.php b/src/Api/Normalizer/GenericActivityNormalizer.php index 516b4a4e..e16cf4e4 100644 --- a/src/Api/Normalizer/GenericActivityNormalizer.php +++ b/src/Api/Normalizer/GenericActivityNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class GenericActivityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class GenericActivityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericActivity::class; + return $type === \ShipStream\Ups\Api\Model\GenericActivity::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericActivity::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericActivity::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericActivity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\GenericActivity(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('date') && null !== $object->getDate()) { - $data['Date'] = $object->getDate(); - } - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['Time'] = $object->getTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Date', $data)) { + $object->setDate($data['Date']); + unset($data['Date']); + } + if (\array_key_exists('Time', $data)) { + $object->setTime($data['Time']); + unset($data['Time']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericActivity::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class GenericActivityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericActivity::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericActivity::class; + $dataArray = []; + if ($data->isInitialized('date') && null !== $data->getDate()) { + $dataArray['Date'] = $data->getDate(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericActivity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('time') && null !== $data->getTime()) { + $dataArray['Time'] = $data->getTime(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('date') && null !== $object->getDate()) { - $data['Date'] = $object->getDate(); - } - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['Time'] = $object->getTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericActivity::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\GenericActivity::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/GenericBillToAccountNormalizer.php b/src/Api/Normalizer/GenericBillToAccountNormalizer.php index 9f121d41..2ef8f1eb 100644 --- a/src/Api/Normalizer/GenericBillToAccountNormalizer.php +++ b/src/Api/Normalizer/GenericBillToAccountNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class GenericBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class GenericBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericBillToAccount::class; + return $type === \ShipStream\Ups\Api\Model\GenericBillToAccount::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericBillToAccount::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericBillToAccount::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericBillToAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\GenericBillToAccount(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Option'] = $object->getOption(); - $data['Number'] = $object->getNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericBillToAccount::class => false]; - } - } -} else { - class GenericBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericBillToAccount::class; + if (\array_key_exists('Option', $data)) { + $object->setOption($data['Option']); + unset($data['Option']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericBillToAccount::class; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericBillToAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Option'] = $object->getOption(); - $data['Number'] = $object->getNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Option'] = $data->getOption(); + $dataArray['Number'] = $data->getNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericBillToAccount::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\GenericBillToAccount::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/GenericFailureNotificationNormalizer.php b/src/Api/Normalizer/GenericFailureNotificationNormalizer.php index 010b78f1..53ae171f 100644 --- a/src/Api/Normalizer/GenericFailureNotificationNormalizer.php +++ b/src/Api/Normalizer/GenericFailureNotificationNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class GenericFailureNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class GenericFailureNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericFailureNotification::class; + return $type === \ShipStream\Ups\Api\Model\GenericFailureNotification::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericFailureNotification::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericFailureNotification::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericFailureNotification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FailedEmailAddress', $data)) { - $object->setFailedEmailAddress($data['FailedEmailAddress']); - unset($data['FailedEmailAddress']); - } - if (\array_key_exists('FailureNotificationCode', $data)) { - $object->setFailureNotificationCode($this->denormalizer->denormalize($data['FailureNotificationCode'], \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class, 'json', $context)); - unset($data['FailureNotificationCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\GenericFailureNotification(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('failedEmailAddress') && null !== $object->getFailedEmailAddress()) { - $data['FailedEmailAddress'] = $object->getFailedEmailAddress(); - } - if ($object->isInitialized('failureNotificationCode') && null !== $object->getFailureNotificationCode()) { - $data['FailureNotificationCode'] = $this->normalizer->normalize($object->getFailureNotificationCode(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('FailedEmailAddress', $data)) { + $object->setFailedEmailAddress($data['FailedEmailAddress']); + unset($data['FailedEmailAddress']); + } + if (\array_key_exists('FailureNotificationCode', $data)) { + $object->setFailureNotificationCode($this->denormalizer->denormalize($data['FailureNotificationCode'], \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class, 'json', $context)); + unset($data['FailureNotificationCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericFailureNotification::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class GenericFailureNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericFailureNotification::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericFailureNotification::class; + $dataArray = []; + if ($data->isInitialized('failedEmailAddress') && null !== $data->getFailedEmailAddress()) { + $dataArray['FailedEmailAddress'] = $data->getFailedEmailAddress(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericFailureNotification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FailedEmailAddress', $data)) { - $object->setFailedEmailAddress($data['FailedEmailAddress']); - unset($data['FailedEmailAddress']); - } - if (\array_key_exists('FailureNotificationCode', $data)) { - $object->setFailureNotificationCode($this->denormalizer->denormalize($data['FailureNotificationCode'], \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class, 'json', $context)); - unset($data['FailureNotificationCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('failureNotificationCode') && null !== $data->getFailureNotificationCode()) { + $dataArray['FailureNotificationCode'] = $this->normalizer->normalize($data->getFailureNotificationCode(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('failedEmailAddress') && null !== $object->getFailedEmailAddress()) { - $data['FailedEmailAddress'] = $object->getFailedEmailAddress(); - } - if ($object->isInitialized('failureNotificationCode') && null !== $object->getFailureNotificationCode()) { - $data['FailureNotificationCode'] = $this->normalizer->normalize($object->getFailureNotificationCode(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericFailureNotification::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\GenericFailureNotification::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/GenericPackageReferenceNumberNormalizer.php b/src/Api/Normalizer/GenericPackageReferenceNumberNormalizer.php index c1004dae..13811c25 100644 --- a/src/Api/Normalizer/GenericPackageReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/GenericPackageReferenceNumberNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class GenericPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class GenericPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('BarCodeIndicator', $data)) { + $object->setBarCodeIndicator($data['BarCodeIndicator']); + unset($data['BarCodeIndicator']); + } + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class => false]; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class GenericPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class; + $dataArray = []; + if ($data->isInitialized('barCodeIndicator') && null !== $data->getBarCodeIndicator()) { + $dataArray['BarCodeIndicator'] = $data->getBarCodeIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/GenericServiceNormalizer.php b/src/Api/Normalizer/GenericServiceNormalizer.php index 327985c9..28c35074 100644 --- a/src/Api/Normalizer/GenericServiceNormalizer.php +++ b/src/Api/Normalizer/GenericServiceNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class GenericServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class GenericServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericService::class; + return $type === \ShipStream\Ups\Api\Model\GenericService::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericService::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericService::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\GenericService(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericService::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class GenericServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericService::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericService::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericService::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\GenericService::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/GenericShipToNormalizer.php b/src/Api/Normalizer/GenericShipToNormalizer.php index 734f00c9..cdf5a51f 100644 --- a/src/Api/Normalizer/GenericShipToNormalizer.php +++ b/src/Api/Normalizer/GenericShipToNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class GenericShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class GenericShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericShipTo::class; + return $type === \ShipStream\Ups\Api\Model\GenericShipTo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericShipTo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericShipTo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LocationID', $data)) { - $object->setLocationID($data['LocationID']); - unset($data['LocationID']); - } - if (\array_key_exists('ReceivingAddressName', $data)) { - $object->setReceivingAddressName($data['ReceivingAddressName']); - unset($data['ReceivingAddressName']); - } - if (\array_key_exists('Bookmark', $data)) { - $object->setBookmark($data['Bookmark']); - unset($data['Bookmark']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\GenericShipTo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('locationID') && null !== $object->getLocationID()) { - $data['LocationID'] = $object->getLocationID(); - } - if ($object->isInitialized('receivingAddressName') && null !== $object->getReceivingAddressName()) { - $data['ReceivingAddressName'] = $object->getReceivingAddressName(); - } - if ($object->isInitialized('bookmark') && null !== $object->getBookmark()) { - $data['Bookmark'] = $object->getBookmark(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('LocationID', $data)) { + $object->setLocationID($data['LocationID']); + unset($data['LocationID']); + } + if (\array_key_exists('ReceivingAddressName', $data)) { + $object->setReceivingAddressName($data['ReceivingAddressName']); + unset($data['ReceivingAddressName']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericShipTo::class => false]; + if (\array_key_exists('Bookmark', $data)) { + $object->setBookmark($data['Bookmark']); + unset($data['Bookmark']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class GenericShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericShipTo::class; + $dataArray = []; + if ($data->isInitialized('locationID') && null !== $data->getLocationID()) { + $dataArray['LocationID'] = $data->getLocationID(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericShipTo::class; + if ($data->isInitialized('receivingAddressName') && null !== $data->getReceivingAddressName()) { + $dataArray['ReceivingAddressName'] = $data->getReceivingAddressName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LocationID', $data)) { - $object->setLocationID($data['LocationID']); - unset($data['LocationID']); - } - if (\array_key_exists('ReceivingAddressName', $data)) { - $object->setReceivingAddressName($data['ReceivingAddressName']); - unset($data['ReceivingAddressName']); - } - if (\array_key_exists('Bookmark', $data)) { - $object->setBookmark($data['Bookmark']); - unset($data['Bookmark']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('bookmark') && null !== $data->getBookmark()) { + $dataArray['Bookmark'] = $data->getBookmark(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('locationID') && null !== $object->getLocationID()) { - $data['LocationID'] = $object->getLocationID(); - } - if ($object->isInitialized('receivingAddressName') && null !== $object->getReceivingAddressName()) { - $data['ReceivingAddressName'] = $object->getReceivingAddressName(); - } - if ($object->isInitialized('bookmark') && null !== $object->getBookmark()) { - $data['Bookmark'] = $object->getBookmark(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericShipTo::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\GenericShipTo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/GenericShipmentReferenceNumberNormalizer.php b/src/Api/Normalizer/GenericShipmentReferenceNumberNormalizer.php index 5ecce8a4..5eb92da2 100644 --- a/src/Api/Normalizer/GenericShipmentReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/GenericShipmentReferenceNumberNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class GenericShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class GenericShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('BarCodeIndicator', $data)) { + $object->setBarCodeIndicator($data['BarCodeIndicator']); + unset($data['BarCodeIndicator']); + } + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class => false]; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class GenericShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class; + $dataArray = []; + if ($data->isInitialized('barCodeIndicator') && null !== $data->getBarCodeIndicator()) { + $dataArray['BarCodeIndicator'] = $data->getBarCodeIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/GeocodeCandidateAddressKeyFormatNormalizer.php b/src/Api/Normalizer/GeocodeCandidateAddressKeyFormatNormalizer.php index 92417d84..4f122bfe 100644 --- a/src/Api/Normalizer/GeocodeCandidateAddressKeyFormatNormalizer.php +++ b/src/Api/Normalizer/GeocodeCandidateAddressKeyFormatNormalizer.php @@ -5,208 +5,103 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class GeocodeCandidateAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class GeocodeCandidateAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('PoliticalDivision3', $data)) { - $object->setPoliticalDivision3($data['PoliticalDivision3']); - unset($data['PoliticalDivision3']); - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - if (\array_key_exists('PostcodeExtendedLow', $data)) { - $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); - unset($data['PostcodeExtendedLow']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - $data['AddressLine'] = $object->getAddressLine(); - if ($object->isInitialized('politicalDivision3') && null !== $object->getPoliticalDivision3()) { - $data['PoliticalDivision3'] = $object->getPoliticalDivision3(); - } - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - if ($object->isInitialized('postcodeExtendedLow') && null !== $object->getPostcodeExtendedLow()) { - $data['PostcodeExtendedLow'] = $object->getPostcodeExtendedLow(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ConsigneeName', $data)) { + $object->setConsigneeName($data['ConsigneeName']); + unset($data['ConsigneeName']); + } + if (\array_key_exists('AddressLine', $data)) { + $object->setAddressLine($data['AddressLine']); + unset($data['AddressLine']); + } + if (\array_key_exists('PoliticalDivision3', $data)) { + $object->setPoliticalDivision3($data['PoliticalDivision3']); + unset($data['PoliticalDivision3']); + } + if (\array_key_exists('PoliticalDivision2', $data)) { + $object->setPoliticalDivision2($data['PoliticalDivision2']); + unset($data['PoliticalDivision2']); + } + if (\array_key_exists('PoliticalDivision1', $data)) { + $object->setPoliticalDivision1($data['PoliticalDivision1']); + unset($data['PoliticalDivision1']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class => false]; + if (\array_key_exists('PostcodePrimaryLow', $data)) { + $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); + unset($data['PostcodePrimaryLow']); } + if (\array_key_exists('PostcodeExtendedLow', $data)) { + $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); + unset($data['PostcodeExtendedLow']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class GeocodeCandidateAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('PoliticalDivision3', $data)) { - $object->setPoliticalDivision3($data['PoliticalDivision3']); - unset($data['PoliticalDivision3']); - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - if (\array_key_exists('PostcodeExtendedLow', $data)) { - $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); - unset($data['PostcodeExtendedLow']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('consigneeName') && null !== $data->getConsigneeName()) { + $dataArray['ConsigneeName'] = $data->getConsigneeName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - $data['AddressLine'] = $object->getAddressLine(); - if ($object->isInitialized('politicalDivision3') && null !== $object->getPoliticalDivision3()) { - $data['PoliticalDivision3'] = $object->getPoliticalDivision3(); - } - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - if ($object->isInitialized('postcodeExtendedLow') && null !== $object->getPostcodeExtendedLow()) { - $data['PostcodeExtendedLow'] = $object->getPostcodeExtendedLow(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + $dataArray['AddressLine'] = $data->getAddressLine(); + if ($data->isInitialized('politicalDivision3') && null !== $data->getPoliticalDivision3()) { + $dataArray['PoliticalDivision3'] = $data->getPoliticalDivision3(); + } + $dataArray['PoliticalDivision2'] = $data->getPoliticalDivision2(); + $dataArray['PoliticalDivision1'] = $data->getPoliticalDivision1(); + $dataArray['PostcodePrimaryLow'] = $data->getPostcodePrimaryLow(); + if ($data->isInitialized('postcodeExtendedLow') && null !== $data->getPostcodeExtendedLow()) { + $dataArray['PostcodeExtendedLow'] = $data->getPostcodeExtendedLow(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/GeocodeCandidateGeocodeNormalizer.php b/src/Api/Normalizer/GeocodeCandidateGeocodeNormalizer.php index af6c950e..dddb6d6a 100644 --- a/src/Api/Normalizer/GeocodeCandidateGeocodeNormalizer.php +++ b/src/Api/Normalizer/GeocodeCandidateGeocodeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class GeocodeCandidateGeocodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class GeocodeCandidateGeocodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class; + return $type === \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Latitude', $data)) { - $object->setLatitude($data['Latitude']); - unset($data['Latitude']); - } - if (\array_key_exists('Longitude', $data)) { - $object->setLongitude($data['Longitude']); - unset($data['Longitude']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Latitude'] = $object->getLatitude(); - $data['Longitude'] = $object->getLongitude(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class => false]; - } - } -} else { - class GeocodeCandidateGeocodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class; + if (\array_key_exists('Latitude', $data)) { + $object->setLatitude($data['Latitude']); + unset($data['Latitude']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class; + if (\array_key_exists('Longitude', $data)) { + $object->setLongitude($data['Longitude']); + unset($data['Longitude']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Latitude', $data)) { - $object->setLatitude($data['Latitude']); - unset($data['Latitude']); - } - if (\array_key_exists('Longitude', $data)) { - $object->setLongitude($data['Longitude']); - unset($data['Longitude']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Latitude'] = $object->getLatitude(); - $data['Longitude'] = $object->getLongitude(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Latitude'] = $data->getLatitude(); + $dataArray['Longitude'] = $data->getLongitude(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/HandlingChargeAmountNormalizer.php b/src/Api/Normalizer/HandlingChargeAmountNormalizer.php index 64e6ddb6..a8bbd3d0 100644 --- a/src/Api/Normalizer/HandlingChargeAmountNormalizer.php +++ b/src/Api/Normalizer/HandlingChargeAmountNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class HandlingChargeAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class HandlingChargeAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingChargeAmount::class; + return $type === \ShipStream\Ups\Api\Model\HandlingChargeAmount::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingChargeAmount::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingChargeAmount::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingChargeAmount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\HandlingChargeAmount(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingChargeAmount::class => false]; - } - } -} else { - class HandlingChargeAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingChargeAmount::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingChargeAmount::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingChargeAmount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingChargeAmount::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\HandlingChargeAmount::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/HandlingUnitCommodityNormalizer.php b/src/Api/Normalizer/HandlingUnitCommodityNormalizer.php index e9fd409f..4e245797 100644 --- a/src/Api/Normalizer/HandlingUnitCommodityNormalizer.php +++ b/src/Api/Normalizer/HandlingUnitCommodityNormalizer.php @@ -5,238 +5,118 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class HandlingUnitCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class HandlingUnitCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitCommodity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('NumberOfPieces', $data)) { - $object->setNumberOfPieces($data['NumberOfPieces']); - unset($data['NumberOfPieces']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\CommodityPackagingType::class, 'json', $context)); - unset($data['PackagingType']); - } - if (\array_key_exists('DangerousGoodsIndicator', $data)) { - $object->setDangerousGoodsIndicator($data['DangerousGoodsIndicator']); - unset($data['DangerousGoodsIndicator']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('NMFCCommodityCode', $data)) { - $object->setNMFCCommodityCode($data['NMFCCommodityCode']); - unset($data['NMFCCommodityCode']); - } - if (\array_key_exists('FreightClass', $data)) { - $object->setFreightClass($data['FreightClass']); - unset($data['FreightClass']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - if (\array_key_exists('CommodityValue', $data)) { - $object->setCommodityValue($data['CommodityValue']); - unset($data['CommodityValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\HandlingUnitCommodity(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('numberOfPieces') && null !== $object->getNumberOfPieces()) { - $data['NumberOfPieces'] = $object->getNumberOfPieces(); - } - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $this->normalizer->normalize($object->getPackagingType(), 'json', $context); - } - if ($object->isInitialized('dangerousGoodsIndicator') && null !== $object->getDangerousGoodsIndicator()) { - $data['DangerousGoodsIndicator'] = $object->getDangerousGoodsIndicator(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('nMFCCommodityCode') && null !== $object->getNMFCCommodityCode()) { - $data['NMFCCommodityCode'] = $object->getNMFCCommodityCode(); - } - $data['FreightClass'] = $object->getFreightClass(); - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['Weight'] = $object->getWeight(); - } - if ($object->isInitialized('commodityValue') && null !== $object->getCommodityValue()) { - $data['CommodityValue'] = $object->getCommodityValue(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('NumberOfPieces', $data)) { + $object->setNumberOfPieces($data['NumberOfPieces']); + unset($data['NumberOfPieces']); + } + if (\array_key_exists('PackagingType', $data)) { + $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\CommodityPackagingType::class, 'json', $context)); + unset($data['PackagingType']); + } + if (\array_key_exists('DangerousGoodsIndicator', $data)) { + $object->setDangerousGoodsIndicator($data['DangerousGoodsIndicator']); + unset($data['DangerousGoodsIndicator']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); + } + if (\array_key_exists('NMFCCommodityCode', $data)) { + $object->setNMFCCommodityCode($data['NMFCCommodityCode']); + unset($data['NMFCCommodityCode']); + } + if (\array_key_exists('FreightClass', $data)) { + $object->setFreightClass($data['FreightClass']); + unset($data['FreightClass']); + } + if (\array_key_exists('Dimensions', $data)) { + $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class, 'json', $context)); + unset($data['Dimensions']); + } + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitCommodity::class => false]; + if (\array_key_exists('CommodityValue', $data)) { + $object->setCommodityValue($data['CommodityValue']); + unset($data['CommodityValue']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class HandlingUnitCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitCommodity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('NumberOfPieces', $data)) { - $object->setNumberOfPieces($data['NumberOfPieces']); - unset($data['NumberOfPieces']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\CommodityPackagingType::class, 'json', $context)); - unset($data['PackagingType']); - } - if (\array_key_exists('DangerousGoodsIndicator', $data)) { - $object->setDangerousGoodsIndicator($data['DangerousGoodsIndicator']); - unset($data['DangerousGoodsIndicator']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('NMFCCommodityCode', $data)) { - $object->setNMFCCommodityCode($data['NMFCCommodityCode']); - unset($data['NMFCCommodityCode']); - } - if (\array_key_exists('FreightClass', $data)) { - $object->setFreightClass($data['FreightClass']); - unset($data['FreightClass']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - if (\array_key_exists('CommodityValue', $data)) { - $object->setCommodityValue($data['CommodityValue']); - unset($data['CommodityValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('numberOfPieces') && null !== $data->getNumberOfPieces()) { + $dataArray['NumberOfPieces'] = $data->getNumberOfPieces(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('numberOfPieces') && null !== $object->getNumberOfPieces()) { - $data['NumberOfPieces'] = $object->getNumberOfPieces(); - } - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $this->normalizer->normalize($object->getPackagingType(), 'json', $context); - } - if ($object->isInitialized('dangerousGoodsIndicator') && null !== $object->getDangerousGoodsIndicator()) { - $data['DangerousGoodsIndicator'] = $object->getDangerousGoodsIndicator(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('nMFCCommodityCode') && null !== $object->getNMFCCommodityCode()) { - $data['NMFCCommodityCode'] = $object->getNMFCCommodityCode(); - } - $data['FreightClass'] = $object->getFreightClass(); - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['Weight'] = $object->getWeight(); - } - if ($object->isInitialized('commodityValue') && null !== $object->getCommodityValue()) { - $data['CommodityValue'] = $object->getCommodityValue(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('packagingType') && null !== $data->getPackagingType()) { + $dataArray['PackagingType'] = $this->normalizer->normalize($data->getPackagingType(), 'json', $context); + } + if ($data->isInitialized('dangerousGoodsIndicator') && null !== $data->getDangerousGoodsIndicator()) { + $dataArray['DangerousGoodsIndicator'] = $data->getDangerousGoodsIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitCommodity::class => false]; + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } + if ($data->isInitialized('nMFCCommodityCode') && null !== $data->getNMFCCommodityCode()) { + $dataArray['NMFCCommodityCode'] = $data->getNMFCCommodityCode(); + } + $dataArray['FreightClass'] = $data->getFreightClass(); + if ($data->isInitialized('dimensions') && null !== $data->getDimensions()) { + $dataArray['Dimensions'] = $this->normalizer->normalize($data->getDimensions(), 'json', $context); + } + if ($data->isInitialized('weight') && null !== $data->getWeight()) { + $dataArray['Weight'] = $data->getWeight(); + } + if ($data->isInitialized('commodityValue') && null !== $data->getCommodityValue()) { + $dataArray['CommodityValue'] = $data->getCommodityValue(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\HandlingUnitCommodity::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/HandlingUnitOneTypeNormalizer.php b/src/Api/Normalizer/HandlingUnitOneTypeNormalizer.php index b172dde2..dc1294a9 100644 --- a/src/Api/Normalizer/HandlingUnitOneTypeNormalizer.php +++ b/src/Api/Normalizer/HandlingUnitOneTypeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class HandlingUnitOneTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class HandlingUnitOneTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitOneType::class; + return $type === \ShipStream\Ups\Api\Model\HandlingUnitOneType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitOneType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitOneType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitOneType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\HandlingUnitOneType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitOneType::class => false]; - } - } -} else { - class HandlingUnitOneTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitOneType::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitOneType::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitOneType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitOneType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\HandlingUnitOneType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/HandlingUnitTwoTypeNormalizer.php b/src/Api/Normalizer/HandlingUnitTwoTypeNormalizer.php index 32c45aaa..1b43f6c3 100644 --- a/src/Api/Normalizer/HandlingUnitTwoTypeNormalizer.php +++ b/src/Api/Normalizer/HandlingUnitTwoTypeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class HandlingUnitTwoTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class HandlingUnitTwoTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class; + return $type === \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitTwoType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\HandlingUnitTwoType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitTwoType::class => false]; - } - } -} else { - class HandlingUnitTwoTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitTwoType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitTwoType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\HandlingUnitTwoType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/HandlingUnitUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/HandlingUnitUnitOfMeasurementNormalizer.php index e396c1b4..e32d62f4 100644 --- a/src/Api/Normalizer/HandlingUnitUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/HandlingUnitUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class HandlingUnitUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class HandlingUnitUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class HandlingUnitUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/HandlingUnitWeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/HandlingUnitWeightUnitOfMeasurementNormalizer.php index 1f2ebce8..af755b0f 100644 --- a/src/Api/Normalizer/HandlingUnitWeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/HandlingUnitWeightUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class HandlingUnitWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class HandlingUnitWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class HandlingUnitWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/HandlingUnitsAdjustedHeightNormalizer.php b/src/Api/Normalizer/HandlingUnitsAdjustedHeightNormalizer.php index 53d8719f..81c55457 100644 --- a/src/Api/Normalizer/HandlingUnitsAdjustedHeightNormalizer.php +++ b/src/Api/Normalizer/HandlingUnitsAdjustedHeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class HandlingUnitsAdjustedHeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class HandlingUnitsAdjustedHeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class; + return $type === \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class => false]; - } - } -} else { - class HandlingUnitsAdjustedHeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Value'] = $data->getValue(); + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/HandlingUnitsDimensionsNormalizer.php b/src/Api/Normalizer/HandlingUnitsDimensionsNormalizer.php index e78e8f4f..347a1119 100644 --- a/src/Api/Normalizer/HandlingUnitsDimensionsNormalizer.php +++ b/src/Api/Normalizer/HandlingUnitsDimensionsNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class HandlingUnitsDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class HandlingUnitsDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class; + return $type === \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitsDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\HandlingUnitsDimensions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['Height'] = $object->getHeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class => false]; + if (\array_key_exists('Length', $data)) { + $object->setLength($data['Length']); + unset($data['Length']); } - } -} else { - class HandlingUnitsDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class; + if (\array_key_exists('Width', $data)) { + $object->setWidth($data['Width']); + unset($data['Width']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class; + if (\array_key_exists('Height', $data)) { + $object->setHeight($data['Height']); + unset($data['Height']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitsDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['Height'] = $object->getHeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Length'] = $data->getLength(); + $dataArray['Width'] = $data->getWidth(); + $dataArray['Height'] = $data->getHeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/HandlingUnitsTypeNormalizer.php b/src/Api/Normalizer/HandlingUnitsTypeNormalizer.php index 1b7fccf7..40153a4c 100644 --- a/src/Api/Normalizer/HandlingUnitsTypeNormalizer.php +++ b/src/Api/Normalizer/HandlingUnitsTypeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class HandlingUnitsTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class HandlingUnitsTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitsType::class; + return $type === \ShipStream\Ups\Api\Model\HandlingUnitsType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitsType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitsType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitsType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\HandlingUnitsType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitsType::class => false]; - } - } -} else { - class HandlingUnitsTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitsType::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitsType::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitsType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitsType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\HandlingUnitsType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/HandlingUnitsUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/HandlingUnitsUnitOfMeasurementNormalizer.php index 683adb70..877ceba2 100644 --- a/src/Api/Normalizer/HandlingUnitsUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/HandlingUnitsUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class HandlingUnitsUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class HandlingUnitsUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class HandlingUnitsUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/HazMatHazMatChemicalRecordNormalizer.php b/src/Api/Normalizer/HazMatHazMatChemicalRecordNormalizer.php index 3a9a07d8..71450934 100644 --- a/src/Api/Normalizer/HazMatHazMatChemicalRecordNormalizer.php +++ b/src/Api/Normalizer/HazMatHazMatChemicalRecordNormalizer.php @@ -5,416 +5,207 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class HazMatHazMatChemicalRecordNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class HazMatHazMatChemicalRecordNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ChemicalRecordIdentifier', $data)) { - $object->setChemicalRecordIdentifier($data['ChemicalRecordIdentifier']); - unset($data['ChemicalRecordIdentifier']); - } - if (\array_key_exists('ClassDivisionNumber', $data)) { - $object->setClassDivisionNumber($data['ClassDivisionNumber']); - unset($data['ClassDivisionNumber']); - } - if (\array_key_exists('IDNumber', $data)) { - $object->setIDNumber($data['IDNumber']); - unset($data['IDNumber']); - } - if (\array_key_exists('TransportationMode', $data)) { - $object->setTransportationMode($data['TransportationMode']); - unset($data['TransportationMode']); - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('EmergencyPhone', $data)) { - $object->setEmergencyPhone($data['EmergencyPhone']); - unset($data['EmergencyPhone']); - } - if (\array_key_exists('EmergencyContact', $data)) { - $object->setEmergencyContact($data['EmergencyContact']); - unset($data['EmergencyContact']); - } - if (\array_key_exists('ReportableQuantity', $data)) { - $object->setReportableQuantity($data['ReportableQuantity']); - unset($data['ReportableQuantity']); - } - if (\array_key_exists('SubRiskClass', $data)) { - $object->setSubRiskClass($data['SubRiskClass']); - unset($data['SubRiskClass']); - } - if (\array_key_exists('PackagingGroupType', $data)) { - $object->setPackagingGroupType($data['PackagingGroupType']); - unset($data['PackagingGroupType']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('UOM', $data)) { - $object->setUOM($data['UOM']); - unset($data['UOM']); - } - if (\array_key_exists('PackagingInstructionCode', $data)) { - $object->setPackagingInstructionCode($data['PackagingInstructionCode']); - unset($data['PackagingInstructionCode']); - } - if (\array_key_exists('ProperShippingName', $data)) { - $object->setProperShippingName($data['ProperShippingName']); - unset($data['ProperShippingName']); - } - if (\array_key_exists('TechnicalName', $data)) { - $object->setTechnicalName($data['TechnicalName']); - unset($data['TechnicalName']); - } - if (\array_key_exists('AdditionalDescription', $data)) { - $object->setAdditionalDescription($data['AdditionalDescription']); - unset($data['AdditionalDescription']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($data['PackagingType']); - unset($data['PackagingType']); - } - if (\array_key_exists('HazardLabelRequired', $data)) { - $object->setHazardLabelRequired($data['HazardLabelRequired']); - unset($data['HazardLabelRequired']); - } - if (\array_key_exists('PackagingTypeQuantity', $data)) { - $object->setPackagingTypeQuantity($data['PackagingTypeQuantity']); - unset($data['PackagingTypeQuantity']); - } - if (\array_key_exists('CommodityRegulatedLevelCode', $data)) { - $object->setCommodityRegulatedLevelCode($data['CommodityRegulatedLevelCode']); - unset($data['CommodityRegulatedLevelCode']); - } - if (\array_key_exists('TransportCategory', $data)) { - $object->setTransportCategory($data['TransportCategory']); - unset($data['TransportCategory']); - } - if (\array_key_exists('TunnelRestrictionCode', $data)) { - $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); - unset($data['TunnelRestrictionCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('chemicalRecordIdentifier') && null !== $object->getChemicalRecordIdentifier()) { - $data['ChemicalRecordIdentifier'] = $object->getChemicalRecordIdentifier(); - } - if ($object->isInitialized('classDivisionNumber') && null !== $object->getClassDivisionNumber()) { - $data['ClassDivisionNumber'] = $object->getClassDivisionNumber(); - } - if ($object->isInitialized('iDNumber') && null !== $object->getIDNumber()) { - $data['IDNumber'] = $object->getIDNumber(); - } - $data['TransportationMode'] = $object->getTransportationMode(); - $data['RegulationSet'] = $object->getRegulationSet(); - if ($object->isInitialized('emergencyPhone') && null !== $object->getEmergencyPhone()) { - $data['EmergencyPhone'] = $object->getEmergencyPhone(); - } - if ($object->isInitialized('emergencyContact') && null !== $object->getEmergencyContact()) { - $data['EmergencyContact'] = $object->getEmergencyContact(); - } - if ($object->isInitialized('reportableQuantity') && null !== $object->getReportableQuantity()) { - $data['ReportableQuantity'] = $object->getReportableQuantity(); - } - if ($object->isInitialized('subRiskClass') && null !== $object->getSubRiskClass()) { - $data['SubRiskClass'] = $object->getSubRiskClass(); - } - if ($object->isInitialized('packagingGroupType') && null !== $object->getPackagingGroupType()) { - $data['PackagingGroupType'] = $object->getPackagingGroupType(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['Quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('uOM') && null !== $object->getUOM()) { - $data['UOM'] = $object->getUOM(); - } - if ($object->isInitialized('packagingInstructionCode') && null !== $object->getPackagingInstructionCode()) { - $data['PackagingInstructionCode'] = $object->getPackagingInstructionCode(); - } - if ($object->isInitialized('properShippingName') && null !== $object->getProperShippingName()) { - $data['ProperShippingName'] = $object->getProperShippingName(); - } - if ($object->isInitialized('technicalName') && null !== $object->getTechnicalName()) { - $data['TechnicalName'] = $object->getTechnicalName(); - } - if ($object->isInitialized('additionalDescription') && null !== $object->getAdditionalDescription()) { - $data['AdditionalDescription'] = $object->getAdditionalDescription(); - } - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $object->getPackagingType(); - } - if ($object->isInitialized('hazardLabelRequired') && null !== $object->getHazardLabelRequired()) { - $data['HazardLabelRequired'] = $object->getHazardLabelRequired(); - } - if ($object->isInitialized('packagingTypeQuantity') && null !== $object->getPackagingTypeQuantity()) { - $data['PackagingTypeQuantity'] = $object->getPackagingTypeQuantity(); - } - if ($object->isInitialized('commodityRegulatedLevelCode') && null !== $object->getCommodityRegulatedLevelCode()) { - $data['CommodityRegulatedLevelCode'] = $object->getCommodityRegulatedLevelCode(); - } - if ($object->isInitialized('transportCategory') && null !== $object->getTransportCategory()) { - $data['TransportCategory'] = $object->getTransportCategory(); - } - if ($object->isInitialized('tunnelRestrictionCode') && null !== $object->getTunnelRestrictionCode()) { - $data['TunnelRestrictionCode'] = $object->getTunnelRestrictionCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ChemicalRecordIdentifier', $data)) { + $object->setChemicalRecordIdentifier($data['ChemicalRecordIdentifier']); + unset($data['ChemicalRecordIdentifier']); + } + if (\array_key_exists('ClassDivisionNumber', $data)) { + $object->setClassDivisionNumber($data['ClassDivisionNumber']); + unset($data['ClassDivisionNumber']); + } + if (\array_key_exists('IDNumber', $data)) { + $object->setIDNumber($data['IDNumber']); + unset($data['IDNumber']); + } + if (\array_key_exists('TransportationMode', $data)) { + $object->setTransportationMode($data['TransportationMode']); + unset($data['TransportationMode']); + } + if (\array_key_exists('RegulationSet', $data)) { + $object->setRegulationSet($data['RegulationSet']); + unset($data['RegulationSet']); + } + if (\array_key_exists('EmergencyPhone', $data)) { + $object->setEmergencyPhone($data['EmergencyPhone']); + unset($data['EmergencyPhone']); + } + if (\array_key_exists('EmergencyContact', $data)) { + $object->setEmergencyContact($data['EmergencyContact']); + unset($data['EmergencyContact']); + } + if (\array_key_exists('ReportableQuantity', $data)) { + $object->setReportableQuantity($data['ReportableQuantity']); + unset($data['ReportableQuantity']); + } + if (\array_key_exists('SubRiskClass', $data)) { + $object->setSubRiskClass($data['SubRiskClass']); + unset($data['SubRiskClass']); + } + if (\array_key_exists('PackagingGroupType', $data)) { + $object->setPackagingGroupType($data['PackagingGroupType']); + unset($data['PackagingGroupType']); + } + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); + } + if (\array_key_exists('UOM', $data)) { + $object->setUOM($data['UOM']); + unset($data['UOM']); + } + if (\array_key_exists('PackagingInstructionCode', $data)) { + $object->setPackagingInstructionCode($data['PackagingInstructionCode']); + unset($data['PackagingInstructionCode']); + } + if (\array_key_exists('ProperShippingName', $data)) { + $object->setProperShippingName($data['ProperShippingName']); + unset($data['ProperShippingName']); + } + if (\array_key_exists('TechnicalName', $data)) { + $object->setTechnicalName($data['TechnicalName']); + unset($data['TechnicalName']); + } + if (\array_key_exists('AdditionalDescription', $data)) { + $object->setAdditionalDescription($data['AdditionalDescription']); + unset($data['AdditionalDescription']); + } + if (\array_key_exists('PackagingType', $data)) { + $object->setPackagingType($data['PackagingType']); + unset($data['PackagingType']); + } + if (\array_key_exists('HazardLabelRequired', $data)) { + $object->setHazardLabelRequired($data['HazardLabelRequired']); + unset($data['HazardLabelRequired']); + } + if (\array_key_exists('PackagingTypeQuantity', $data)) { + $object->setPackagingTypeQuantity($data['PackagingTypeQuantity']); + unset($data['PackagingTypeQuantity']); + } + if (\array_key_exists('CommodityRegulatedLevelCode', $data)) { + $object->setCommodityRegulatedLevelCode($data['CommodityRegulatedLevelCode']); + unset($data['CommodityRegulatedLevelCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class => false]; + if (\array_key_exists('TransportCategory', $data)) { + $object->setTransportCategory($data['TransportCategory']); + unset($data['TransportCategory']); } + if (\array_key_exists('TunnelRestrictionCode', $data)) { + $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); + unset($data['TunnelRestrictionCode']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class HazMatHazMatChemicalRecordNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ChemicalRecordIdentifier', $data)) { - $object->setChemicalRecordIdentifier($data['ChemicalRecordIdentifier']); - unset($data['ChemicalRecordIdentifier']); - } - if (\array_key_exists('ClassDivisionNumber', $data)) { - $object->setClassDivisionNumber($data['ClassDivisionNumber']); - unset($data['ClassDivisionNumber']); - } - if (\array_key_exists('IDNumber', $data)) { - $object->setIDNumber($data['IDNumber']); - unset($data['IDNumber']); - } - if (\array_key_exists('TransportationMode', $data)) { - $object->setTransportationMode($data['TransportationMode']); - unset($data['TransportationMode']); - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('EmergencyPhone', $data)) { - $object->setEmergencyPhone($data['EmergencyPhone']); - unset($data['EmergencyPhone']); - } - if (\array_key_exists('EmergencyContact', $data)) { - $object->setEmergencyContact($data['EmergencyContact']); - unset($data['EmergencyContact']); - } - if (\array_key_exists('ReportableQuantity', $data)) { - $object->setReportableQuantity($data['ReportableQuantity']); - unset($data['ReportableQuantity']); - } - if (\array_key_exists('SubRiskClass', $data)) { - $object->setSubRiskClass($data['SubRiskClass']); - unset($data['SubRiskClass']); - } - if (\array_key_exists('PackagingGroupType', $data)) { - $object->setPackagingGroupType($data['PackagingGroupType']); - unset($data['PackagingGroupType']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('UOM', $data)) { - $object->setUOM($data['UOM']); - unset($data['UOM']); - } - if (\array_key_exists('PackagingInstructionCode', $data)) { - $object->setPackagingInstructionCode($data['PackagingInstructionCode']); - unset($data['PackagingInstructionCode']); - } - if (\array_key_exists('ProperShippingName', $data)) { - $object->setProperShippingName($data['ProperShippingName']); - unset($data['ProperShippingName']); - } - if (\array_key_exists('TechnicalName', $data)) { - $object->setTechnicalName($data['TechnicalName']); - unset($data['TechnicalName']); - } - if (\array_key_exists('AdditionalDescription', $data)) { - $object->setAdditionalDescription($data['AdditionalDescription']); - unset($data['AdditionalDescription']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($data['PackagingType']); - unset($data['PackagingType']); - } - if (\array_key_exists('HazardLabelRequired', $data)) { - $object->setHazardLabelRequired($data['HazardLabelRequired']); - unset($data['HazardLabelRequired']); - } - if (\array_key_exists('PackagingTypeQuantity', $data)) { - $object->setPackagingTypeQuantity($data['PackagingTypeQuantity']); - unset($data['PackagingTypeQuantity']); - } - if (\array_key_exists('CommodityRegulatedLevelCode', $data)) { - $object->setCommodityRegulatedLevelCode($data['CommodityRegulatedLevelCode']); - unset($data['CommodityRegulatedLevelCode']); - } - if (\array_key_exists('TransportCategory', $data)) { - $object->setTransportCategory($data['TransportCategory']); - unset($data['TransportCategory']); - } - if (\array_key_exists('TunnelRestrictionCode', $data)) { - $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); - unset($data['TunnelRestrictionCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('chemicalRecordIdentifier') && null !== $data->getChemicalRecordIdentifier()) { + $dataArray['ChemicalRecordIdentifier'] = $data->getChemicalRecordIdentifier(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('chemicalRecordIdentifier') && null !== $object->getChemicalRecordIdentifier()) { - $data['ChemicalRecordIdentifier'] = $object->getChemicalRecordIdentifier(); - } - if ($object->isInitialized('classDivisionNumber') && null !== $object->getClassDivisionNumber()) { - $data['ClassDivisionNumber'] = $object->getClassDivisionNumber(); - } - if ($object->isInitialized('iDNumber') && null !== $object->getIDNumber()) { - $data['IDNumber'] = $object->getIDNumber(); - } - $data['TransportationMode'] = $object->getTransportationMode(); - $data['RegulationSet'] = $object->getRegulationSet(); - if ($object->isInitialized('emergencyPhone') && null !== $object->getEmergencyPhone()) { - $data['EmergencyPhone'] = $object->getEmergencyPhone(); - } - if ($object->isInitialized('emergencyContact') && null !== $object->getEmergencyContact()) { - $data['EmergencyContact'] = $object->getEmergencyContact(); - } - if ($object->isInitialized('reportableQuantity') && null !== $object->getReportableQuantity()) { - $data['ReportableQuantity'] = $object->getReportableQuantity(); - } - if ($object->isInitialized('subRiskClass') && null !== $object->getSubRiskClass()) { - $data['SubRiskClass'] = $object->getSubRiskClass(); - } - if ($object->isInitialized('packagingGroupType') && null !== $object->getPackagingGroupType()) { - $data['PackagingGroupType'] = $object->getPackagingGroupType(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['Quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('uOM') && null !== $object->getUOM()) { - $data['UOM'] = $object->getUOM(); - } - if ($object->isInitialized('packagingInstructionCode') && null !== $object->getPackagingInstructionCode()) { - $data['PackagingInstructionCode'] = $object->getPackagingInstructionCode(); - } - if ($object->isInitialized('properShippingName') && null !== $object->getProperShippingName()) { - $data['ProperShippingName'] = $object->getProperShippingName(); - } - if ($object->isInitialized('technicalName') && null !== $object->getTechnicalName()) { - $data['TechnicalName'] = $object->getTechnicalName(); - } - if ($object->isInitialized('additionalDescription') && null !== $object->getAdditionalDescription()) { - $data['AdditionalDescription'] = $object->getAdditionalDescription(); - } - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $object->getPackagingType(); - } - if ($object->isInitialized('hazardLabelRequired') && null !== $object->getHazardLabelRequired()) { - $data['HazardLabelRequired'] = $object->getHazardLabelRequired(); - } - if ($object->isInitialized('packagingTypeQuantity') && null !== $object->getPackagingTypeQuantity()) { - $data['PackagingTypeQuantity'] = $object->getPackagingTypeQuantity(); - } - if ($object->isInitialized('commodityRegulatedLevelCode') && null !== $object->getCommodityRegulatedLevelCode()) { - $data['CommodityRegulatedLevelCode'] = $object->getCommodityRegulatedLevelCode(); - } - if ($object->isInitialized('transportCategory') && null !== $object->getTransportCategory()) { - $data['TransportCategory'] = $object->getTransportCategory(); - } - if ($object->isInitialized('tunnelRestrictionCode') && null !== $object->getTunnelRestrictionCode()) { - $data['TunnelRestrictionCode'] = $object->getTunnelRestrictionCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('classDivisionNumber') && null !== $data->getClassDivisionNumber()) { + $dataArray['ClassDivisionNumber'] = $data->getClassDivisionNumber(); + } + if ($data->isInitialized('iDNumber') && null !== $data->getIDNumber()) { + $dataArray['IDNumber'] = $data->getIDNumber(); + } + $dataArray['TransportationMode'] = $data->getTransportationMode(); + $dataArray['RegulationSet'] = $data->getRegulationSet(); + if ($data->isInitialized('emergencyPhone') && null !== $data->getEmergencyPhone()) { + $dataArray['EmergencyPhone'] = $data->getEmergencyPhone(); + } + if ($data->isInitialized('emergencyContact') && null !== $data->getEmergencyContact()) { + $dataArray['EmergencyContact'] = $data->getEmergencyContact(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class => false]; + if ($data->isInitialized('reportableQuantity') && null !== $data->getReportableQuantity()) { + $dataArray['ReportableQuantity'] = $data->getReportableQuantity(); } + if ($data->isInitialized('subRiskClass') && null !== $data->getSubRiskClass()) { + $dataArray['SubRiskClass'] = $data->getSubRiskClass(); + } + if ($data->isInitialized('packagingGroupType') && null !== $data->getPackagingGroupType()) { + $dataArray['PackagingGroupType'] = $data->getPackagingGroupType(); + } + if ($data->isInitialized('quantity') && null !== $data->getQuantity()) { + $dataArray['Quantity'] = $data->getQuantity(); + } + if ($data->isInitialized('uOM') && null !== $data->getUOM()) { + $dataArray['UOM'] = $data->getUOM(); + } + if ($data->isInitialized('packagingInstructionCode') && null !== $data->getPackagingInstructionCode()) { + $dataArray['PackagingInstructionCode'] = $data->getPackagingInstructionCode(); + } + if ($data->isInitialized('properShippingName') && null !== $data->getProperShippingName()) { + $dataArray['ProperShippingName'] = $data->getProperShippingName(); + } + if ($data->isInitialized('technicalName') && null !== $data->getTechnicalName()) { + $dataArray['TechnicalName'] = $data->getTechnicalName(); + } + if ($data->isInitialized('additionalDescription') && null !== $data->getAdditionalDescription()) { + $dataArray['AdditionalDescription'] = $data->getAdditionalDescription(); + } + if ($data->isInitialized('packagingType') && null !== $data->getPackagingType()) { + $dataArray['PackagingType'] = $data->getPackagingType(); + } + if ($data->isInitialized('hazardLabelRequired') && null !== $data->getHazardLabelRequired()) { + $dataArray['HazardLabelRequired'] = $data->getHazardLabelRequired(); + } + if ($data->isInitialized('packagingTypeQuantity') && null !== $data->getPackagingTypeQuantity()) { + $dataArray['PackagingTypeQuantity'] = $data->getPackagingTypeQuantity(); + } + if ($data->isInitialized('commodityRegulatedLevelCode') && null !== $data->getCommodityRegulatedLevelCode()) { + $dataArray['CommodityRegulatedLevelCode'] = $data->getCommodityRegulatedLevelCode(); + } + if ($data->isInitialized('transportCategory') && null !== $data->getTransportCategory()) { + $dataArray['TransportCategory'] = $data->getTransportCategory(); + } + if ($data->isInitialized('tunnelRestrictionCode') && null !== $data->getTunnelRestrictionCode()) { + $dataArray['TunnelRestrictionCode'] = $data->getTunnelRestrictionCode(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/HighValueReportImageImageFormatNormalizer.php b/src/Api/Normalizer/HighValueReportImageImageFormatNormalizer.php index 018d6be0..073107c0 100644 --- a/src/Api/Normalizer/HighValueReportImageImageFormatNormalizer.php +++ b/src/Api/Normalizer/HighValueReportImageImageFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class HighValueReportImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class HighValueReportImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class HighValueReportImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/HighValueReportImageNormalizer.php b/src/Api/Normalizer/HighValueReportImageNormalizer.php index 649be802..f3831399 100644 --- a/src/Api/Normalizer/HighValueReportImageNormalizer.php +++ b/src/Api/Normalizer/HighValueReportImageNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class HighValueReportImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class HighValueReportImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HighValueReportImage::class; + return $type === \ShipStream\Ups\Api\Model\HighValueReportImage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HighValueReportImage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HighValueReportImage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HighValueReportImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\HighValueReportImage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HighValueReportImage::class => false]; - } - } -} else { - class HighValueReportImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\HighValueReportImage::class; + if (\array_key_exists('ImageFormat', $data)) { + $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class, 'json', $context)); + unset($data['ImageFormat']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\HighValueReportImage::class; + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\HighValueReportImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ImageFormat'] = $this->normalizer->normalize($data->getImageFormat(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\HighValueReportImage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\HighValueReportImage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ImageFormatNormalizer.php b/src/Api/Normalizer/ImageFormatNormalizer.php index 6303c338..35b4b0bc 100644 --- a/src/Api/Normalizer/ImageFormatNormalizer.php +++ b/src/Api/Normalizer/ImageFormatNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\ImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ImageFormat::class => false]; - } - } -} else { - class ImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ImageFormat::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImageFormat::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ImageImageFormatNormalizer.php b/src/Api/Normalizer/ImageImageFormatNormalizer.php index b3fd1aae..a76b4a73 100644 --- a/src/Api/Normalizer/ImageImageFormatNormalizer.php +++ b/src/Api/Normalizer/ImageImageFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ImageImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\ImageImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImageImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImageImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ImageImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ImageImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ImageImageFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImageImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ImageImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ImageImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ImagePrintFormatNormalizer.php b/src/Api/Normalizer/ImagePrintFormatNormalizer.php index 08f6a307..072707a6 100644 --- a/src/Api/Normalizer/ImagePrintFormatNormalizer.php +++ b/src/Api/Normalizer/ImagePrintFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ImagePrintFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ImagePrintFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ImagePrintFormat::class; + return $type === \ShipStream\Ups\Api\Model\ImagePrintFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImagePrintFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImagePrintFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ImagePrintFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ImagePrintFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ImagePrintFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ImagePrintFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ImagePrintFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImagePrintFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ImagePrintFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ImagePrintFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ImagePrintFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ImagePrintSizeNormalizer.php b/src/Api/Normalizer/ImagePrintSizeNormalizer.php index 6a6d55d2..6beba88f 100644 --- a/src/Api/Normalizer/ImagePrintSizeNormalizer.php +++ b/src/Api/Normalizer/ImagePrintSizeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ImagePrintSizeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ImagePrintSizeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ImagePrintSize::class; + return $type === \ShipStream\Ups\Api\Model\ImagePrintSize::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImagePrintSize::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImagePrintSize::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ImagePrintSize(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ImagePrintSize(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ImagePrintSize::class => false]; - } - } -} else { - class ImagePrintSizeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ImagePrintSize::class; + if (\array_key_exists('Length', $data)) { + $object->setLength($data['Length']); + unset($data['Length']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImagePrintSize::class; + if (\array_key_exists('Width', $data)) { + $object->setWidth($data['Width']); + unset($data['Width']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ImagePrintSize(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Length'] = $data->getLength(); + $dataArray['Width'] = $data->getWidth(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ImagePrintSize::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ImagePrintSize::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ImageTypeNormalizer.php b/src/Api/Normalizer/ImageTypeNormalizer.php index 56d4bd36..07a7dd77 100644 --- a/src/Api/Normalizer/ImageTypeNormalizer.php +++ b/src/Api/Normalizer/ImageTypeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ImageTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ImageTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ImageType::class; + return $type === \ShipStream\Ups\Api\Model\ImageType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImageType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImageType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ImageType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ImageType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ImageType::class => false]; - } - } -} else { - class ImageTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ImageType::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ImageType::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ImageType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ImageType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ImageType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/IncludeCriteriaMerchantAccountNumberListNormalizer.php b/src/Api/Normalizer/IncludeCriteriaMerchantAccountNumberListNormalizer.php index 032a73e6..4695abb5 100644 --- a/src/Api/Normalizer/IncludeCriteriaMerchantAccountNumberListNormalizer.php +++ b/src/Api/Normalizer/IncludeCriteriaMerchantAccountNumberListNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class IncludeCriteriaMerchantAccountNumberListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class IncludeCriteriaMerchantAccountNumberListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class; + return $type === \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('MerchantAccountNumber', $data)) { - $values = []; - foreach ($data['MerchantAccountNumber'] as $value) { - $values[] = $value; - } - $object->setMerchantAccountNumber($values); - unset($data['MerchantAccountNumber']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('MerchantAccountNumber', $data)) { $values = []; - foreach ($object->getMerchantAccountNumber() as $value) { + foreach ($data['MerchantAccountNumber'] as $value) { $values[] = $value; } - $data['MerchantAccountNumber'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setMerchantAccountNumber($values); + unset($data['MerchantAccountNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class IncludeCriteriaMerchantAccountNumberListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class; + $dataArray = []; + $values = []; + foreach ($data->getMerchantAccountNumber() as $value) { + $values[] = $value; } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + $dataArray['MerchantAccountNumber'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - $object = new \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('MerchantAccountNumber', $data)) { - $values = []; - foreach ($data['MerchantAccountNumber'] as $value) { - $values[] = $value; - } - $object->setMerchantAccountNumber($values); - unset($data['MerchantAccountNumber']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getMerchantAccountNumber() as $value) { - $values[] = $value; - } - $data['MerchantAccountNumber'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/IncludeCriteriaSearchFilterNormalizer.php b/src/Api/Normalizer/IncludeCriteriaSearchFilterNormalizer.php index 7fa9f1a1..eda11d5b 100644 --- a/src/Api/Normalizer/IncludeCriteriaSearchFilterNormalizer.php +++ b/src/Api/Normalizer/IncludeCriteriaSearchFilterNormalizer.php @@ -5,172 +5,85 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class IncludeCriteriaSearchFilterNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class IncludeCriteriaSearchFilterNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class; + return $type === \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DCRIndicator', $data)) { - $object->setDCRIndicator($data['DCRIndicator']); - unset($data['DCRIndicator']); - } - if (\array_key_exists('ShippingAvailabilityIndicator', $data)) { - $object->setShippingAvailabilityIndicator($data['ShippingAvailabilityIndicator']); - unset($data['ShippingAvailabilityIndicator']); - } - if (\array_key_exists('ShipperPreparationDelay', $data)) { - $object->setShipperPreparationDelay($data['ShipperPreparationDelay']); - unset($data['ShipperPreparationDelay']); - } - if (\array_key_exists('ClickAndCollectSortWithDistance', $data)) { - $object->setClickAndCollectSortWithDistance($data['ClickAndCollectSortWithDistance']); - unset($data['ClickAndCollectSortWithDistance']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('dCRIndicator') && null !== $object->getDCRIndicator()) { - $data['DCRIndicator'] = $object->getDCRIndicator(); - } - if ($object->isInitialized('shippingAvailabilityIndicator') && null !== $object->getShippingAvailabilityIndicator()) { - $data['ShippingAvailabilityIndicator'] = $object->getShippingAvailabilityIndicator(); - } - if ($object->isInitialized('shipperPreparationDelay') && null !== $object->getShipperPreparationDelay()) { - $data['ShipperPreparationDelay'] = $object->getShipperPreparationDelay(); - } - if ($object->isInitialized('clickAndCollectSortWithDistance') && null !== $object->getClickAndCollectSortWithDistance()) { - $data['ClickAndCollectSortWithDistance'] = $object->getClickAndCollectSortWithDistance(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DCRIndicator', $data)) { + $object->setDCRIndicator($data['DCRIndicator']); + unset($data['DCRIndicator']); + } + if (\array_key_exists('ShippingAvailabilityIndicator', $data)) { + $object->setShippingAvailabilityIndicator($data['ShippingAvailabilityIndicator']); + unset($data['ShippingAvailabilityIndicator']); + } + if (\array_key_exists('ShipperPreparationDelay', $data)) { + $object->setShipperPreparationDelay($data['ShipperPreparationDelay']); + unset($data['ShipperPreparationDelay']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class => false]; + if (\array_key_exists('ClickAndCollectSortWithDistance', $data)) { + $object->setClickAndCollectSortWithDistance($data['ClickAndCollectSortWithDistance']); + unset($data['ClickAndCollectSortWithDistance']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class IncludeCriteriaSearchFilterNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class; + $dataArray = []; + if ($data->isInitialized('dCRIndicator') && null !== $data->getDCRIndicator()) { + $dataArray['DCRIndicator'] = $data->getDCRIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class; + if ($data->isInitialized('shippingAvailabilityIndicator') && null !== $data->getShippingAvailabilityIndicator()) { + $dataArray['ShippingAvailabilityIndicator'] = $data->getShippingAvailabilityIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DCRIndicator', $data)) { - $object->setDCRIndicator($data['DCRIndicator']); - unset($data['DCRIndicator']); - } - if (\array_key_exists('ShippingAvailabilityIndicator', $data)) { - $object->setShippingAvailabilityIndicator($data['ShippingAvailabilityIndicator']); - unset($data['ShippingAvailabilityIndicator']); - } - if (\array_key_exists('ShipperPreparationDelay', $data)) { - $object->setShipperPreparationDelay($data['ShipperPreparationDelay']); - unset($data['ShipperPreparationDelay']); - } - if (\array_key_exists('ClickAndCollectSortWithDistance', $data)) { - $object->setClickAndCollectSortWithDistance($data['ClickAndCollectSortWithDistance']); - unset($data['ClickAndCollectSortWithDistance']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('shipperPreparationDelay') && null !== $data->getShipperPreparationDelay()) { + $dataArray['ShipperPreparationDelay'] = $data->getShipperPreparationDelay(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('dCRIndicator') && null !== $object->getDCRIndicator()) { - $data['DCRIndicator'] = $object->getDCRIndicator(); - } - if ($object->isInitialized('shippingAvailabilityIndicator') && null !== $object->getShippingAvailabilityIndicator()) { - $data['ShippingAvailabilityIndicator'] = $object->getShippingAvailabilityIndicator(); - } - if ($object->isInitialized('shipperPreparationDelay') && null !== $object->getShipperPreparationDelay()) { - $data['ShipperPreparationDelay'] = $object->getShipperPreparationDelay(); - } - if ($object->isInitialized('clickAndCollectSortWithDistance') && null !== $object->getClickAndCollectSortWithDistance()) { - $data['ClickAndCollectSortWithDistance'] = $object->getClickAndCollectSortWithDistance(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('clickAndCollectSortWithDistance') && null !== $data->getClickAndCollectSortWithDistance()) { + $dataArray['ClickAndCollectSortWithDistance'] = $data->getClickAndCollectSortWithDistance(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/IncludeCriteriaServiceOfferingListNormalizer.php b/src/Api/Normalizer/IncludeCriteriaServiceOfferingListNormalizer.php index 708b01f0..f54cc88a 100644 --- a/src/Api/Normalizer/IncludeCriteriaServiceOfferingListNormalizer.php +++ b/src/Api/Normalizer/IncludeCriteriaServiceOfferingListNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class IncludeCriteriaServiceOfferingListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class IncludeCriteriaServiceOfferingListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class; + return $type === \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ServiceOffering', $data)) { - $values = []; - foreach ($data['ServiceOffering'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class, 'json', $context); - } - $object->setServiceOffering($values); - unset($data['ServiceOffering']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('ServiceOffering', $data)) { $values = []; - foreach ($object->getServiceOffering() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['ServiceOffering'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class, 'json', $context); } - $data['ServiceOffering'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setServiceOffering($values); + unset($data['ServiceOffering']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class IncludeCriteriaServiceOfferingListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class; + $dataArray = []; + $values = []; + foreach ($data->getServiceOffering() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['ServiceOffering'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ServiceOffering', $data)) { - $values = []; - foreach ($data['ServiceOffering'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class, 'json', $context); - } - $object->setServiceOffering($values); - unset($data['ServiceOffering']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getServiceOffering() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ServiceOffering'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InquireNumbersNormalizer.php b/src/Api/Normalizer/InquireNumbersNormalizer.php index 5c9fd335..6987f595 100644 --- a/src/Api/Normalizer/InquireNumbersNormalizer.php +++ b/src/Api/Normalizer/InquireNumbersNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InquireNumbersNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InquireNumbersNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InquireNumbers::class; + return $type === \ShipStream\Ups\Api\Model\InquireNumbers::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InquireNumbers::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InquireNumbers::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InquireNumbers(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('inquiryNumbers', $data)) { - $values = []; - foreach ($data['inquiryNumbers'] as $value) { - $values[] = $value; - } - $object->setInquiryNumbers($values); - unset($data['inquiryNumbers']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\InquireNumbers(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('inquiryNumbers') && null !== $object->getInquiryNumbers()) { - $values = []; - foreach ($object->getInquiryNumbers() as $value) { - $values[] = $value; - } - $data['inquiryNumbers'] = $values; + if (\array_key_exists('inquiryNumbers', $data)) { + $values = []; + foreach ($data['inquiryNumbers'] as $value) { + $values[] = $value; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setInquiryNumbers($values); + unset($data['inquiryNumbers']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InquireNumbers::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class InquireNumbersNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InquireNumbers::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InquireNumbers::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InquireNumbers(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('inquiryNumbers', $data)) { - $values = []; - foreach ($data['inquiryNumbers'] as $value) { - $values[] = $value; - } - $object->setInquiryNumbers($values); - unset($data['inquiryNumbers']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + $dataArray = []; + if ($data->isInitialized('inquiryNumbers') && null !== $data->getInquiryNumbers()) { + $values = []; + foreach ($data->getInquiryNumbers() as $value) { + $values[] = $value; } - return $object; + $dataArray['inquiryNumbers'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('inquiryNumbers') && null !== $object->getInquiryNumbers()) { - $values = []; - foreach ($object->getInquiryNumbers() as $value) { - $values[] = $value; - } - $data['inquiryNumbers'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InquireNumbers::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InquireNumbers::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InsuranceBasicFlexibleParcelIndicatorNormalizer.php b/src/Api/Normalizer/InsuranceBasicFlexibleParcelIndicatorNormalizer.php index 9185d168..ad40c5ce 100644 --- a/src/Api/Normalizer/InsuranceBasicFlexibleParcelIndicatorNormalizer.php +++ b/src/Api/Normalizer/InsuranceBasicFlexibleParcelIndicatorNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InsuranceBasicFlexibleParcelIndicatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InsuranceBasicFlexibleParcelIndicatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class; + return $type === \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class => false]; - } - } -} else { - class InsuranceBasicFlexibleParcelIndicatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InsuranceExtendedFlexibleParcelIndicatorNormalizer.php b/src/Api/Normalizer/InsuranceExtendedFlexibleParcelIndicatorNormalizer.php index d3d248a9..96b06d8e 100644 --- a/src/Api/Normalizer/InsuranceExtendedFlexibleParcelIndicatorNormalizer.php +++ b/src/Api/Normalizer/InsuranceExtendedFlexibleParcelIndicatorNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InsuranceExtendedFlexibleParcelIndicatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InsuranceExtendedFlexibleParcelIndicatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class; + return $type === \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class => false]; - } - } -} else { - class InsuranceExtendedFlexibleParcelIndicatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InsuranceTimeInTransitFlexibleParcelIndicatorNormalizer.php b/src/Api/Normalizer/InsuranceTimeInTransitFlexibleParcelIndicatorNormalizer.php index fae3659c..f8d63d2b 100644 --- a/src/Api/Normalizer/InsuranceTimeInTransitFlexibleParcelIndicatorNormalizer.php +++ b/src/Api/Normalizer/InsuranceTimeInTransitFlexibleParcelIndicatorNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InsuranceTimeInTransitFlexibleParcelIndicatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InsuranceTimeInTransitFlexibleParcelIndicatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class; + return $type === \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class => false]; - } - } -} else { - class InsuranceTimeInTransitFlexibleParcelIndicatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/IntermediateConsigneeAddressNormalizer.php b/src/Api/Normalizer/IntermediateConsigneeAddressNormalizer.php index f4cc744c..ca151b2d 100644 --- a/src/Api/Normalizer/IntermediateConsigneeAddressNormalizer.php +++ b/src/Api/Normalizer/IntermediateConsigneeAddressNormalizer.php @@ -5,204 +5,101 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class IntermediateConsigneeAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class IntermediateConsigneeAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class; + return $type === \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('Town', $data)) { + $object->setTown($data['Town']); + unset($data['Town']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class IntermediateConsigneeAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class; + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['Town'] = $data->getTown(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InternationalFormsBlanketPeriodNormalizer.php b/src/Api/Normalizer/InternationalFormsBlanketPeriodNormalizer.php index 7c926964..e16c7351 100644 --- a/src/Api/Normalizer/InternationalFormsBlanketPeriodNormalizer.php +++ b/src/Api/Normalizer/InternationalFormsBlanketPeriodNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InternationalFormsBlanketPeriodNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InternationalFormsBlanketPeriodNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class; + return $type === \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BeginDate', $data)) { - $object->setBeginDate($data['BeginDate']); - unset($data['BeginDate']); - } - if (\array_key_exists('EndDate', $data)) { - $object->setEndDate($data['EndDate']); - unset($data['EndDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['BeginDate'] = $object->getBeginDate(); - $data['EndDate'] = $object->getEndDate(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class => false]; - } - } -} else { - class InternationalFormsBlanketPeriodNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class; + if (\array_key_exists('BeginDate', $data)) { + $object->setBeginDate($data['BeginDate']); + unset($data['BeginDate']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class; + if (\array_key_exists('EndDate', $data)) { + $object->setEndDate($data['EndDate']); + unset($data['EndDate']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BeginDate', $data)) { - $object->setBeginDate($data['BeginDate']); - unset($data['BeginDate']); - } - if (\array_key_exists('EndDate', $data)) { - $object->setEndDate($data['EndDate']); - unset($data['EndDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['BeginDate'] = $object->getBeginDate(); - $data['EndDate'] = $object->getEndDate(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['BeginDate'] = $data->getBeginDate(); + $dataArray['EndDate'] = $data->getEndDate(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InternationalFormsCN22FormNormalizer.php b/src/Api/Normalizer/InternationalFormsCN22FormNormalizer.php index dd7babc1..cc6dce7f 100644 --- a/src/Api/Normalizer/InternationalFormsCN22FormNormalizer.php +++ b/src/Api/Normalizer/InternationalFormsCN22FormNormalizer.php @@ -5,210 +5,104 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InternationalFormsCN22FormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InternationalFormsCN22FormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class; + return $type === \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsCN22Form(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LabelSize', $data)) { - $object->setLabelSize($data['LabelSize']); - unset($data['LabelSize']); - } - if (\array_key_exists('PrintsPerPage', $data)) { - $object->setPrintsPerPage($data['PrintsPerPage']); - unset($data['PrintsPerPage']); - } - if (\array_key_exists('LabelPrintType', $data)) { - $object->setLabelPrintType($data['LabelPrintType']); - unset($data['LabelPrintType']); - } - if (\array_key_exists('CN22Type', $data)) { - $object->setCN22Type($data['CN22Type']); - unset($data['CN22Type']); - } - if (\array_key_exists('CN22OtherDescription', $data)) { - $object->setCN22OtherDescription($data['CN22OtherDescription']); - unset($data['CN22OtherDescription']); - } - if (\array_key_exists('FoldHereText', $data)) { - $object->setFoldHereText($data['FoldHereText']); - unset($data['FoldHereText']); - } - if (\array_key_exists('CN22Content', $data)) { - $values = []; - foreach ($data['CN22Content'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\CN22FormCN22Content::class, 'json', $context); - } - $object->setCN22Content($values); - unset($data['CN22Content']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\InternationalFormsCN22Form(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['LabelSize'] = $object->getLabelSize(); - $data['PrintsPerPage'] = $object->getPrintsPerPage(); - $data['LabelPrintType'] = $object->getLabelPrintType(); - $data['CN22Type'] = $object->getCN22Type(); - if ($object->isInitialized('cN22OtherDescription') && null !== $object->getCN22OtherDescription()) { - $data['CN22OtherDescription'] = $object->getCN22OtherDescription(); - } - if ($object->isInitialized('foldHereText') && null !== $object->getFoldHereText()) { - $data['FoldHereText'] = $object->getFoldHereText(); - } + if (\array_key_exists('LabelSize', $data)) { + $object->setLabelSize($data['LabelSize']); + unset($data['LabelSize']); + } + if (\array_key_exists('PrintsPerPage', $data)) { + $object->setPrintsPerPage($data['PrintsPerPage']); + unset($data['PrintsPerPage']); + } + if (\array_key_exists('LabelPrintType', $data)) { + $object->setLabelPrintType($data['LabelPrintType']); + unset($data['LabelPrintType']); + } + if (\array_key_exists('CN22Type', $data)) { + $object->setCN22Type($data['CN22Type']); + unset($data['CN22Type']); + } + if (\array_key_exists('CN22OtherDescription', $data)) { + $object->setCN22OtherDescription($data['CN22OtherDescription']); + unset($data['CN22OtherDescription']); + } + if (\array_key_exists('FoldHereText', $data)) { + $object->setFoldHereText($data['FoldHereText']); + unset($data['FoldHereText']); + } + if (\array_key_exists('CN22Content', $data)) { $values = []; - foreach ($object->getCN22Content() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['CN22Content'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data['CN22Content'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\CN22FormCN22Content::class, 'json', $context); } - return $data; + $object->setCN22Content($values); + unset($data['CN22Content']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class InternationalFormsCN22FormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class; + $dataArray = []; + $dataArray['LabelSize'] = $data->getLabelSize(); + $dataArray['PrintsPerPage'] = $data->getPrintsPerPage(); + $dataArray['LabelPrintType'] = $data->getLabelPrintType(); + $dataArray['CN22Type'] = $data->getCN22Type(); + if ($data->isInitialized('cN22OtherDescription') && null !== $data->getCN22OtherDescription()) { + $dataArray['CN22OtherDescription'] = $data->getCN22OtherDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class; + if ($data->isInitialized('foldHereText') && null !== $data->getFoldHereText()) { + $dataArray['FoldHereText'] = $data->getFoldHereText(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsCN22Form(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LabelSize', $data)) { - $object->setLabelSize($data['LabelSize']); - unset($data['LabelSize']); - } - if (\array_key_exists('PrintsPerPage', $data)) { - $object->setPrintsPerPage($data['PrintsPerPage']); - unset($data['PrintsPerPage']); - } - if (\array_key_exists('LabelPrintType', $data)) { - $object->setLabelPrintType($data['LabelPrintType']); - unset($data['LabelPrintType']); - } - if (\array_key_exists('CN22Type', $data)) { - $object->setCN22Type($data['CN22Type']); - unset($data['CN22Type']); - } - if (\array_key_exists('CN22OtherDescription', $data)) { - $object->setCN22OtherDescription($data['CN22OtherDescription']); - unset($data['CN22OtherDescription']); - } - if (\array_key_exists('FoldHereText', $data)) { - $object->setFoldHereText($data['FoldHereText']); - unset($data['FoldHereText']); - } - if (\array_key_exists('CN22Content', $data)) { - $values = []; - foreach ($data['CN22Content'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\CN22FormCN22Content::class, 'json', $context); - } - $object->setCN22Content($values); - unset($data['CN22Content']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $values = []; + foreach ($data->getCN22Content() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['LabelSize'] = $object->getLabelSize(); - $data['PrintsPerPage'] = $object->getPrintsPerPage(); - $data['LabelPrintType'] = $object->getLabelPrintType(); - $data['CN22Type'] = $object->getCN22Type(); - if ($object->isInitialized('cN22OtherDescription') && null !== $object->getCN22OtherDescription()) { - $data['CN22OtherDescription'] = $object->getCN22OtherDescription(); - } - if ($object->isInitialized('foldHereText') && null !== $object->getFoldHereText()) { - $data['FoldHereText'] = $object->getFoldHereText(); + $dataArray['CN22Content'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - $values = []; - foreach ($object->getCN22Content() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['CN22Content'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InternationalFormsContactsNormalizer.php b/src/Api/Normalizer/InternationalFormsContactsNormalizer.php index 7abf4669..1c37e1a2 100644 --- a/src/Api/Normalizer/InternationalFormsContactsNormalizer.php +++ b/src/Api/Normalizer/InternationalFormsContactsNormalizer.php @@ -5,186 +5,92 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InternationalFormsContactsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InternationalFormsContactsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsContacts::class; + return $type === \ShipStream\Ups\Api\Model\InternationalFormsContacts::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsContacts::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsContacts::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsContacts(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ForwardAgent', $data)) { - $object->setForwardAgent($this->denormalizer->denormalize($data['ForwardAgent'], \ShipStream\Ups\Api\Model\ContactsForwardAgent::class, 'json', $context)); - unset($data['ForwardAgent']); - } - if (\array_key_exists('UltimateConsignee', $data)) { - $object->setUltimateConsignee($this->denormalizer->denormalize($data['UltimateConsignee'], \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class, 'json', $context)); - unset($data['UltimateConsignee']); - } - if (\array_key_exists('IntermediateConsignee', $data)) { - $object->setIntermediateConsignee($this->denormalizer->denormalize($data['IntermediateConsignee'], \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class, 'json', $context)); - unset($data['IntermediateConsignee']); - } - if (\array_key_exists('Producer', $data)) { - $object->setProducer($this->denormalizer->denormalize($data['Producer'], \ShipStream\Ups\Api\Model\ContactsProducer::class, 'json', $context)); - unset($data['Producer']); - } - if (\array_key_exists('SoldTo', $data)) { - $object->setSoldTo($this->denormalizer->denormalize($data['SoldTo'], \ShipStream\Ups\Api\Model\ContactsSoldTo::class, 'json', $context)); - unset($data['SoldTo']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\InternationalFormsContacts(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('forwardAgent') && null !== $object->getForwardAgent()) { - $data['ForwardAgent'] = $this->normalizer->normalize($object->getForwardAgent(), 'json', $context); - } - if ($object->isInitialized('ultimateConsignee') && null !== $object->getUltimateConsignee()) { - $data['UltimateConsignee'] = $this->normalizer->normalize($object->getUltimateConsignee(), 'json', $context); - } - if ($object->isInitialized('intermediateConsignee') && null !== $object->getIntermediateConsignee()) { - $data['IntermediateConsignee'] = $this->normalizer->normalize($object->getIntermediateConsignee(), 'json', $context); - } - if ($object->isInitialized('producer') && null !== $object->getProducer()) { - $data['Producer'] = $this->normalizer->normalize($object->getProducer(), 'json', $context); - } - if ($object->isInitialized('soldTo') && null !== $object->getSoldTo()) { - $data['SoldTo'] = $this->normalizer->normalize($object->getSoldTo(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ForwardAgent', $data)) { + $object->setForwardAgent($this->denormalizer->denormalize($data['ForwardAgent'], \ShipStream\Ups\Api\Model\ContactsForwardAgent::class, 'json', $context)); + unset($data['ForwardAgent']); + } + if (\array_key_exists('UltimateConsignee', $data)) { + $object->setUltimateConsignee($this->denormalizer->denormalize($data['UltimateConsignee'], \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class, 'json', $context)); + unset($data['UltimateConsignee']); + } + if (\array_key_exists('IntermediateConsignee', $data)) { + $object->setIntermediateConsignee($this->denormalizer->denormalize($data['IntermediateConsignee'], \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class, 'json', $context)); + unset($data['IntermediateConsignee']); + } + if (\array_key_exists('Producer', $data)) { + $object->setProducer($this->denormalizer->denormalize($data['Producer'], \ShipStream\Ups\Api\Model\ContactsProducer::class, 'json', $context)); + unset($data['Producer']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsContacts::class => false]; + if (\array_key_exists('SoldTo', $data)) { + $object->setSoldTo($this->denormalizer->denormalize($data['SoldTo'], \ShipStream\Ups\Api\Model\ContactsSoldTo::class, 'json', $context)); + unset($data['SoldTo']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class InternationalFormsContactsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsContacts::class; + $dataArray = []; + if ($data->isInitialized('forwardAgent') && null !== $data->getForwardAgent()) { + $dataArray['ForwardAgent'] = $this->normalizer->normalize($data->getForwardAgent(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsContacts::class; + if ($data->isInitialized('ultimateConsignee') && null !== $data->getUltimateConsignee()) { + $dataArray['UltimateConsignee'] = $this->normalizer->normalize($data->getUltimateConsignee(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsContacts(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ForwardAgent', $data)) { - $object->setForwardAgent($this->denormalizer->denormalize($data['ForwardAgent'], \ShipStream\Ups\Api\Model\ContactsForwardAgent::class, 'json', $context)); - unset($data['ForwardAgent']); - } - if (\array_key_exists('UltimateConsignee', $data)) { - $object->setUltimateConsignee($this->denormalizer->denormalize($data['UltimateConsignee'], \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class, 'json', $context)); - unset($data['UltimateConsignee']); - } - if (\array_key_exists('IntermediateConsignee', $data)) { - $object->setIntermediateConsignee($this->denormalizer->denormalize($data['IntermediateConsignee'], \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class, 'json', $context)); - unset($data['IntermediateConsignee']); - } - if (\array_key_exists('Producer', $data)) { - $object->setProducer($this->denormalizer->denormalize($data['Producer'], \ShipStream\Ups\Api\Model\ContactsProducer::class, 'json', $context)); - unset($data['Producer']); - } - if (\array_key_exists('SoldTo', $data)) { - $object->setSoldTo($this->denormalizer->denormalize($data['SoldTo'], \ShipStream\Ups\Api\Model\ContactsSoldTo::class, 'json', $context)); - unset($data['SoldTo']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('intermediateConsignee') && null !== $data->getIntermediateConsignee()) { + $dataArray['IntermediateConsignee'] = $this->normalizer->normalize($data->getIntermediateConsignee(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('forwardAgent') && null !== $object->getForwardAgent()) { - $data['ForwardAgent'] = $this->normalizer->normalize($object->getForwardAgent(), 'json', $context); - } - if ($object->isInitialized('ultimateConsignee') && null !== $object->getUltimateConsignee()) { - $data['UltimateConsignee'] = $this->normalizer->normalize($object->getUltimateConsignee(), 'json', $context); - } - if ($object->isInitialized('intermediateConsignee') && null !== $object->getIntermediateConsignee()) { - $data['IntermediateConsignee'] = $this->normalizer->normalize($object->getIntermediateConsignee(), 'json', $context); - } - if ($object->isInitialized('producer') && null !== $object->getProducer()) { - $data['Producer'] = $this->normalizer->normalize($object->getProducer(), 'json', $context); - } - if ($object->isInitialized('soldTo') && null !== $object->getSoldTo()) { - $data['SoldTo'] = $this->normalizer->normalize($object->getSoldTo(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('producer') && null !== $data->getProducer()) { + $dataArray['Producer'] = $this->normalizer->normalize($data->getProducer(), 'json', $context); + } + if ($data->isInitialized('soldTo') && null !== $data->getSoldTo()) { + $dataArray['SoldTo'] = $this->normalizer->normalize($data->getSoldTo(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsContacts::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InternationalFormsContacts::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InternationalFormsDiscountNormalizer.php b/src/Api/Normalizer/InternationalFormsDiscountNormalizer.php index d481f40f..abc742eb 100644 --- a/src/Api/Normalizer/InternationalFormsDiscountNormalizer.php +++ b/src/Api/Normalizer/InternationalFormsDiscountNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InternationalFormsDiscountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InternationalFormsDiscountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class; + return $type === \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsDiscount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\InternationalFormsDiscount(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsDiscount::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class InternationalFormsDiscountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsDiscount(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsDiscount::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InternationalFormsDiscount::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InternationalFormsEEIFilingOptionNormalizer.php b/src/Api/Normalizer/InternationalFormsEEIFilingOptionNormalizer.php index b9e1b472..7d0f296c 100644 --- a/src/Api/Normalizer/InternationalFormsEEIFilingOptionNormalizer.php +++ b/src/Api/Normalizer/InternationalFormsEEIFilingOptionNormalizer.php @@ -5,182 +5,90 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InternationalFormsEEIFilingOptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InternationalFormsEEIFilingOptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class; + return $type === \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('UPSFiled', $data)) { - $object->setUPSFiled($this->denormalizer->denormalize($data['UPSFiled'], \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class, 'json', $context)); - unset($data['UPSFiled']); - } - if (\array_key_exists('ShipperFiled', $data)) { - $object->setShipperFiled($this->denormalizer->denormalize($data['ShipperFiled'], \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class, 'json', $context)); - unset($data['ShipperFiled']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('uPSFiled') && null !== $object->getUPSFiled()) { - $data['UPSFiled'] = $this->normalizer->normalize($object->getUPSFiled(), 'json', $context); - } - if ($object->isInitialized('shipperFiled') && null !== $object->getShipperFiled()) { - $data['ShipperFiled'] = $this->normalizer->normalize($object->getShipperFiled(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); + } + if (\array_key_exists('UPSFiled', $data)) { + $object->setUPSFiled($this->denormalizer->denormalize($data['UPSFiled'], \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class, 'json', $context)); + unset($data['UPSFiled']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class => false]; + if (\array_key_exists('ShipperFiled', $data)) { + $object->setShipperFiled($this->denormalizer->denormalize($data['ShipperFiled'], \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class, 'json', $context)); + unset($data['ShipperFiled']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class InternationalFormsEEIFilingOptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class; + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('UPSFiled', $data)) { - $object->setUPSFiled($this->denormalizer->denormalize($data['UPSFiled'], \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class, 'json', $context)); - unset($data['UPSFiled']); - } - if (\array_key_exists('ShipperFiled', $data)) { - $object->setShipperFiled($this->denormalizer->denormalize($data['ShipperFiled'], \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class, 'json', $context)); - unset($data['ShipperFiled']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('uPSFiled') && null !== $data->getUPSFiled()) { + $dataArray['UPSFiled'] = $this->normalizer->normalize($data->getUPSFiled(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('uPSFiled') && null !== $object->getUPSFiled()) { - $data['UPSFiled'] = $this->normalizer->normalize($object->getUPSFiled(), 'json', $context); - } - if ($object->isInitialized('shipperFiled') && null !== $object->getShipperFiled()) { - $data['ShipperFiled'] = $this->normalizer->normalize($object->getShipperFiled(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('shipperFiled') && null !== $data->getShipperFiled()) { + $dataArray['ShipperFiled'] = $this->normalizer->normalize($data->getShipperFiled(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InternationalFormsFreightChargesNormalizer.php b/src/Api/Normalizer/InternationalFormsFreightChargesNormalizer.php index 2dca36a7..47dca913 100644 --- a/src/Api/Normalizer/InternationalFormsFreightChargesNormalizer.php +++ b/src/Api/Normalizer/InternationalFormsFreightChargesNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InternationalFormsFreightChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InternationalFormsFreightChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class; + return $type === \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class InternationalFormsFreightChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InternationalFormsInsuranceChargesNormalizer.php b/src/Api/Normalizer/InternationalFormsInsuranceChargesNormalizer.php index 67d1126f..708d0659 100644 --- a/src/Api/Normalizer/InternationalFormsInsuranceChargesNormalizer.php +++ b/src/Api/Normalizer/InternationalFormsInsuranceChargesNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InternationalFormsInsuranceChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InternationalFormsInsuranceChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class; + return $type === \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class InternationalFormsInsuranceChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InternationalFormsOtherChargesNormalizer.php b/src/Api/Normalizer/InternationalFormsOtherChargesNormalizer.php index ee8b7c63..b766f92c 100644 --- a/src/Api/Normalizer/InternationalFormsOtherChargesNormalizer.php +++ b/src/Api/Normalizer/InternationalFormsOtherChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InternationalFormsOtherChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InternationalFormsOtherChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class; + return $type === \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['MonetaryValue'] = $object->getMonetaryValue(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class => false]; - } - } -} else { - class InternationalFormsOtherChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['MonetaryValue'] = $object->getMonetaryValue(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InternationalFormsProductNormalizer.php b/src/Api/Normalizer/InternationalFormsProductNormalizer.php index 1689f731..2b9bb3c7 100644 --- a/src/Api/Normalizer/InternationalFormsProductNormalizer.php +++ b/src/Api/Normalizer/InternationalFormsProductNormalizer.php @@ -5,408 +5,203 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InternationalFormsProductNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InternationalFormsProductNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsProduct::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsProduct::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsProduct(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Description', $data)) { - $values = []; - foreach ($data['Description'] as $value) { - $values[] = $value; - } - $object->setDescription($values); - unset($data['Description']); - } - if (\array_key_exists('Unit', $data)) { - $object->setUnit($this->denormalizer->denormalize($data['Unit'], \ShipStream\Ups\Api\Model\ProductUnit::class, 'json', $context)); - unset($data['Unit']); - } - if (\array_key_exists('CommodityCode', $data)) { - $object->setCommodityCode($data['CommodityCode']); - unset($data['CommodityCode']); - } - if (\array_key_exists('PartNumber', $data)) { - $object->setPartNumber($data['PartNumber']); - unset($data['PartNumber']); - } - if (\array_key_exists('OriginCountryCode', $data)) { - $object->setOriginCountryCode($data['OriginCountryCode']); - unset($data['OriginCountryCode']); - } - if (\array_key_exists('JointProductionIndicator', $data)) { - $object->setJointProductionIndicator($data['JointProductionIndicator']); - unset($data['JointProductionIndicator']); - } - if (\array_key_exists('NetCostCode', $data)) { - $object->setNetCostCode($data['NetCostCode']); - unset($data['NetCostCode']); - } - if (\array_key_exists('NetCostDateRange', $data)) { - $object->setNetCostDateRange($this->denormalizer->denormalize($data['NetCostDateRange'], \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class, 'json', $context)); - unset($data['NetCostDateRange']); - } - if (\array_key_exists('PreferenceCriteria', $data)) { - $object->setPreferenceCriteria($data['PreferenceCriteria']); - unset($data['PreferenceCriteria']); - } - if (\array_key_exists('ProducerInfo', $data)) { - $object->setProducerInfo($data['ProducerInfo']); - unset($data['ProducerInfo']); - } - if (\array_key_exists('MarksAndNumbers', $data)) { - $object->setMarksAndNumbers($data['MarksAndNumbers']); - unset($data['MarksAndNumbers']); - } - if (\array_key_exists('NumberOfPackagesPerCommodity', $data)) { - $object->setNumberOfPackagesPerCommodity($data['NumberOfPackagesPerCommodity']); - unset($data['NumberOfPackagesPerCommodity']); - } - if (\array_key_exists('ProductWeight', $data)) { - $object->setProductWeight($this->denormalizer->denormalize($data['ProductWeight'], \ShipStream\Ups\Api\Model\ProductProductWeight::class, 'json', $context)); - unset($data['ProductWeight']); - } - if (\array_key_exists('VehicleID', $data)) { - $object->setVehicleID($data['VehicleID']); - unset($data['VehicleID']); - } - if (\array_key_exists('ScheduleB', $data)) { - $object->setScheduleB($this->denormalizer->denormalize($data['ScheduleB'], \ShipStream\Ups\Api\Model\ProductScheduleB::class, 'json', $context)); - unset($data['ScheduleB']); - } - if (\array_key_exists('ExportType', $data)) { - $object->setExportType($data['ExportType']); - unset($data['ExportType']); - } - if (\array_key_exists('SEDTotalValue', $data)) { - $object->setSEDTotalValue($data['SEDTotalValue']); - unset($data['SEDTotalValue']); - } - if (\array_key_exists('ExcludeFromForm', $data)) { - $object->setExcludeFromForm($this->denormalizer->denormalize($data['ExcludeFromForm'], \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class, 'json', $context)); - unset($data['ExcludeFromForm']); - } - if (\array_key_exists('PackingListInfo', $data)) { - $object->setPackingListInfo($this->denormalizer->denormalize($data['PackingListInfo'], \ShipStream\Ups\Api\Model\ProductPackingListInfo::class, 'json', $context)); - unset($data['PackingListInfo']); - } - if (\array_key_exists('EEIInformation', $data)) { - $object->setEEIInformation($this->denormalizer->denormalize($data['EEIInformation'], \ShipStream\Ups\Api\Model\ProductEEIInformation::class, 'json', $context)); - unset($data['EEIInformation']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\InternationalFormsProduct::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsProduct::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\InternationalFormsProduct(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('Description', $data)) { $values = []; - foreach ($object->getDescription() as $value) { + foreach ($data['Description'] as $value) { $values[] = $value; } - $data['Description'] = $values; - if ($object->isInitialized('unit') && null !== $object->getUnit()) { - $data['Unit'] = $this->normalizer->normalize($object->getUnit(), 'json', $context); - } - if ($object->isInitialized('commodityCode') && null !== $object->getCommodityCode()) { - $data['CommodityCode'] = $object->getCommodityCode(); - } - if ($object->isInitialized('partNumber') && null !== $object->getPartNumber()) { - $data['PartNumber'] = $object->getPartNumber(); - } - if ($object->isInitialized('originCountryCode') && null !== $object->getOriginCountryCode()) { - $data['OriginCountryCode'] = $object->getOriginCountryCode(); - } - if ($object->isInitialized('jointProductionIndicator') && null !== $object->getJointProductionIndicator()) { - $data['JointProductionIndicator'] = $object->getJointProductionIndicator(); - } - if ($object->isInitialized('netCostCode') && null !== $object->getNetCostCode()) { - $data['NetCostCode'] = $object->getNetCostCode(); - } - if ($object->isInitialized('netCostDateRange') && null !== $object->getNetCostDateRange()) { - $data['NetCostDateRange'] = $this->normalizer->normalize($object->getNetCostDateRange(), 'json', $context); - } - if ($object->isInitialized('preferenceCriteria') && null !== $object->getPreferenceCriteria()) { - $data['PreferenceCriteria'] = $object->getPreferenceCriteria(); - } - if ($object->isInitialized('producerInfo') && null !== $object->getProducerInfo()) { - $data['ProducerInfo'] = $object->getProducerInfo(); - } - if ($object->isInitialized('marksAndNumbers') && null !== $object->getMarksAndNumbers()) { - $data['MarksAndNumbers'] = $object->getMarksAndNumbers(); - } - if ($object->isInitialized('numberOfPackagesPerCommodity') && null !== $object->getNumberOfPackagesPerCommodity()) { - $data['NumberOfPackagesPerCommodity'] = $object->getNumberOfPackagesPerCommodity(); - } - if ($object->isInitialized('productWeight') && null !== $object->getProductWeight()) { - $data['ProductWeight'] = $this->normalizer->normalize($object->getProductWeight(), 'json', $context); - } - if ($object->isInitialized('vehicleID') && null !== $object->getVehicleID()) { - $data['VehicleID'] = $object->getVehicleID(); - } - if ($object->isInitialized('scheduleB') && null !== $object->getScheduleB()) { - $data['ScheduleB'] = $this->normalizer->normalize($object->getScheduleB(), 'json', $context); - } - if ($object->isInitialized('exportType') && null !== $object->getExportType()) { - $data['ExportType'] = $object->getExportType(); - } - if ($object->isInitialized('sEDTotalValue') && null !== $object->getSEDTotalValue()) { - $data['SEDTotalValue'] = $object->getSEDTotalValue(); - } - if ($object->isInitialized('excludeFromForm') && null !== $object->getExcludeFromForm()) { - $data['ExcludeFromForm'] = $this->normalizer->normalize($object->getExcludeFromForm(), 'json', $context); - } - if ($object->isInitialized('packingListInfo') && null !== $object->getPackingListInfo()) { - $data['PackingListInfo'] = $this->normalizer->normalize($object->getPackingListInfo(), 'json', $context); - } - if ($object->isInitialized('eEIInformation') && null !== $object->getEEIInformation()) { - $data['EEIInformation'] = $this->normalizer->normalize($object->getEEIInformation(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setDescription($values); + unset($data['Description']); + } + if (\array_key_exists('Unit', $data)) { + $object->setUnit($this->denormalizer->denormalize($data['Unit'], \ShipStream\Ups\Api\Model\ProductUnit::class, 'json', $context)); + unset($data['Unit']); + } + if (\array_key_exists('CommodityCode', $data)) { + $object->setCommodityCode($data['CommodityCode']); + unset($data['CommodityCode']); + } + if (\array_key_exists('PartNumber', $data)) { + $object->setPartNumber($data['PartNumber']); + unset($data['PartNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsProduct::class => false]; + if (\array_key_exists('OriginCountryCode', $data)) { + $object->setOriginCountryCode($data['OriginCountryCode']); + unset($data['OriginCountryCode']); + } + if (\array_key_exists('JointProductionIndicator', $data)) { + $object->setJointProductionIndicator($data['JointProductionIndicator']); + unset($data['JointProductionIndicator']); + } + if (\array_key_exists('NetCostCode', $data)) { + $object->setNetCostCode($data['NetCostCode']); + unset($data['NetCostCode']); + } + if (\array_key_exists('NetCostDateRange', $data)) { + $object->setNetCostDateRange($this->denormalizer->denormalize($data['NetCostDateRange'], \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class, 'json', $context)); + unset($data['NetCostDateRange']); + } + if (\array_key_exists('PreferenceCriteria', $data)) { + $object->setPreferenceCriteria($data['PreferenceCriteria']); + unset($data['PreferenceCriteria']); + } + if (\array_key_exists('ProducerInfo', $data)) { + $object->setProducerInfo($data['ProducerInfo']); + unset($data['ProducerInfo']); + } + if (\array_key_exists('MarksAndNumbers', $data)) { + $object->setMarksAndNumbers($data['MarksAndNumbers']); + unset($data['MarksAndNumbers']); + } + if (\array_key_exists('NumberOfPackagesPerCommodity', $data)) { + $object->setNumberOfPackagesPerCommodity($data['NumberOfPackagesPerCommodity']); + unset($data['NumberOfPackagesPerCommodity']); + } + if (\array_key_exists('ProductWeight', $data)) { + $object->setProductWeight($this->denormalizer->denormalize($data['ProductWeight'], \ShipStream\Ups\Api\Model\ProductProductWeight::class, 'json', $context)); + unset($data['ProductWeight']); + } + if (\array_key_exists('VehicleID', $data)) { + $object->setVehicleID($data['VehicleID']); + unset($data['VehicleID']); + } + if (\array_key_exists('ScheduleB', $data)) { + $object->setScheduleB($this->denormalizer->denormalize($data['ScheduleB'], \ShipStream\Ups\Api\Model\ProductScheduleB::class, 'json', $context)); + unset($data['ScheduleB']); + } + if (\array_key_exists('ExportType', $data)) { + $object->setExportType($data['ExportType']); + unset($data['ExportType']); + } + if (\array_key_exists('SEDTotalValue', $data)) { + $object->setSEDTotalValue($data['SEDTotalValue']); + unset($data['SEDTotalValue']); + } + if (\array_key_exists('ExcludeFromForm', $data)) { + $object->setExcludeFromForm($this->denormalizer->denormalize($data['ExcludeFromForm'], \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class, 'json', $context)); + unset($data['ExcludeFromForm']); + } + if (\array_key_exists('PackingListInfo', $data)) { + $object->setPackingListInfo($this->denormalizer->denormalize($data['PackingListInfo'], \ShipStream\Ups\Api\Model\ProductPackingListInfo::class, 'json', $context)); + unset($data['PackingListInfo']); + } + if (\array_key_exists('EEIInformation', $data)) { + $object->setEEIInformation($this->denormalizer->denormalize($data['EEIInformation'], \ShipStream\Ups\Api\Model\ProductEEIInformation::class, 'json', $context)); + unset($data['EEIInformation']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class InternationalFormsProductNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsProduct::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsProduct::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsProduct(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Description', $data)) { - $values = []; - foreach ($data['Description'] as $value) { - $values[] = $value; - } - $object->setDescription($values); - unset($data['Description']); - } - if (\array_key_exists('Unit', $data)) { - $object->setUnit($this->denormalizer->denormalize($data['Unit'], \ShipStream\Ups\Api\Model\ProductUnit::class, 'json', $context)); - unset($data['Unit']); - } - if (\array_key_exists('CommodityCode', $data)) { - $object->setCommodityCode($data['CommodityCode']); - unset($data['CommodityCode']); - } - if (\array_key_exists('PartNumber', $data)) { - $object->setPartNumber($data['PartNumber']); - unset($data['PartNumber']); - } - if (\array_key_exists('OriginCountryCode', $data)) { - $object->setOriginCountryCode($data['OriginCountryCode']); - unset($data['OriginCountryCode']); - } - if (\array_key_exists('JointProductionIndicator', $data)) { - $object->setJointProductionIndicator($data['JointProductionIndicator']); - unset($data['JointProductionIndicator']); - } - if (\array_key_exists('NetCostCode', $data)) { - $object->setNetCostCode($data['NetCostCode']); - unset($data['NetCostCode']); - } - if (\array_key_exists('NetCostDateRange', $data)) { - $object->setNetCostDateRange($this->denormalizer->denormalize($data['NetCostDateRange'], \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class, 'json', $context)); - unset($data['NetCostDateRange']); - } - if (\array_key_exists('PreferenceCriteria', $data)) { - $object->setPreferenceCriteria($data['PreferenceCriteria']); - unset($data['PreferenceCriteria']); - } - if (\array_key_exists('ProducerInfo', $data)) { - $object->setProducerInfo($data['ProducerInfo']); - unset($data['ProducerInfo']); - } - if (\array_key_exists('MarksAndNumbers', $data)) { - $object->setMarksAndNumbers($data['MarksAndNumbers']); - unset($data['MarksAndNumbers']); - } - if (\array_key_exists('NumberOfPackagesPerCommodity', $data)) { - $object->setNumberOfPackagesPerCommodity($data['NumberOfPackagesPerCommodity']); - unset($data['NumberOfPackagesPerCommodity']); - } - if (\array_key_exists('ProductWeight', $data)) { - $object->setProductWeight($this->denormalizer->denormalize($data['ProductWeight'], \ShipStream\Ups\Api\Model\ProductProductWeight::class, 'json', $context)); - unset($data['ProductWeight']); - } - if (\array_key_exists('VehicleID', $data)) { - $object->setVehicleID($data['VehicleID']); - unset($data['VehicleID']); - } - if (\array_key_exists('ScheduleB', $data)) { - $object->setScheduleB($this->denormalizer->denormalize($data['ScheduleB'], \ShipStream\Ups\Api\Model\ProductScheduleB::class, 'json', $context)); - unset($data['ScheduleB']); - } - if (\array_key_exists('ExportType', $data)) { - $object->setExportType($data['ExportType']); - unset($data['ExportType']); - } - if (\array_key_exists('SEDTotalValue', $data)) { - $object->setSEDTotalValue($data['SEDTotalValue']); - unset($data['SEDTotalValue']); - } - if (\array_key_exists('ExcludeFromForm', $data)) { - $object->setExcludeFromForm($this->denormalizer->denormalize($data['ExcludeFromForm'], \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class, 'json', $context)); - unset($data['ExcludeFromForm']); - } - if (\array_key_exists('PackingListInfo', $data)) { - $object->setPackingListInfo($this->denormalizer->denormalize($data['PackingListInfo'], \ShipStream\Ups\Api\Model\ProductPackingListInfo::class, 'json', $context)); - unset($data['PackingListInfo']); - } - if (\array_key_exists('EEIInformation', $data)) { - $object->setEEIInformation($this->denormalizer->denormalize($data['EEIInformation'], \ShipStream\Ups\Api\Model\ProductEEIInformation::class, 'json', $context)); - unset($data['EEIInformation']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray = []; + $values = []; + foreach ($data->getDescription() as $value) { + $values[] = $value; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getDescription() as $value) { - $values[] = $value; - } - $data['Description'] = $values; - if ($object->isInitialized('unit') && null !== $object->getUnit()) { - $data['Unit'] = $this->normalizer->normalize($object->getUnit(), 'json', $context); - } - if ($object->isInitialized('commodityCode') && null !== $object->getCommodityCode()) { - $data['CommodityCode'] = $object->getCommodityCode(); - } - if ($object->isInitialized('partNumber') && null !== $object->getPartNumber()) { - $data['PartNumber'] = $object->getPartNumber(); - } - if ($object->isInitialized('originCountryCode') && null !== $object->getOriginCountryCode()) { - $data['OriginCountryCode'] = $object->getOriginCountryCode(); - } - if ($object->isInitialized('jointProductionIndicator') && null !== $object->getJointProductionIndicator()) { - $data['JointProductionIndicator'] = $object->getJointProductionIndicator(); - } - if ($object->isInitialized('netCostCode') && null !== $object->getNetCostCode()) { - $data['NetCostCode'] = $object->getNetCostCode(); - } - if ($object->isInitialized('netCostDateRange') && null !== $object->getNetCostDateRange()) { - $data['NetCostDateRange'] = $this->normalizer->normalize($object->getNetCostDateRange(), 'json', $context); - } - if ($object->isInitialized('preferenceCriteria') && null !== $object->getPreferenceCriteria()) { - $data['PreferenceCriteria'] = $object->getPreferenceCriteria(); - } - if ($object->isInitialized('producerInfo') && null !== $object->getProducerInfo()) { - $data['ProducerInfo'] = $object->getProducerInfo(); - } - if ($object->isInitialized('marksAndNumbers') && null !== $object->getMarksAndNumbers()) { - $data['MarksAndNumbers'] = $object->getMarksAndNumbers(); - } - if ($object->isInitialized('numberOfPackagesPerCommodity') && null !== $object->getNumberOfPackagesPerCommodity()) { - $data['NumberOfPackagesPerCommodity'] = $object->getNumberOfPackagesPerCommodity(); - } - if ($object->isInitialized('productWeight') && null !== $object->getProductWeight()) { - $data['ProductWeight'] = $this->normalizer->normalize($object->getProductWeight(), 'json', $context); - } - if ($object->isInitialized('vehicleID') && null !== $object->getVehicleID()) { - $data['VehicleID'] = $object->getVehicleID(); - } - if ($object->isInitialized('scheduleB') && null !== $object->getScheduleB()) { - $data['ScheduleB'] = $this->normalizer->normalize($object->getScheduleB(), 'json', $context); - } - if ($object->isInitialized('exportType') && null !== $object->getExportType()) { - $data['ExportType'] = $object->getExportType(); - } - if ($object->isInitialized('sEDTotalValue') && null !== $object->getSEDTotalValue()) { - $data['SEDTotalValue'] = $object->getSEDTotalValue(); - } - if ($object->isInitialized('excludeFromForm') && null !== $object->getExcludeFromForm()) { - $data['ExcludeFromForm'] = $this->normalizer->normalize($object->getExcludeFromForm(), 'json', $context); - } - if ($object->isInitialized('packingListInfo') && null !== $object->getPackingListInfo()) { - $data['PackingListInfo'] = $this->normalizer->normalize($object->getPackingListInfo(), 'json', $context); - } - if ($object->isInitialized('eEIInformation') && null !== $object->getEEIInformation()) { - $data['EEIInformation'] = $this->normalizer->normalize($object->getEEIInformation(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $dataArray['Description'] = $values; + if ($data->isInitialized('unit') && null !== $data->getUnit()) { + $dataArray['Unit'] = $this->normalizer->normalize($data->getUnit(), 'json', $context); + } + if ($data->isInitialized('commodityCode') && null !== $data->getCommodityCode()) { + $dataArray['CommodityCode'] = $data->getCommodityCode(); + } + if ($data->isInitialized('partNumber') && null !== $data->getPartNumber()) { + $dataArray['PartNumber'] = $data->getPartNumber(); + } + if ($data->isInitialized('originCountryCode') && null !== $data->getOriginCountryCode()) { + $dataArray['OriginCountryCode'] = $data->getOriginCountryCode(); + } + if ($data->isInitialized('jointProductionIndicator') && null !== $data->getJointProductionIndicator()) { + $dataArray['JointProductionIndicator'] = $data->getJointProductionIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsProduct::class => false]; + if ($data->isInitialized('netCostCode') && null !== $data->getNetCostCode()) { + $dataArray['NetCostCode'] = $data->getNetCostCode(); } + if ($data->isInitialized('netCostDateRange') && null !== $data->getNetCostDateRange()) { + $dataArray['NetCostDateRange'] = $this->normalizer->normalize($data->getNetCostDateRange(), 'json', $context); + } + if ($data->isInitialized('preferenceCriteria') && null !== $data->getPreferenceCriteria()) { + $dataArray['PreferenceCriteria'] = $data->getPreferenceCriteria(); + } + if ($data->isInitialized('producerInfo') && null !== $data->getProducerInfo()) { + $dataArray['ProducerInfo'] = $data->getProducerInfo(); + } + if ($data->isInitialized('marksAndNumbers') && null !== $data->getMarksAndNumbers()) { + $dataArray['MarksAndNumbers'] = $data->getMarksAndNumbers(); + } + if ($data->isInitialized('numberOfPackagesPerCommodity') && null !== $data->getNumberOfPackagesPerCommodity()) { + $dataArray['NumberOfPackagesPerCommodity'] = $data->getNumberOfPackagesPerCommodity(); + } + if ($data->isInitialized('productWeight') && null !== $data->getProductWeight()) { + $dataArray['ProductWeight'] = $this->normalizer->normalize($data->getProductWeight(), 'json', $context); + } + if ($data->isInitialized('vehicleID') && null !== $data->getVehicleID()) { + $dataArray['VehicleID'] = $data->getVehicleID(); + } + if ($data->isInitialized('scheduleB') && null !== $data->getScheduleB()) { + $dataArray['ScheduleB'] = $this->normalizer->normalize($data->getScheduleB(), 'json', $context); + } + if ($data->isInitialized('exportType') && null !== $data->getExportType()) { + $dataArray['ExportType'] = $data->getExportType(); + } + if ($data->isInitialized('sEDTotalValue') && null !== $data->getSEDTotalValue()) { + $dataArray['SEDTotalValue'] = $data->getSEDTotalValue(); + } + if ($data->isInitialized('excludeFromForm') && null !== $data->getExcludeFromForm()) { + $dataArray['ExcludeFromForm'] = $this->normalizer->normalize($data->getExcludeFromForm(), 'json', $context); + } + if ($data->isInitialized('packingListInfo') && null !== $data->getPackingListInfo()) { + $dataArray['PackingListInfo'] = $this->normalizer->normalize($data->getPackingListInfo(), 'json', $context); + } + if ($data->isInitialized('eEIInformation') && null !== $data->getEEIInformation()) { + $dataArray['EEIInformation'] = $this->normalizer->normalize($data->getEEIInformation(), 'json', $context); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InternationalFormsProduct::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InternationalFormsUPSPremiumCareFormNormalizer.php b/src/Api/Normalizer/InternationalFormsUPSPremiumCareFormNormalizer.php index 8d049483..e066e91b 100644 --- a/src/Api/Normalizer/InternationalFormsUPSPremiumCareFormNormalizer.php +++ b/src/Api/Normalizer/InternationalFormsUPSPremiumCareFormNormalizer.php @@ -5,166 +5,82 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InternationalFormsUPSPremiumCareFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InternationalFormsUPSPremiumCareFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class; + return $type === \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentDate', $data)) { - $object->setShipmentDate($data['ShipmentDate']); - unset($data['ShipmentDate']); - } - if (\array_key_exists('PageSize', $data)) { - $object->setPageSize($data['PageSize']); - unset($data['PageSize']); - } - if (\array_key_exists('PrintType', $data)) { - $object->setPrintType($data['PrintType']); - unset($data['PrintType']); - } - if (\array_key_exists('NumOfCopies', $data)) { - $object->setNumOfCopies($data['NumOfCopies']); - unset($data['NumOfCopies']); - } - if (\array_key_exists('LanguageForUPSPremiumCare', $data)) { - $object->setLanguageForUPSPremiumCare($this->denormalizer->denormalize($data['LanguageForUPSPremiumCare'], \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class, 'json', $context)); - unset($data['LanguageForUPSPremiumCare']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ShipmentDate'] = $object->getShipmentDate(); - $data['PageSize'] = $object->getPageSize(); - $data['PrintType'] = $object->getPrintType(); - $data['NumOfCopies'] = $object->getNumOfCopies(); - $data['LanguageForUPSPremiumCare'] = $this->normalizer->normalize($object->getLanguageForUPSPremiumCare(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ShipmentDate', $data)) { + $object->setShipmentDate($data['ShipmentDate']); + unset($data['ShipmentDate']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class => false]; + if (\array_key_exists('PageSize', $data)) { + $object->setPageSize($data['PageSize']); + unset($data['PageSize']); } - } -} else { - class InternationalFormsUPSPremiumCareFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class; + if (\array_key_exists('PrintType', $data)) { + $object->setPrintType($data['PrintType']); + unset($data['PrintType']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class; + if (\array_key_exists('NumOfCopies', $data)) { + $object->setNumOfCopies($data['NumOfCopies']); + unset($data['NumOfCopies']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentDate', $data)) { - $object->setShipmentDate($data['ShipmentDate']); - unset($data['ShipmentDate']); - } - if (\array_key_exists('PageSize', $data)) { - $object->setPageSize($data['PageSize']); - unset($data['PageSize']); - } - if (\array_key_exists('PrintType', $data)) { - $object->setPrintType($data['PrintType']); - unset($data['PrintType']); - } - if (\array_key_exists('NumOfCopies', $data)) { - $object->setNumOfCopies($data['NumOfCopies']); - unset($data['NumOfCopies']); - } - if (\array_key_exists('LanguageForUPSPremiumCare', $data)) { - $object->setLanguageForUPSPremiumCare($this->denormalizer->denormalize($data['LanguageForUPSPremiumCare'], \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class, 'json', $context)); - unset($data['LanguageForUPSPremiumCare']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('LanguageForUPSPremiumCare', $data)) { + $object->setLanguageForUPSPremiumCare($this->denormalizer->denormalize($data['LanguageForUPSPremiumCare'], \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class, 'json', $context)); + unset($data['LanguageForUPSPremiumCare']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ShipmentDate'] = $object->getShipmentDate(); - $data['PageSize'] = $object->getPageSize(); - $data['PrintType'] = $object->getPrintType(); - $data['NumOfCopies'] = $object->getNumOfCopies(); - $data['LanguageForUPSPremiumCare'] = $this->normalizer->normalize($object->getLanguageForUPSPremiumCare(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ShipmentDate'] = $data->getShipmentDate(); + $dataArray['PageSize'] = $data->getPageSize(); + $dataArray['PrintType'] = $data->getPrintType(); + $dataArray['NumOfCopies'] = $data->getNumOfCopies(); + $dataArray['LanguageForUPSPremiumCare'] = $this->normalizer->normalize($data->getLanguageForUPSPremiumCare(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/InternationalFormsUserCreatedFormNormalizer.php b/src/Api/Normalizer/InternationalFormsUserCreatedFormNormalizer.php index 2b4d9bc8..4ab02632 100644 --- a/src/Api/Normalizer/InternationalFormsUserCreatedFormNormalizer.php +++ b/src/Api/Normalizer/InternationalFormsUserCreatedFormNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class InternationalFormsUserCreatedFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class InternationalFormsUserCreatedFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class; + return $type === \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DocumentID', $data)) { - $values = []; - foreach ($data['DocumentID'] as $value) { - $values[] = $value; - } - $object->setDocumentID($values); - unset($data['DocumentID']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('DocumentID', $data)) { $values = []; - foreach ($object->getDocumentID() as $value) { + foreach ($data['DocumentID'] as $value) { $values[] = $value; } - $data['DocumentID'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setDocumentID($values); + unset($data['DocumentID']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class InternationalFormsUserCreatedFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class; + $dataArray = []; + $values = []; + foreach ($data->getDocumentID() as $value) { + $values[] = $value; } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + $dataArray['DocumentID'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - $object = new \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DocumentID', $data)) { - $values = []; - foreach ($data['DocumentID'] as $value) { - $values[] = $value; - } - $object->setDocumentID($values); - unset($data['DocumentID']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getDocumentID() as $value) { - $values[] = $value; - } - $data['DocumentID'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/JaneObjectNormalizer.php b/src/Api/Normalizer/JaneObjectNormalizer.php index 41c722e9..4e71d2dd 100644 --- a/src/Api/Normalizer/JaneObjectNormalizer.php +++ b/src/Api/Normalizer/JaneObjectNormalizer.php @@ -10,5189 +10,2591 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + protected $normalizers = [ + + \ShipStream\Ups\Api\Model\XAVRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\XAVRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\XAVResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\XAVResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\XAVRequest::class => \ShipStream\Ups\Api\Normalizer\XAVRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\XAVRequestRequest::class => \ShipStream\Ups\Api\Normalizer\XAVRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\RequestTransactionReference::class => \ShipStream\Ups\Api\Normalizer\RequestTransactionReferenceNormalizer::class, + + \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\XAVRequestAddressKeyFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\XAVResponse::class => \ShipStream\Ups\Api\Normalizer\XAVResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\XAVResponseResponse::class => \ShipStream\Ups\Api\Normalizer\XAVResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\ResponseResponseStatus::class => \ShipStream\Ups\Api\Normalizer\ResponseResponseStatusNormalizer::class, + + \ShipStream\Ups\Api\Model\ResponseAlert::class => \ShipStream\Ups\Api\Normalizer\ResponseAlertNormalizer::class, + + \ShipStream\Ups\Api\Model\ResponseTransactionReference::class => \ShipStream\Ups\Api\Normalizer\ResponseTransactionReferenceNormalizer::class, + + \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class => \ShipStream\Ups\Api\Normalizer\XAVResponseAddressClassificationNormalizer::class, + + \ShipStream\Ups\Api\Model\XAVResponseCandidate::class => \ShipStream\Ups\Api\Normalizer\XAVResponseCandidateNormalizer::class, + + \ShipStream\Ups\Api\Model\CandidateAddressClassification::class => \ShipStream\Ups\Api\Normalizer\CandidateAddressClassificationNormalizer::class, + + \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\CandidateAddressKeyFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\ErrorResponse::class => \ShipStream\Ups\Api\Normalizer\ErrorResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\ErrorResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\Error::class => \ShipStream\Ups\Api\Normalizer\ErrorNormalizer::class, + + \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\DANGEROUSGOODSUTILITYRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\DANGEROUSGOODSUTILITYResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataResponseChemicalDataNormalizer::class, + + \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class => \ShipStream\Ups\Api\Normalizer\ChemicalDataChemicalDetailNormalizer::class, + + \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class => \ShipStream\Ups\Api\Normalizer\ChemicalDataProperShippingNameDetailNormalizer::class, + + \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class => \ShipStream\Ups\Api\Normalizer\ChemicalDataPackageQuantityLimitDetailNormalizer::class, + + \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\DANGEROUSGOODSUTILITYAPCRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\DANGEROUSGOODSUTILITYAPCResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckRequestShipmentNormalizer::class, + + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckShipmentShipFromAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckShipmentShipToAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentService::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceNormalizer::class, + + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckShipmentPackageNormalizer::class, + + \ShipStream\Ups\Api\Model\PackagePackageWeight::class => \ShipStream\Ups\Api\Normalizer\PackagePackageWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\PackageWeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageChemicalRecord::class => \ShipStream\Ups\Api\Normalizer\PackageChemicalRecordNormalizer::class, + + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\ResponseAlertDetail::class => \ShipStream\Ups\Api\Normalizer\ResponseAlertDetailNormalizer::class, + + \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class => \ShipStream\Ups\Api\Normalizer\AlertDetailElementLevelInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class => \ShipStream\Ups\Api\Normalizer\ElementLevelInformationElementIdentifierNormalizer::class, + + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponseServiceNormalizer::class, + + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponsePackageResultsNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class => \ShipStream\Ups\Api\Normalizer\PackageResultsChemicalRecordResultsNormalizer::class, + + \ShipStream\Ups\Api\Model\LandedCostRequest::class => \ShipStream\Ups\Api\Normalizer\LandedCostRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class => \ShipStream\Ups\Api\Normalizer\LandedCostRequestShipmentNormalizer::class, + + \ShipStream\Ups\Api\Model\RequestShipmentItems::class => \ShipStream\Ups\Api\Normalizer\RequestShipmentItemsNormalizer::class, + + \ShipStream\Ups\Api\Model\LandedCostResponse::class => \ShipStream\Ups\Api\Normalizer\LandedCostResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class => \ShipStream\Ups\Api\Normalizer\LandedCostResponseShipmentNormalizer::class, + + \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class => \ShipStream\Ups\Api\Normalizer\LandedCostResponseShipmentPerfStatsNormalizer::class, + + \ShipStream\Ups\Api\Model\BrokerageFeeItems::class => \ShipStream\Ups\Api\Normalizer\BrokerageFeeItemsNormalizer::class, + + \ShipStream\Ups\Api\Model\ResponseShipmentItems::class => \ShipStream\Ups\Api\Normalizer\ResponseShipmentItemsNormalizer::class, + + \ShipStream\Ups\Api\Model\Errors::class => \ShipStream\Ups\Api\Normalizer\ErrorsNormalizer::class, + + \ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\LOCATORRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\LOCATORResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\LocatorRequest::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\LocatorRequestRequest::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestOriginAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\OriginAddressGeocode::class => \ShipStream\Ups\Api\Normalizer\OriginAddressGeocodeNormalizer::class, + + \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\OriginAddressAddressKeyFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestTranslateNormalizer::class, + + \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestLocationSearchCriteriaNormalizer::class, + + \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaSearchOptionNormalizer::class, + + \ShipStream\Ups\Api\Model\SearchOptionOptionType::class => \ShipStream\Ups\Api\Normalizer\SearchOptionOptionTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class => \ShipStream\Ups\Api\Normalizer\SearchOptionOptionCodeNormalizer::class, + + \ShipStream\Ups\Api\Model\SearchOptionRelation::class => \ShipStream\Ups\Api\Normalizer\SearchOptionRelationNormalizer::class, + + \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaServiceSearchNormalizer::class, + + \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class => \ShipStream\Ups\Api\Normalizer\ServiceSearchServiceCodeNormalizer::class, + + \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class => \ShipStream\Ups\Api\Normalizer\ServiceSearchServiceOptionCodeNormalizer::class, + + \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaFreightWillCallSearchNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class => \ShipStream\Ups\Api\Normalizer\FreightWillCallSearchFacilityAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaAccessPointSearchNormalizer::class, + + \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class => \ShipStream\Ups\Api\Normalizer\AccessPointSearchIncludeCriteriaNormalizer::class, + + \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class => \ShipStream\Ups\Api\Normalizer\IncludeCriteriaMerchantAccountNumberListNormalizer::class, + + \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class => \ShipStream\Ups\Api\Normalizer\IncludeCriteriaSearchFilterNormalizer::class, + + \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class => \ShipStream\Ups\Api\Normalizer\IncludeCriteriaServiceOfferingListNormalizer::class, + + \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class => \ShipStream\Ups\Api\Normalizer\ServiceOfferingListServiceOfferingNormalizer::class, + + \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class => \ShipStream\Ups\Api\Normalizer\AccessPointSearchExcludeFromResultNormalizer::class, + + \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class => \ShipStream\Ups\Api\Normalizer\ExcludeFromResultPostalCodeListNormalizer::class, + + \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class => \ShipStream\Ups\Api\Normalizer\PostalCodeListPostalCodeNormalizer::class, + + \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaOpenTimeCriteriaNormalizer::class, + + \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestSortCriteriaNormalizer::class, + + \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestServiceGeoUnitNormalizer::class, + + \ShipStream\Ups\Api\Model\LocatorResponse::class => \ShipStream\Ups\Api\Normalizer\LocatorResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\LocatorResponseResponse::class => \ShipStream\Ups\Api\Normalizer\LocatorResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\ResponseError::class => \ShipStream\Ups\Api\Normalizer\ResponseErrorNormalizer::class, + + \ShipStream\Ups\Api\Model\ErrorErrorLocation::class => \ShipStream\Ups\Api\Normalizer\ErrorErrorLocationNormalizer::class, + + \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class => \ShipStream\Ups\Api\Normalizer\LocatorResponseGeocodeNormalizer::class, + + \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class => \ShipStream\Ups\Api\Normalizer\LocatorResponseSearchResultsNormalizer::class, + + \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class => \ShipStream\Ups\Api\Normalizer\SearchResultsGeocodeCandidateNormalizer::class, + + \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\GeocodeCandidateAddressKeyFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class => \ShipStream\Ups\Api\Normalizer\GeocodeCandidateGeocodeNormalizer::class, + + \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class => \ShipStream\Ups\Api\Normalizer\SearchResultsDropLocationNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationIVR::class => \ShipStream\Ups\Api\Normalizer\DropLocationIVRNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationGeocode::class => \ShipStream\Ups\Api\Normalizer\DropLocationGeocodeNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\DropLocationAddressKeyFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class => \ShipStream\Ups\Api\Normalizer\DropLocationLocationAttributeNormalizer::class, + + \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class => \ShipStream\Ups\Api\Normalizer\LocationAttributeOptionTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class => \ShipStream\Ups\Api\Normalizer\LocationAttributeOptionCodeNormalizer::class, + + \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class => \ShipStream\Ups\Api\Normalizer\OptionCodeTransportationPickUpScheduleNormalizer::class, + + \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class => \ShipStream\Ups\Api\Normalizer\TransportationPickUpSchedulePickUpNormalizer::class, + + \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class => \ShipStream\Ups\Api\Normalizer\PickUpPickUpDetailsNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationDistance::class => \ShipStream\Ups\Api\Normalizer\DropLocationDistanceNormalizer::class, + + \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DistanceUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class => \ShipStream\Ups\Api\Normalizer\DropLocationSpecialInstructionsNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class => \ShipStream\Ups\Api\Normalizer\DropLocationAdditionalCommentsNormalizer::class, + + \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class => \ShipStream\Ups\Api\Normalizer\AdditionalCommentsCommentTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class => \ShipStream\Ups\Api\Normalizer\DropLocationOperatingHoursNormalizer::class, + + \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class => \ShipStream\Ups\Api\Normalizer\OperatingHoursStandardHoursNormalizer::class, + + \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class => \ShipStream\Ups\Api\Normalizer\StandardHoursDayOfWeekNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class => \ShipStream\Ups\Api\Normalizer\DropLocationLocalizedInstructionNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class => \ShipStream\Ups\Api\Normalizer\DropLocationPromotionInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationSortCode::class => \ShipStream\Ups\Api\Normalizer\DropLocationSortCodeNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class => \ShipStream\Ups\Api\Normalizer\DropLocationServiceOfferingListNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class => \ShipStream\Ups\Api\Normalizer\DropLocationAccessPointInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationBusinessClassificationListNormalizer::class, + + \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class => \ShipStream\Ups\Api\Normalizer\BusinessClassificationListBusinessClassificationNormalizer::class, + + \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationAccessPointStatusNormalizer::class, + + \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationPrivateNetworkListNormalizer::class, + + \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class => \ShipStream\Ups\Api\Normalizer\PrivateNetworkListPrivateNetworkNormalizer::class, + + \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationAvailabilityNormalizer::class, + + \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class => \ShipStream\Ups\Api\Normalizer\AvailabilityShippingAvailabilityNormalizer::class, + + \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class => \ShipStream\Ups\Api\Normalizer\ShippingAvailabilityUnavailableReasonNormalizer::class, + + \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class => \ShipStream\Ups\Api\Normalizer\AvailabilityDCRAvailabilityNormalizer::class, + + \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class => \ShipStream\Ups\Api\Normalizer\DCRAvailabilityUnavailableReasonNormalizer::class, + + \ShipStream\Ups\Api\Model\DropLocationLocationImage::class => \ShipStream\Ups\Api\Normalizer\DropLocationLocationImageNormalizer::class, + + \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class => \ShipStream\Ups\Api\Normalizer\SearchResultsAvailableLocationAttributesNormalizer::class, + + \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesOptionTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesOptionCodeNormalizer::class, + + \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesOptionCodeTransportationPickUpScheduleNormalizer::class, + + \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesTransportationPickUpSchedulePickUpNormalizer::class, + + \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesPickUpPickUpDetailsNormalizer::class, + + \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class => \ShipStream\Ups\Api\Normalizer\GenerateTokenSuccessResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class => \ShipStream\Ups\Api\Normalizer\RefreshTokenSuccessResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTDeleteRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTDeleteResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\DeleteRequest::class => \ShipStream\Ups\Api\Normalizer\DeleteRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\DeleteRequestRequest::class => \ShipStream\Ups\Api\Normalizer\DeleteRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\DeleteResponse::class => \ShipStream\Ups\Api\Normalizer\DeleteResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\DeleteResponseResponse::class => \ShipStream\Ups\Api\Normalizer\DeleteResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryRequestFormsHistoryDocumentIDNormalizer::class, + + \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTUploadRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTUploadResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\UploadRequest::class => \ShipStream\Ups\Api\Normalizer\UploadRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\UploadRequestRequest::class => \ShipStream\Ups\Api\Normalizer\UploadRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class => \ShipStream\Ups\Api\Normalizer\UploadRequestUserCreatedFormNormalizer::class, + + \ShipStream\Ups\Api\Model\UploadResponse::class => \ShipStream\Ups\Api\Normalizer\UploadResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\UploadResponseResponse::class => \ShipStream\Ups\Api\Normalizer\UploadResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class => \ShipStream\Ups\Api\Normalizer\UploadResponseFormsHistoryDocumentIDNormalizer::class, + + \ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupRateRequest::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestShipperAccountNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestPickupAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestPickupDateInfoNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupRateResponse::class => \ShipStream\Ups\Api\Normalizer\PickupRateResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupRateResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class => \ShipStream\Ups\Api\Normalizer\PickupRateResponseRateResultNormalizer::class, + + \ShipStream\Ups\Api\Model\RateResultChargeDetail::class => \ShipStream\Ups\Api\Normalizer\RateResultChargeDetailNormalizer::class, + + \ShipStream\Ups\Api\Model\RateResultTaxCharges::class => \ShipStream\Ups\Api\Normalizer\RateResultTaxChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class => \ShipStream\Ups\Api\Normalizer\PickupRateResponseWeekendServiceTerritoryNormalizer::class, + + \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPCancelRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPCancelResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCancelRequest::class => \ShipStream\Ups\Api\Normalizer\PickupCancelRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupCancelRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCancelResponse::class => \ShipStream\Ups\Api\Normalizer\PickupCancelResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupCancelResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class => \ShipStream\Ups\Api\Normalizer\PickupCancelResponseGWNStatusNormalizer::class, + + \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPCreationRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPCreationResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationRequest::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestShipperNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipperAccount::class => \ShipStream\Ups\Api\Normalizer\ShipperAccountNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipperChargeCard::class => \ShipStream\Ups\Api\Normalizer\ShipperChargeCardNormalizer::class, + + \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class => \ShipStream\Ups\Api\Normalizer\ChargeCardCardAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestPickupDateInfoNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestPickupAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupAddressPhone::class => \ShipStream\Ups\Api\Normalizer\PickupAddressPhoneNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestPickupPieceNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestTotalWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestTrackingDataNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestTrackingDataWithReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestFreightOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\FreightOptionsShipmentServiceOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class => \ShipStream\Ups\Api\Normalizer\FreightOptionsDestinationAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class => \ShipStream\Ups\Api\Normalizer\FreightOptionsShipmentDetailNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentDetailPalletInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\PalletInformationDimensions::class => \ShipStream\Ups\Api\Normalizer\PalletInformationDimensionsNormalizer::class, + + \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DimensionsUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationResponse::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseWeekendServiceTerritoryNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseRateStatusNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseRateResultNormalizer::class, + + \ShipStream\Ups\Api\Model\RateResultDisclaimer::class => \ShipStream\Ups\Api\Normalizer\RateResultDisclaimerNormalizer::class, + + \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPPolDivRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPPolDivResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class => \ShipStream\Ups\Api\Normalizer\PickupGetPoliticalDivision1ListRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupGetPoliticalDivision1ListRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class => \ShipStream\Ups\Api\Normalizer\PickupGetPoliticalDivision1ListResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupGetPoliticalDivision1ListResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPServCenterRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPServCenterResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestPickupPieceNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestOriginAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class => \ShipStream\Ups\Api\Normalizer\OriginAddressOriginSearchCriteriaNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestDestinationAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer::class, + + \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class => \ShipStream\Ups\Api\Normalizer\ServiceCenterLocationDropOffFacilitiesNormalizer::class, + + \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class => \ShipStream\Ups\Api\Normalizer\DropOffFacilitiesAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class => \ShipStream\Ups\Api\Normalizer\DropOffFacilitiesFacilityTimeNormalizer::class, + + \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class => \ShipStream\Ups\Api\Normalizer\FacilityTimeDayOfWeekNormalizer::class, + + \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class => \ShipStream\Ups\Api\Normalizer\DropOffFacilitiesLocalizedInstructionNormalizer::class, + + \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class => \ShipStream\Ups\Api\Normalizer\DropOffFacilitiesDistanceNormalizer::class, + + \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class => \ShipStream\Ups\Api\Normalizer\ServiceCenterLocationPickupFacilitiesNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class => \ShipStream\Ups\Api\Normalizer\PickupFacilitiesAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class => \ShipStream\Ups\Api\Normalizer\PickupFacilitiesFacilityTimeNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class => \ShipStream\Ups\Api\Normalizer\PickupFacilitiesFacilityTimeDayOfWeekNormalizer::class, + + \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPPendingRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPPendingResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusResponsePendingStatusNormalizer::class, + + \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PRENOTIFICATIONRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PRENOTIFICATIONResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\PreNotificationRequest::class => \ShipStream\Ups\Api\Normalizer\PreNotificationRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PreNotificationRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class => \ShipStream\Ups\Api\Normalizer\PreNotificationRequestShipmentNormalizer::class, + + \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class => \ShipStream\Ups\Api\Normalizer\PreNotificationShipmentShipToAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\PreNotificationShipmentShipFromAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class => \ShipStream\Ups\Api\Normalizer\PreNotificationShipmentPackageNormalizer::class, + + \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class => \ShipStream\Ups\Api\Normalizer\PreNotificationPackageChemicalRecordNormalizer::class, + + \ShipStream\Ups\Api\Model\PreNotificationResponse::class => \ShipStream\Ups\Api\Normalizer\PreNotificationResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PreNotificationResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\QUANTUMVIEWRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\QUANTUMVIEWResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\QuantumViewRequest::class => \ShipStream\Ups\Api\Normalizer\QuantumViewRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class => \ShipStream\Ups\Api\Normalizer\QuantumViewRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class => \ShipStream\Ups\Api\Normalizer\QuantumViewRequestSubscriptionRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class => \ShipStream\Ups\Api\Normalizer\SubscriptionRequestDateTimeRangeNormalizer::class, + + \ShipStream\Ups\Api\Model\QuantumViewResponse::class => \ShipStream\Ups\Api\Normalizer\QuantumViewResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class => \ShipStream\Ups\Api\Normalizer\QuantumViewResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class => \ShipStream\Ups\Api\Normalizer\QuantumViewResponseQuantumViewEventsNormalizer::class, + + \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class => \ShipStream\Ups\Api\Normalizer\QuantumViewEventsSubscriptionEventsNormalizer::class, + + \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class => \ShipStream\Ups\Api\Normalizer\SubscriptionEventsSubscriptionStatusNormalizer::class, + + \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class => \ShipStream\Ups\Api\Normalizer\SubscriptionEventsDateRangeNormalizer::class, + + \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class => \ShipStream\Ups\Api\Normalizer\SubscriptionEventsSubscriptionFileNormalizer::class, + + \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileStatusTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileManifestNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestShipper::class => \ShipStream\Ups\Api\Normalizer\ManifestShipperNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestShipperAddress::class => \ShipStream\Ups\Api\Normalizer\ManifestShipperAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestShipTo::class => \ShipStream\Ups\Api\Normalizer\ManifestShipToNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestShipToAddress::class => \ShipStream\Ups\Api\Normalizer\ManifestShipToAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ManifestReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestService::class => \ShipStream\Ups\Api\Normalizer\ManifestServiceNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestPackage::class => \ShipStream\Ups\Api\Normalizer\ManifestPackageNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageActivity::class => \ShipStream\Ups\Api\Normalizer\PackageActivityNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class => \ShipStream\Ups\Api\Normalizer\ManifestPackageDimensionsNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class => \ShipStream\Ups\Api\Normalizer\PackageDimensionalWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DimensionalWeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class => \ShipStream\Ups\Api\Normalizer\ManifestPackagePackageWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ManifestPackageReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class => \ShipStream\Ups\Api\Normalizer\ManifestPackagePackageServiceOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class => \ShipStream\Ups\Api\Normalizer\ManifestPackageServiceOptionsCODNormalizer::class, + + \ShipStream\Ups\Api\Model\CODCODAmount::class => \ShipStream\Ups\Api\Normalizer\CODCODAmountNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsInsuredValueNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\ManifestShipmentServiceOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsCallTagARSNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestCustomsValue::class => \ShipStream\Ups\Api\Normalizer\ManifestCustomsValueNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestBillToAccount::class => \ShipStream\Ups\Api\Normalizer\ManifestBillToAccountNormalizer::class, + + \ShipStream\Ups\Api\Model\ManifestUAPAddress::class => \ShipStream\Ups\Api\Normalizer\ManifestUAPAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\UAPAddressAddress::class => \ShipStream\Ups\Api\Normalizer\UAPAddressAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileOriginNormalizer::class, + + \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\OriginPackageReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\OriginShipmentReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\OriginActivityLocation::class => \ShipStream\Ups\Api\Normalizer\OriginActivityLocationNormalizer::class, + + \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class => \ShipStream\Ups\Api\Normalizer\ActivityLocationAddressArtifactFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\OriginBillToAccount::class => \ShipStream\Ups\Api\Normalizer\OriginBillToAccountNormalizer::class, + + \ShipStream\Ups\Api\Model\SubscriptionFileException::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileExceptionNormalizer::class, + + \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ExceptionPackageReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ExceptionShipmentReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class => \ShipStream\Ups\Api\Normalizer\ExceptionUpdatedAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class => \ShipStream\Ups\Api\Normalizer\UpdatedAddressAddressExtendedInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\ExceptionResolution::class => \ShipStream\Ups\Api\Normalizer\ExceptionResolutionNormalizer::class, + + \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class => \ShipStream\Ups\Api\Normalizer\ExceptionActivityLocationNormalizer::class, + + \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class => \ShipStream\Ups\Api\Normalizer\ExceptionBillToAccountNormalizer::class, + + \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileDeliveryNormalizer::class, + + \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\DeliveryPackageReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\DeliveryShipmentReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class => \ShipStream\Ups\Api\Normalizer\DeliveryActivityLocationNormalizer::class, + + \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class => \ShipStream\Ups\Api\Normalizer\DeliveryDeliveryLocationNormalizer::class, + + \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class => \ShipStream\Ups\Api\Normalizer\DeliveryLocationAddressArtifactFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class => \ShipStream\Ups\Api\Normalizer\AddressArtifactFormatAddressExtendedInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\DeliveryCOD::class => \ShipStream\Ups\Api\Normalizer\DeliveryCODNormalizer::class, + + \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class => \ShipStream\Ups\Api\Normalizer\DeliveryBillToAccountNormalizer::class, + + \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileGenericNormalizer::class, + + \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\GenericShipmentReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\GenericPackageReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\GenericService::class => \ShipStream\Ups\Api\Normalizer\GenericServiceNormalizer::class, + + \ShipStream\Ups\Api\Model\GenericActivity::class => \ShipStream\Ups\Api\Normalizer\GenericActivityNormalizer::class, + + \ShipStream\Ups\Api\Model\GenericBillToAccount::class => \ShipStream\Ups\Api\Normalizer\GenericBillToAccountNormalizer::class, + + \ShipStream\Ups\Api\Model\GenericShipTo::class => \ShipStream\Ups\Api\Normalizer\GenericShipToNormalizer::class, + + \ShipStream\Ups\Api\Model\GenericFailureNotification::class => \ShipStream\Ups\Api\Normalizer\GenericFailureNotificationNormalizer::class, + + \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class => \ShipStream\Ups\Api\Normalizer\FailureNotificationFailureNotificationCodeNormalizer::class, + + \ShipStream\Ups\Api\Model\RATERequestWrapper::class => \ShipStream\Ups\Api\Normalizer\RATERequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\RATEResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\RATEResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\RateRequest::class => \ShipStream\Ups\Api\Normalizer\RateRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\RateRequestRequest::class => \ShipStream\Ups\Api\Normalizer\RateRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\RateRequestPickupType::class => \ShipStream\Ups\Api\Normalizer\RateRequestPickupTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class => \ShipStream\Ups\Api\Normalizer\RateRequestCustomerClassificationNormalizer::class, + + \ShipStream\Ups\Api\Model\RateRequestShipment::class => \ShipStream\Ups\Api\Normalizer\RateRequestShipmentNormalizer::class, + + \ShipStream\Ups\Api\Model\RateShipmentShipper::class => \ShipStream\Ups\Api\Normalizer\RateShipmentShipperNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipperAddress::class => \ShipStream\Ups\Api\Normalizer\ShipperAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\RateShipmentShipTo::class => \ShipStream\Ups\Api\Normalizer\RateShipmentShipToNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipToAddress::class => \ShipStream\Ups\Api\Normalizer\ShipToAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class => \ShipStream\Ups\Api\Normalizer\RateShipmentShipFromNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\ShipFromAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class => \ShipStream\Ups\Api\Normalizer\RateShipmentAlternateDeliveryAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class => \ShipStream\Ups\Api\Normalizer\RateAlternateDeliveryAddressAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipmentIndicationTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class => \ShipStream\Ups\Api\Normalizer\ShipmentPaymentDetailsNormalizer::class, + + \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class => \ShipStream\Ups\Api\Normalizer\PaymentDetailsShipmentChargeNormalizer::class, + + \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class => \ShipStream\Ups\Api\Normalizer\RateShipmentChargeBillShipperNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargeBillReceiverNormalizer::class, + + \ShipStream\Ups\Api\Model\BillReceiverAddress::class => \ShipStream\Ups\Api\Normalizer\BillReceiverAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class => \ShipStream\Ups\Api\Normalizer\RateShipmentChargeBillThirdPartyNormalizer::class, + + \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class => \ShipStream\Ups\Api\Normalizer\RateBillThirdPartyAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\RateShipmentFRSPaymentInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class => \ShipStream\Ups\Api\Normalizer\FRSPaymentInformationTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class => \ShipStream\Ups\Api\Normalizer\FRSPaymentInformationAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentFreightShipmentInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class => \ShipStream\Ups\Api\Normalizer\FreightShipmentInformationFreightDensityInfoNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class => \ShipStream\Ups\Api\Normalizer\FreightDensityInfoAdjustedHeightNormalizer::class, + + \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\AdjustedHeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\FreightDensityInfoHandlingUnitsNormalizer::class, + + \ShipStream\Ups\Api\Model\HandlingUnitsType::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitsTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitsDimensionsNormalizer::class, + + \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitsUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipmentTotalWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\ShipmentTotalWeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\RateShipmentPackage::class => \ShipStream\Ups\Api\Normalizer\RateShipmentPackageNormalizer::class, + + \ShipStream\Ups\Api\Model\PackagePackagingType::class => \ShipStream\Ups\Api\Normalizer\PackagePackagingTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageDimensions::class => \ShipStream\Ups\Api\Normalizer\PackageDimensionsNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageDimWeight::class => \ShipStream\Ups\Api\Normalizer\PackageDimWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DimWeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageCommodity::class => \ShipStream\Ups\Api\Normalizer\PackageCommodityNormalizer::class, + + \ShipStream\Ups\Api\Model\CommodityNMFC::class => \ShipStream\Ups\Api\Normalizer\CommodityNMFCNormalizer::class, + + \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class => \ShipStream\Ups\Api\Normalizer\RatePackagePackageServiceOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class => \ShipStream\Ups\Api\Normalizer\RatePackageServiceOptionsDeliveryConfirmationNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsAccessPointCODNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsCODNormalizer::class, + + \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\RatePackageServiceOptionsDeclaredValueNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsShipperDeclaredValueNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsInsuranceNormalizer::class, + + \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class => \ShipStream\Ups\Api\Normalizer\InsuranceBasicFlexibleParcelIndicatorNormalizer::class, + + \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class => \ShipStream\Ups\Api\Normalizer\InsuranceExtendedFlexibleParcelIndicatorNormalizer::class, + + \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class => \ShipStream\Ups\Api\Normalizer\InsuranceTimeInTransitFlexibleParcelIndicatorNormalizer::class, + + \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class => \ShipStream\Ups\Api\Normalizer\RatePackageServiceOptionsHazMatNormalizer::class, + + \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class => \ShipStream\Ups\Api\Normalizer\HazMatHazMatChemicalRecordNormalizer::class, + + \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class => \ShipStream\Ups\Api\Normalizer\RatePackageServiceOptionsDryIceNormalizer::class, + + \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class => \ShipStream\Ups\Api\Normalizer\DryIceDryIceWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DryIceWeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageSimpleRate::class => \ShipStream\Ups\Api\Normalizer\PackageSimpleRateNormalizer::class, + + \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class => \ShipStream\Ups\Api\Normalizer\RatePackageUPSPremierNormalizer::class, + + \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\RateShipmentShipmentServiceOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsAccessPointCODNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsCODNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsCODCODAmountNormalizer::class, + + \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class => \ShipStream\Ups\Api\Normalizer\RateShipmentServiceOptionsDeliveryConfirmationNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsPickupOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsDeliveryOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class => \ShipStream\Ups\Api\Normalizer\RateShipmentServiceOptionsRestrictedArticlesNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsImportControlNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsReturnServiceNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipmentRatingOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class => \ShipStream\Ups\Api\Normalizer\ShipmentInvoiceLineTotalNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentPromotionalDiscountInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentDeliveryTimeInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class => \ShipStream\Ups\Api\Normalizer\DeliveryTimeInformationPickupNormalizer::class, + + \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class => \ShipStream\Ups\Api\Normalizer\DeliveryTimeInformationReturnContractServicesNormalizer::class, + + \ShipStream\Ups\Api\Model\RateResponse::class => \ShipStream\Ups\Api\Normalizer\RateResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\RateResponseResponse::class => \ShipStream\Ups\Api\Normalizer\RateResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class => \ShipStream\Ups\Api\Normalizer\RateResponseRatedShipmentNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentDisclaimerNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentService::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentServiceNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentRatedShipmentAlertNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentBillingWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\BillingWeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTransportationChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentBaseServiceChargeNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentItemizedChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentFRSShipmentDataNormalizer::class, + + \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class => \ShipStream\Ups\Api\Normalizer\FRSShipmentDataTransportationChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class => \ShipStream\Ups\Api\Normalizer\TransportationChargesGrossChargeNormalizer::class, + + \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class => \ShipStream\Ups\Api\Normalizer\TransportationChargesDiscountAmountNormalizer::class, + + \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class => \ShipStream\Ups\Api\Normalizer\TransportationChargesNetChargeNormalizer::class, + + \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class => \ShipStream\Ups\Api\Normalizer\FRSShipmentDataFreightDensityRateNormalizer::class, + + \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\FRSShipmentDataHandlingUnitsNormalizer::class, + + \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitsAdjustedHeightNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class => \ShipStream\Ups\Api\Normalizer\RatedPackageBaseServiceChargeNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentServiceOptionsChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTaxChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTotalChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTotalChargesWithTaxesNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentNegotiatedRateChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\NegotiatedRateChargesItemizedChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class => \ShipStream\Ups\Api\Normalizer\NegotiatedRateChargesTaxChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class => \ShipStream\Ups\Api\Normalizer\NegotiatedRateChargesTotalChargeNormalizer::class, + + \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class => \ShipStream\Ups\Api\Normalizer\NegotiatedRateChargesTotalChargesWithTaxesNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentRatedPackageNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageTransportationChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageServiceOptionsChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageTotalChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class => \ShipStream\Ups\Api\Normalizer\RatedPackageBillingWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\RatedPackageBillingWeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class => \ShipStream\Ups\Api\Normalizer\RatedPackageAccessorialNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageItemizedChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class => \ShipStream\Ups\Api\Normalizer\RatedPackageRateModifierNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageNegotiatedChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\NegotiatedChargesItemizedChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class => \ShipStream\Ups\Api\Normalizer\RatedPackageSimpleRateNormalizer::class, + + \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTimeInTransitNormalizer::class, + + \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class => \ShipStream\Ups\Api\Normalizer\TimeInTransitServiceSummaryNormalizer::class, + + \ShipStream\Ups\Api\Model\ServiceSummaryService::class => \ShipStream\Ups\Api\Normalizer\ServiceSummaryServiceNormalizer::class, + + \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class => \ShipStream\Ups\Api\Normalizer\ServiceSummaryEstimatedArrivalNormalizer::class, + + \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class => \ShipStream\Ups\Api\Normalizer\EstimatedArrivalArrivalNormalizer::class, + + \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class => \ShipStream\Ups\Api\Normalizer\EstimatedArrivalPickupNormalizer::class, + + \ShipStream\Ups\Api\Model\SHIPRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\SHIPRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\SHIPResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\SHIPResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentRequest::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestShipmentNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentReturnService::class => \ShipStream\Ups\Api\Normalizer\ShipmentReturnServiceNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentShipper::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipperNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipperPhone::class => \ShipStream\Ups\Api\Normalizer\ShipperPhoneNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentShipTo::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipToNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipToPhone::class => \ShipStream\Ups\Api\Normalizer\ShipToPhoneNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class => \ShipStream\Ups\Api\Normalizer\ShipmentAlternateDeliveryAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class => \ShipStream\Ups\Api\Normalizer\AlternateDeliveryAddressAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentShipFrom::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipFromNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class => \ShipStream\Ups\Api\Normalizer\ShipFromTaxIDTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipFromPhone::class => \ShipStream\Ups\Api\Normalizer\ShipFromPhoneNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class => \ShipStream\Ups\Api\Normalizer\ShipFromVendorInfoNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentPaymentInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class => \ShipStream\Ups\Api\Normalizer\PaymentInformationShipmentChargeNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargeBillShipperNormalizer::class, + + \ShipStream\Ups\Api\Model\BillShipperCreditCard::class => \ShipStream\Ups\Api\Normalizer\BillShipperCreditCardNormalizer::class, + + \ShipStream\Ups\Api\Model\CreditCardAddress::class => \ShipStream\Ups\Api\Normalizer\CreditCardAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargeBillThirdPartyNormalizer::class, + + \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class => \ShipStream\Ups\Api\Normalizer\BillThirdPartyAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentFRSPaymentInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class => \ShipStream\Ups\Api\Normalizer\ShipmentDGSignatoryInfoNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ShipmentReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipmentServiceOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsNotificationNormalizer::class, + + \ShipStream\Ups\Api\Model\NotificationEMail::class => \ShipStream\Ups\Api\Normalizer\NotificationEMailNormalizer::class, + + \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class => \ShipStream\Ups\Api\Normalizer\NotificationVoiceMessageNormalizer::class, + + \ShipStream\Ups\Api\Model\NotificationTextMessage::class => \ShipStream\Ups\Api\Normalizer\NotificationTextMessageNormalizer::class, + + \ShipStream\Ups\Api\Model\NotificationLocale::class => \ShipStream\Ups\Api\Normalizer\NotificationLocaleNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsLabelDeliveryNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class => \ShipStream\Ups\Api\Normalizer\LabelDeliveryEMailNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsInternationalFormsNormalizer::class, + + \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsUserCreatedFormNormalizer::class, + + \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsUPSPremiumCareFormNormalizer::class, + + \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class => \ShipStream\Ups\Api\Normalizer\UPSPremiumCareFormLanguageForUPSPremiumCareNormalizer::class, + + \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsCN22FormNormalizer::class, + + \ShipStream\Ups\Api\Model\CN22FormCN22Content::class => \ShipStream\Ups\Api\Normalizer\CN22FormCN22ContentNormalizer::class, + + \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class => \ShipStream\Ups\Api\Normalizer\CN22ContentCN22ContentWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\CN22ContentWeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsEEIFilingOptionNormalizer::class, + + \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class => \ShipStream\Ups\Api\Normalizer\EEIFilingOptionUPSFiledNormalizer::class, + + \ShipStream\Ups\Api\Model\UPSFiledPOA::class => \ShipStream\Ups\Api\Normalizer\UPSFiledPOANormalizer::class, + + \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class => \ShipStream\Ups\Api\Normalizer\EEIFilingOptionShipperFiledNormalizer::class, + + \ShipStream\Ups\Api\Model\InternationalFormsContacts::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsContactsNormalizer::class, + + \ShipStream\Ups\Api\Model\ContactsForwardAgent::class => \ShipStream\Ups\Api\Normalizer\ContactsForwardAgentNormalizer::class, + + \ShipStream\Ups\Api\Model\ForwardAgentAddress::class => \ShipStream\Ups\Api\Normalizer\ForwardAgentAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class => \ShipStream\Ups\Api\Normalizer\ContactsUltimateConsigneeNormalizer::class, + + \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class => \ShipStream\Ups\Api\Normalizer\UltimateConsigneeAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class => \ShipStream\Ups\Api\Normalizer\UltimateConsigneeUltimateConsigneeTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class => \ShipStream\Ups\Api\Normalizer\ContactsIntermediateConsigneeNormalizer::class, + + \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class => \ShipStream\Ups\Api\Normalizer\IntermediateConsigneeAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\ContactsProducer::class => \ShipStream\Ups\Api\Normalizer\ContactsProducerNormalizer::class, + + \ShipStream\Ups\Api\Model\ProducerAddress::class => \ShipStream\Ups\Api\Normalizer\ProducerAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\ProducerPhone::class => \ShipStream\Ups\Api\Normalizer\ProducerPhoneNormalizer::class, + + \ShipStream\Ups\Api\Model\ContactsSoldTo::class => \ShipStream\Ups\Api\Normalizer\ContactsSoldToNormalizer::class, + + \ShipStream\Ups\Api\Model\SoldToPhone::class => \ShipStream\Ups\Api\Normalizer\SoldToPhoneNormalizer::class, + + \ShipStream\Ups\Api\Model\SoldToAddress::class => \ShipStream\Ups\Api\Normalizer\SoldToAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\InternationalFormsProduct::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsProductNormalizer::class, + + \ShipStream\Ups\Api\Model\ProductUnit::class => \ShipStream\Ups\Api\Normalizer\ProductUnitNormalizer::class, + + \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\UnitUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class => \ShipStream\Ups\Api\Normalizer\ProductNetCostDateRangeNormalizer::class, + + \ShipStream\Ups\Api\Model\ProductProductWeight::class => \ShipStream\Ups\Api\Normalizer\ProductProductWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\ProductWeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\ProductScheduleB::class => \ShipStream\Ups\Api\Normalizer\ProductScheduleBNormalizer::class, + + \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\ScheduleBUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class => \ShipStream\Ups\Api\Normalizer\ProductExcludeFromFormNormalizer::class, + + \ShipStream\Ups\Api\Model\ProductPackingListInfo::class => \ShipStream\Ups\Api\Normalizer\ProductPackingListInfoNormalizer::class, + + \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class => \ShipStream\Ups\Api\Normalizer\PackingListInfoPackageAssociatedNormalizer::class, + + \ShipStream\Ups\Api\Model\ProductEEIInformation::class => \ShipStream\Ups\Api\Normalizer\ProductEEIInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\EEIInformationLicense::class => \ShipStream\Ups\Api\Normalizer\EEIInformationLicenseNormalizer::class, + + \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class => \ShipStream\Ups\Api\Normalizer\EEIInformationDDTCInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DDTCInformationUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsDiscountNormalizer::class, + + \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsFreightChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsInsuranceChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsOtherChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsBlanketPeriodNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsDeliveryConfirmationNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsLabelMethodNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsPreAlertNotificationNormalizer::class, + + \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class => \ShipStream\Ups\Api\Normalizer\PreAlertNotificationEMailMessageNormalizer::class, + + \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class => \ShipStream\Ups\Api\Normalizer\PreAlertNotificationVoiceMessageNormalizer::class, + + \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class => \ShipStream\Ups\Api\Normalizer\PreAlertNotificationTextMessageNormalizer::class, + + \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class => \ShipStream\Ups\Api\Normalizer\PreAlertNotificationLocaleNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsRestrictedArticlesNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentPackage::class => \ShipStream\Ups\Api\Normalizer\ShipmentPackageNormalizer::class, + + \ShipStream\Ups\Api\Model\PackagePackaging::class => \ShipStream\Ups\Api\Normalizer\PackagePackagingNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\PackageReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageUPSPremier::class => \ShipStream\Ups\Api\Normalizer\PackageUPSPremierNormalizer::class, + + \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class => \ShipStream\Ups\Api\Normalizer\UPSPremierHandlingInstructionsNormalizer::class, + + \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class => \ShipStream\Ups\Api\Normalizer\PackagePackageServiceOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsDeliveryConfirmationNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsDeclaredValueNormalizer::class, + + \ShipStream\Ups\Api\Model\DeclaredValueType::class => \ShipStream\Ups\Api\Normalizer\DeclaredValueTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsCODCODAmountNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsNotificationNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsNotificationEMailNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsHazMatNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsDryIceNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class => \ShipStream\Ups\Api\Normalizer\PackageHazMatPackageInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestLabelSpecificationNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\LabelSpecificationLabelImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class => \ShipStream\Ups\Api\Normalizer\LabelSpecificationLabelStockSizeNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class => \ShipStream\Ups\Api\Normalizer\LabelSpecificationInstructionNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestReceiptSpecificationNormalizer::class, + + \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class => \ShipStream\Ups\Api\Normalizer\ReceiptSpecificationImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResponse::class => \ShipStream\Ups\Api\Normalizer\ShipmentResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class => \ShipStream\Ups\Api\Normalizer\ShipmentResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class => \ShipStream\Ups\Api\Normalizer\ShipmentResponseShipmentResultsNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsDisclaimerNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsShipmentChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesBaseServiceChargeNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesTransportationChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesItemizedChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesServiceOptionsChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesTaxChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesTotalChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesTotalChargesWithTaxesNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsNegotiatedRateChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsFRSShipmentDataNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsBillingWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsPackageResultsNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class => \ShipStream\Ups\Api\Normalizer\PackageResultsBaseServiceChargeNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class => \ShipStream\Ups\Api\Normalizer\PackageResultsServiceOptionsChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class => \ShipStream\Ups\Api\Normalizer\PackageResultsShippingLabelNormalizer::class, + + \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\ShippingLabelImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class => \ShipStream\Ups\Api\Normalizer\PackageResultsShippingReceiptNormalizer::class, + + \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class => \ShipStream\Ups\Api\Normalizer\ShippingReceiptImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class => \ShipStream\Ups\Api\Normalizer\PackageResultsAccessorialNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class => \ShipStream\Ups\Api\Normalizer\PackageResultsSimpleRateNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageResultsForm::class => \ShipStream\Ups\Api\Normalizer\PackageResultsFormNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsFormImageNormalizer::class, + + \ShipStream\Ups\Api\Model\FormImage::class => \ShipStream\Ups\Api\Normalizer\FormImageNormalizer::class, + + \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\HighValueReportImageImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\CODTurnInPageImageImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsImageImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\ImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\ImageImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\PackageResultsItemizedChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class => \ShipStream\Ups\Api\Normalizer\PackageResultsNegotiatedChargesNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class => \ShipStream\Ups\Api\Normalizer\PackageResultsRateModifierNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsControlLogReceiptNormalizer::class, + + \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class => \ShipStream\Ups\Api\Normalizer\ControlLogReceiptImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsForm::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsFormNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsCODTurnInPageNormalizer::class, + + \ShipStream\Ups\Api\Model\CODTurnInPageImage::class => \ShipStream\Ups\Api\Normalizer\CODTurnInPageImageNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsHighValueReportNormalizer::class, + + \ShipStream\Ups\Api\Model\HighValueReportImage::class => \ShipStream\Ups\Api\Normalizer\HighValueReportImageNormalizer::class, + + \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\VOIDSHIPMENTRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\VOIDSHIPMENTResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\VoidShipmentRequest::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class => \ShipStream\Ups\Api\Normalizer\VoidRequestTransactionReferenceNormalizer::class, + + \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentRequestVoidShipmentNormalizer::class, + + \ShipStream\Ups\Api\Model\VoidShipmentResponse::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class => \ShipStream\Ups\Api\Normalizer\VoidResponseResponseStatusNormalizer::class, + + \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class => \ShipStream\Ups\Api\Normalizer\VoidResponseTransactionReferenceNormalizer::class, + + \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentResponseSummaryResultNormalizer::class, + + \ShipStream\Ups\Api\Model\SummaryResultStatus::class => \ShipStream\Ups\Api\Normalizer\SummaryResultStatusNormalizer::class, + + \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentResponsePackageLevelResultNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class => \ShipStream\Ups\Api\Normalizer\PackageLevelResultStatusNormalizer::class, + + \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\LABELRECOVERYRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\LABELRECOVERYResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class => \ShipStream\Ups\Api\Normalizer\LRRequestTransactionReferenceNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestLabelSpecificationNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryLabelSpecificationLabelImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryLabelSpecificationLabelStockSizeNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestTranslateNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestLabelDeliveryNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestReferenceValuesNormalizer::class, + + \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ReferenceValuesReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestUPSPremiumCareFormNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class => \ShipStream\Ups\Api\Normalizer\LRResponseResponseStatusNormalizer::class, + + \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class => \ShipStream\Ups\Api\Normalizer\LRResponseTransactionReferenceNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseLabelResultsNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class => \ShipStream\Ups\Api\Normalizer\LabelResultsLabelImageNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\LabelImageLabelImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class => \ShipStream\Ups\Api\Normalizer\LabelResultsMailInnovationsLabelImageNormalizer::class, + + \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\MailInnovationsLabelImageLabelImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelResultsReceipt::class => \ShipStream\Ups\Api\Normalizer\LabelResultsReceiptNormalizer::class, + + \ShipStream\Ups\Api\Model\ReceiptImage::class => \ShipStream\Ups\Api\Normalizer\ReceiptImageNormalizer::class, + + \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\ReceiptImageImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelResultsForm::class => \ShipStream\Ups\Api\Normalizer\LabelResultsFormNormalizer::class, + + \ShipStream\Ups\Api\Model\LRFormImage::class => \ShipStream\Ups\Api\Normalizer\LRFormImageNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseCODTurnInPageNormalizer::class, + + \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class => \ShipStream\Ups\Api\Normalizer\LRCODTurnInPageImageNormalizer::class, + + \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\LRCODTurnInPageImageImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseFormNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryFormImageNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryImageImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseHighValueReportNormalizer::class, + + \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseTrackingCandidateNormalizer::class, + + \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class => \ShipStream\Ups\Api\Normalizer\TrackingCandidatePickupDateRangeNormalizer::class, + + \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTPICKUPRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTPICKUPResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightPickupRequest::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestRequesterNormalizer::class, + + \ShipStream\Ups\Api\Model\RequesterPhone::class => \ShipStream\Ups\Api\Normalizer\RequesterPhoneNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestShipFromNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestShipToNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class => \ShipStream\Ups\Api\Normalizer\FreightPickupShipToAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestShipmentServiceOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestShipmentDetailNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class => \ShipStream\Ups\Api\Normalizer\ShipmentDetailPackagingTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentDetailWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\WeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestExistingShipmentIDNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestPOMNormalizer::class, + + \ShipStream\Ups\Api\Model\POMPickupNotifications::class => \ShipStream\Ups\Api\Normalizer\POMPickupNotificationsNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class => \ShipStream\Ups\Api\Normalizer\PickupNotificationsEMailNotificationNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightPickupResponse::class => \ShipStream\Ups\Api\Normalizer\FreightPickupResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class => \ShipStream\Ups\Api\Normalizer\FreightPickupResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTPICKUPCANCELRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTPICKUPCANCELResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class => \ShipStream\Ups\Api\Normalizer\FreightCancelPickupRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class => \ShipStream\Ups\Api\Normalizer\FreightCancelPickupRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class => \ShipStream\Ups\Api\Normalizer\FreightCancelPickupResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class => \ShipStream\Ups\Api\Normalizer\FreightCancelPickupResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightCancelStatus::class => \ShipStream\Ups\Api\Normalizer\FreightCancelStatusNormalizer::class, + + \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTRATERequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTRATEResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequest::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestShipFromNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\FreightRateShipFromAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestShipToNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class => \ShipStream\Ups\Api\Normalizer\FreightRateShipToAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestPaymentInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class => \ShipStream\Ups\Api\Normalizer\FreightRatePaymentInformationPayerNormalizer::class, + + \ShipStream\Ups\Api\Model\PayerAddress::class => \ShipStream\Ups\Api\Normalizer\PayerAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class => \ShipStream\Ups\Api\Normalizer\PaymentInformationShipmentBillingOptionNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestService::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestServiceNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestHandlingUnitOneNormalizer::class, + + \ShipStream\Ups\Api\Model\HandlingUnitOneType::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitOneTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestHandlingUnitTwoNormalizer::class, + + \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitTwoTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestCommodityNormalizer::class, + + \ShipStream\Ups\Api\Model\CommodityWeight::class => \ShipStream\Ups\Api\Normalizer\CommodityWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class => \ShipStream\Ups\Api\Normalizer\CommodityAdjustedWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\AdjustedWeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\CommodityDimensions::class => \ShipStream\Ups\Api\Normalizer\CommodityDimensionsNormalizer::class, + + \ShipStream\Ups\Api\Model\CommodityPackagingType::class => \ShipStream\Ups\Api\Normalizer\CommodityPackagingTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\CommodityCommodityValue::class => \ShipStream\Ups\Api\Normalizer\CommodityCommodityValueNormalizer::class, + + \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class => \ShipStream\Ups\Api\Normalizer\CommodityNMFCCommodityNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestShipmentServiceOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class => \ShipStream\Ups\Api\Normalizer\FreightShipmentServiceOptionsPickupOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class => \ShipStream\Ups\Api\Normalizer\FreightShipmentServiceOptionsDeliveryOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsOverSeasLegNormalizer::class, + + \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class => \ShipStream\Ups\Api\Normalizer\OverSeasLegDimensionsNormalizer::class, + + \ShipStream\Ups\Api\Model\OverSeasLegValue::class => \ShipStream\Ups\Api\Normalizer\OverSeasLegValueNormalizer::class, + + \ShipStream\Ups\Api\Model\ValueCube::class => \ShipStream\Ups\Api\Normalizer\ValueCubeNormalizer::class, + + \ShipStream\Ups\Api\Model\ValueCWT::class => \ShipStream\Ups\Api\Normalizer\ValueCWTNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class => \ShipStream\Ups\Api\Normalizer\FreightShipmentServiceOptionsCODNormalizer::class, + + \ShipStream\Ups\Api\Model\CODCODValue::class => \ShipStream\Ups\Api\Normalizer\CODCODValueNormalizer::class, + + \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class => \ShipStream\Ups\Api\Normalizer\CODCODPaymentMethodNormalizer::class, + + \ShipStream\Ups\Api\Model\CODCODBillingOption::class => \ShipStream\Ups\Api\Normalizer\CODCODBillingOptionNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class => \ShipStream\Ups\Api\Normalizer\FreightRateCODRemitToNormalizer::class, + + \ShipStream\Ups\Api\Model\RemitToAddress::class => \ShipStream\Ups\Api\Normalizer\RemitToAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsDangerousGoodsNormalizer::class, + + \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class => \ShipStream\Ups\Api\Normalizer\DangerousGoodsPhoneNormalizer::class, + + \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class => \ShipStream\Ups\Api\Normalizer\DangerousGoodsTransportationModeNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsSortingAndSegregatingNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsExcessDeclaredValueNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsHandlingChargeNormalizer::class, + + \ShipStream\Ups\Api\Model\HandlingChargeAmount::class => \ShipStream\Ups\Api\Normalizer\HandlingChargeAmountNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsAdjustedHeightNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestPickupRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestAlternateRateOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestGFPOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class => \ShipStream\Ups\Api\Normalizer\GFPOptionsOnCallInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestHandlingUnitWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitWeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestHandlingUnitsNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateResponse::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateResponseRate::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseRateNormalizer::class, + + \ShipStream\Ups\Api\Model\RateType::class => \ShipStream\Ups\Api\Normalizer\RateTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\RateFactor::class => \ShipStream\Ups\Api\Normalizer\RateFactorNormalizer::class, + + \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\FactorUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseFreightDensityRateNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseCommodityNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseTotalShipmentChargeNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseBillableShipmentWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\BillableShipmentWeightUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseDimensionalWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateResponseService::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseServiceNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseAlternateRatesResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseAlternateRateTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseRateNormalizer::class, + + \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseFreightDensityRateNormalizer::class, + + \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseBillableShipmentWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseTimeInTransitNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseTimeInTransitNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseHandlingUnitsNormalizer::class, + + \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTSHIPRequestWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTSHIPResponseWrapperNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipRequest::class => \ShipStream\Ups\Api\Normalizer\FreightShipRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class => \ShipStream\Ups\Api\Normalizer\FreightShipRequestRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class => \ShipStream\Ups\Api\Normalizer\FreightShipRequestShipmentNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentShipFromNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipFromAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentShipToNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipToAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentPaymentInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\PaymentInformationPayer::class => \ShipStream\Ups\Api\Normalizer\PaymentInformationPayerNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class => \ShipStream\Ups\Api\Normalizer\FreightShipPayerAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\PayerPhone::class => \ShipStream\Ups\Api\Normalizer\PayerPhoneNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class => \ShipStream\Ups\Api\Normalizer\ShipmentHandlingUnitOneNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class => \ShipStream\Ups\Api\Normalizer\ShipmentHandlingUnitTwoNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class => \ShipStream\Ups\Api\Normalizer\ShipmentExistingShipmentIDNormalizer::class, + + \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class => \ShipStream\Ups\Api\Normalizer\ExistingShipmentIDConfirmationNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\ConfirmationNumberType::class => \ShipStream\Ups\Api\Normalizer\ConfirmationNumberTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentCommodity::class => \ShipStream\Ups\Api\Normalizer\ShipmentCommodityNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class => \ShipStream\Ups\Api\Normalizer\FreightShipCommodityDimensionsNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentReference::class => \ShipStream\Ups\Api\Normalizer\ShipmentReferenceNormalizer::class, + + \ShipStream\Ups\Api\Model\ReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ReferenceNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\ReferenceWeight::class => \ShipStream\Ups\Api\Normalizer\ReferenceWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentShipmentServiceOptionsNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsEMailInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\EMailInformationEMailType::class => \ShipStream\Ups\Api\Normalizer\EMailInformationEMailTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\EMailInformationEMail::class => \ShipStream\Ups\Api\Normalizer\EMailInformationEMailNormalizer::class, + + \ShipStream\Ups\Api\Model\CODRemitTo::class => \ShipStream\Ups\Api\Normalizer\CODRemitToNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class => \ShipStream\Ups\Api\Normalizer\FreightShipRemitToAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\RemitToPhone::class => \ShipStream\Ups\Api\Normalizer\RemitToPhoneNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentServiceOptionsDangerousGoodsNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsDeclaredValueNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class => \ShipStream\Ups\Api\Normalizer\ShipmentPickupRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupRequestRequester::class => \ShipStream\Ups\Api\Normalizer\PickupRequestRequesterNormalizer::class, + + \ShipStream\Ups\Api\Model\PickupRequestPOM::class => \ShipStream\Ups\Api\Normalizer\PickupRequestPOMNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class => \ShipStream\Ups\Api\Normalizer\FreightShipPOMPickupNotificationsNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class => \ShipStream\Ups\Api\Normalizer\FreightShipPickupNotificationsEMailNotificationNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentDocuments::class => \ShipStream\Ups\Api\Normalizer\ShipmentDocumentsNormalizer::class, + + \ShipStream\Ups\Api\Model\DocumentsImage::class => \ShipStream\Ups\Api\Normalizer\DocumentsImageNormalizer::class, + + \ShipStream\Ups\Api\Model\ImageType::class => \ShipStream\Ups\Api\Normalizer\ImageTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\ImageFormat::class => \ShipStream\Ups\Api\Normalizer\ImageFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\ImagePrintFormat::class => \ShipStream\Ups\Api\Normalizer\ImagePrintFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\ImagePrintSize::class => \ShipStream\Ups\Api\Normalizer\ImagePrintSizeNormalizer::class, + + \ShipStream\Ups\Api\Model\DocumentsPackingList::class => \ShipStream\Ups\Api\Normalizer\DocumentsPackingListNormalizer::class, + + \ShipStream\Ups\Api\Model\PackingListShipFrom::class => \ShipStream\Ups\Api\Normalizer\PackingListShipFromNormalizer::class, + + \ShipStream\Ups\Api\Model\PackingListShipTo::class => \ShipStream\Ups\Api\Normalizer\PackingListShipToNormalizer::class, + + \ShipStream\Ups\Api\Model\PackingListReference::class => \ShipStream\Ups\Api\Normalizer\PackingListReferenceNormalizer::class, + + \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class => \ShipStream\Ups\Api\Normalizer\PackingListHandlingUnitNormalizer::class, + + \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitCommodityNormalizer::class, + + \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitUnitOfMeasurementNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\ShipmentHandlingUnitsNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipResponse::class => \ShipStream\Ups\Api\Normalizer\FreightShipResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class => \ShipStream\Ups\Api\Normalizer\FreightShipResponseResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class => \ShipStream\Ups\Api\Normalizer\FreightShipResponseShipmentResultsNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsRate::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsRateNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsFreightDensityRateNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsTotalShipmentChargeNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsBillableShipmentWeightNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsService::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsServiceNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsDocumentsNormalizer::class, + + \ShipStream\Ups\Api\Model\DocumentsForms::class => \ShipStream\Ups\Api\Normalizer\DocumentsFormsNormalizer::class, + + \ShipStream\Ups\Api\Model\FormsType::class => \ShipStream\Ups\Api\Normalizer\FormsTypeNormalizer::class, + + \ShipStream\Ups\Api\Model\FormsFormat::class => \ShipStream\Ups\Api\Normalizer\FormsFormatNormalizer::class, + + \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsTimeInTransitNormalizer::class, + + \ShipStream\Ups\Api\Model\TimeInTransitRequest::class => \ShipStream\Ups\Api\Normalizer\TimeInTransitRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\TimeInTransitResponse::class => \ShipStream\Ups\Api\Normalizer\TimeInTransitResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\ValidationList::class => \ShipStream\Ups\Api\Normalizer\ValidationListNormalizer::class, + + \ShipStream\Ups\Api\Model\EmsResponse::class => \ShipStream\Ups\Api\Normalizer\EmsResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\CandidateAddress::class => \ShipStream\Ups\Api\Normalizer\CandidateAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\Services::class => \ShipStream\Ups\Api\Normalizer\ServicesNormalizer::class, + + \ShipStream\Ups\Api\Model\AccessPointInformation::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\Activity::class => \ShipStream\Ups\Api\Normalizer\ActivityNormalizer::class, + + \ShipStream\Ups\Api\Model\Address::class => \ShipStream\Ups\Api\Normalizer\AddressNormalizer::class, + + \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class => \ShipStream\Ups\Api\Normalizer\AlternateTrackingNumberNormalizer::class, + + \ShipStream\Ups\Api\Model\DeliveryDate::class => \ShipStream\Ups\Api\Normalizer\DeliveryDateNormalizer::class, + + \ShipStream\Ups\Api\Model\DeliveryInformation::class => \ShipStream\Ups\Api\Normalizer\DeliveryInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\DeliveryTime::class => \ShipStream\Ups\Api\Normalizer\DeliveryTimeNormalizer::class, + + \ShipStream\Ups\Api\Model\InquireNumbers::class => \ShipStream\Ups\Api\Normalizer\InquireNumbersNormalizer::class, + + \ShipStream\Ups\Api\Model\Location::class => \ShipStream\Ups\Api\Normalizer\LocationNormalizer::class, + + \ShipStream\Ups\Api\Model\Milestones::class => \ShipStream\Ups\Api\Normalizer\MilestonesNormalizer::class, + + \ShipStream\Ups\Api\Model\Package::class => \ShipStream\Ups\Api\Normalizer\PackageNormalizer::class, + + \ShipStream\Ups\Api\Model\PackageAddress::class => \ShipStream\Ups\Api\Normalizer\PackageAddressNormalizer::class, + + \ShipStream\Ups\Api\Model\PaymentInformation::class => \ShipStream\Ups\Api\Normalizer\PaymentInformationNormalizer::class, + + \ShipStream\Ups\Api\Model\Service::class => \ShipStream\Ups\Api\Normalizer\ServiceNormalizer::class, + + \ShipStream\Ups\Api\Model\Shipment::class => \ShipStream\Ups\Api\Normalizer\ShipmentNormalizer::class, + + \ShipStream\Ups\Api\Model\Signature::class => \ShipStream\Ups\Api\Normalizer\SignatureNormalizer::class, + + \ShipStream\Ups\Api\Model\Status::class => \ShipStream\Ups\Api\Normalizer\StatusNormalizer::class, + + \ShipStream\Ups\Api\Model\SubMilestone::class => \ShipStream\Ups\Api\Normalizer\SubMilestoneNormalizer::class, + + \ShipStream\Ups\Api\Model\TrackApiResponse::class => \ShipStream\Ups\Api\Normalizer\TrackApiResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\TrackResponse::class => \ShipStream\Ups\Api\Normalizer\TrackResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\Warning::class => \ShipStream\Ups\Api\Normalizer\WarningNormalizer::class, + + \ShipStream\Ups\Api\Model\Weight::class => \ShipStream\Ups\Api\Normalizer\WeightNormalizer::class, + + \ShipStream\Ups\Api\Model\Destination::class => \ShipStream\Ups\Api\Normalizer\DestinationNormalizer::class, + + \ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class => \ShipStream\Ups\Api\Normalizer\TrackSubsServiceRequestNormalizer::class, + + \ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class => \ShipStream\Ups\Api\Normalizer\TrackSubsServiceResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class => \ShipStream\Ups\Api\Normalizer\TrackSubsServiceErrorResponseNormalizer::class, + + \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class => \ShipStream\Ups\Api\Normalizer\SecurityV1OauthTokenPostBodyNormalizer::class, + + \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class => \ShipStream\Ups\Api\Normalizer\SecurityV1OauthRefreshPostBodyNormalizer::class, + + \Jane\Component\JsonSchemaRuntime\Reference::class => \ShipStream\Ups\Api\Runtime\Normalizer\ReferenceNormalizer::class, + ], $normalizersCache = []; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - protected $normalizers = [ - - \ShipStream\Ups\Api\Model\XAVRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\XAVRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\XAVResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVRequest::class => \ShipStream\Ups\Api\Normalizer\XAVRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVRequestRequest::class => \ShipStream\Ups\Api\Normalizer\XAVRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\RequestTransactionReference::class => \ShipStream\Ups\Api\Normalizer\RequestTransactionReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\XAVRequestAddressKeyFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVResponse::class => \ShipStream\Ups\Api\Normalizer\XAVResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVResponseResponse::class => \ShipStream\Ups\Api\Normalizer\XAVResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ResponseResponseStatus::class => \ShipStream\Ups\Api\Normalizer\ResponseResponseStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\ResponseAlert::class => \ShipStream\Ups\Api\Normalizer\ResponseAlertNormalizer::class, - - \ShipStream\Ups\Api\Model\ResponseTransactionReference::class => \ShipStream\Ups\Api\Normalizer\ResponseTransactionReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class => \ShipStream\Ups\Api\Normalizer\XAVResponseAddressClassificationNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVResponseCandidate::class => \ShipStream\Ups\Api\Normalizer\XAVResponseCandidateNormalizer::class, - - \ShipStream\Ups\Api\Model\CandidateAddressClassification::class => \ShipStream\Ups\Api\Normalizer\CandidateAddressClassificationNormalizer::class, - - \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\CandidateAddressKeyFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ErrorResponse::class => \ShipStream\Ups\Api\Normalizer\ErrorResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\ErrorResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\Error::class => \ShipStream\Ups\Api\Normalizer\ErrorNormalizer::class, - - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\DANGEROUSGOODSUTILITYRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\DANGEROUSGOODSUTILITYResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataResponseChemicalDataNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class => \ShipStream\Ups\Api\Normalizer\ChemicalDataChemicalDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class => \ShipStream\Ups\Api\Normalizer\ChemicalDataProperShippingNameDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class => \ShipStream\Ups\Api\Normalizer\ChemicalDataPackageQuantityLimitDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\DANGEROUSGOODSUTILITYAPCRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\DANGEROUSGOODSUTILITYAPCResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckRequestShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckShipmentShipFromAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckShipmentShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentService::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckShipmentPackageNormalizer::class, - - \ShipStream\Ups\Api\Model\PackagePackageWeight::class => \ShipStream\Ups\Api\Normalizer\PackagePackageWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\PackageWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageChemicalRecord::class => \ShipStream\Ups\Api\Normalizer\PackageChemicalRecordNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ResponseAlertDetail::class => \ShipStream\Ups\Api\Normalizer\ResponseAlertDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class => \ShipStream\Ups\Api\Normalizer\AlertDetailElementLevelInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class => \ShipStream\Ups\Api\Normalizer\ElementLevelInformationElementIdentifierNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponseServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponsePackageResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class => \ShipStream\Ups\Api\Normalizer\PackageResultsChemicalRecordResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\LandedCostRequest::class => \ShipStream\Ups\Api\Normalizer\LandedCostRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class => \ShipStream\Ups\Api\Normalizer\LandedCostRequestShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\RequestShipmentItems::class => \ShipStream\Ups\Api\Normalizer\RequestShipmentItemsNormalizer::class, - - \ShipStream\Ups\Api\Model\LandedCostResponse::class => \ShipStream\Ups\Api\Normalizer\LandedCostResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class => \ShipStream\Ups\Api\Normalizer\LandedCostResponseShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class => \ShipStream\Ups\Api\Normalizer\LandedCostResponseShipmentPerfStatsNormalizer::class, - - \ShipStream\Ups\Api\Model\BrokerageFeeItems::class => \ShipStream\Ups\Api\Normalizer\BrokerageFeeItemsNormalizer::class, - - \ShipStream\Ups\Api\Model\ResponseShipmentItems::class => \ShipStream\Ups\Api\Normalizer\ResponseShipmentItemsNormalizer::class, - - \ShipStream\Ups\Api\Model\Errors::class => \ShipStream\Ups\Api\Normalizer\ErrorsNormalizer::class, - - \ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\LOCATORRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\LOCATORResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequest::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestRequest::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestOriginAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginAddressGeocode::class => \ShipStream\Ups\Api\Normalizer\OriginAddressGeocodeNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\OriginAddressAddressKeyFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestTranslateNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestLocationSearchCriteriaNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaSearchOptionNormalizer::class, - - \ShipStream\Ups\Api\Model\SearchOptionOptionType::class => \ShipStream\Ups\Api\Normalizer\SearchOptionOptionTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class => \ShipStream\Ups\Api\Normalizer\SearchOptionOptionCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\SearchOptionRelation::class => \ShipStream\Ups\Api\Normalizer\SearchOptionRelationNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaServiceSearchNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class => \ShipStream\Ups\Api\Normalizer\ServiceSearchServiceCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class => \ShipStream\Ups\Api\Normalizer\ServiceSearchServiceOptionCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaFreightWillCallSearchNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class => \ShipStream\Ups\Api\Normalizer\FreightWillCallSearchFacilityAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaAccessPointSearchNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class => \ShipStream\Ups\Api\Normalizer\AccessPointSearchIncludeCriteriaNormalizer::class, - - \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class => \ShipStream\Ups\Api\Normalizer\IncludeCriteriaMerchantAccountNumberListNormalizer::class, - - \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class => \ShipStream\Ups\Api\Normalizer\IncludeCriteriaSearchFilterNormalizer::class, - - \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class => \ShipStream\Ups\Api\Normalizer\IncludeCriteriaServiceOfferingListNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class => \ShipStream\Ups\Api\Normalizer\ServiceOfferingListServiceOfferingNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class => \ShipStream\Ups\Api\Normalizer\AccessPointSearchExcludeFromResultNormalizer::class, - - \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class => \ShipStream\Ups\Api\Normalizer\ExcludeFromResultPostalCodeListNormalizer::class, - - \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class => \ShipStream\Ups\Api\Normalizer\PostalCodeListPostalCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaOpenTimeCriteriaNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestSortCriteriaNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestServiceGeoUnitNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorResponse::class => \ShipStream\Ups\Api\Normalizer\LocatorResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorResponseResponse::class => \ShipStream\Ups\Api\Normalizer\LocatorResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ResponseError::class => \ShipStream\Ups\Api\Normalizer\ResponseErrorNormalizer::class, - - \ShipStream\Ups\Api\Model\ErrorErrorLocation::class => \ShipStream\Ups\Api\Normalizer\ErrorErrorLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class => \ShipStream\Ups\Api\Normalizer\LocatorResponseGeocodeNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class => \ShipStream\Ups\Api\Normalizer\LocatorResponseSearchResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class => \ShipStream\Ups\Api\Normalizer\SearchResultsGeocodeCandidateNormalizer::class, - - \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\GeocodeCandidateAddressKeyFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class => \ShipStream\Ups\Api\Normalizer\GeocodeCandidateGeocodeNormalizer::class, - - \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class => \ShipStream\Ups\Api\Normalizer\SearchResultsDropLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationIVR::class => \ShipStream\Ups\Api\Normalizer\DropLocationIVRNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationGeocode::class => \ShipStream\Ups\Api\Normalizer\DropLocationGeocodeNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\DropLocationAddressKeyFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class => \ShipStream\Ups\Api\Normalizer\DropLocationLocationAttributeNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class => \ShipStream\Ups\Api\Normalizer\LocationAttributeOptionTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class => \ShipStream\Ups\Api\Normalizer\LocationAttributeOptionCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class => \ShipStream\Ups\Api\Normalizer\OptionCodeTransportationPickUpScheduleNormalizer::class, - - \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class => \ShipStream\Ups\Api\Normalizer\TransportationPickUpSchedulePickUpNormalizer::class, - - \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class => \ShipStream\Ups\Api\Normalizer\PickUpPickUpDetailsNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationDistance::class => \ShipStream\Ups\Api\Normalizer\DropLocationDistanceNormalizer::class, - - \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DistanceUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class => \ShipStream\Ups\Api\Normalizer\DropLocationSpecialInstructionsNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class => \ShipStream\Ups\Api\Normalizer\DropLocationAdditionalCommentsNormalizer::class, - - \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class => \ShipStream\Ups\Api\Normalizer\AdditionalCommentsCommentTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class => \ShipStream\Ups\Api\Normalizer\DropLocationOperatingHoursNormalizer::class, - - \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class => \ShipStream\Ups\Api\Normalizer\OperatingHoursStandardHoursNormalizer::class, - - \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class => \ShipStream\Ups\Api\Normalizer\StandardHoursDayOfWeekNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class => \ShipStream\Ups\Api\Normalizer\DropLocationLocalizedInstructionNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class => \ShipStream\Ups\Api\Normalizer\DropLocationPromotionInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationSortCode::class => \ShipStream\Ups\Api\Normalizer\DropLocationSortCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class => \ShipStream\Ups\Api\Normalizer\DropLocationServiceOfferingListNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class => \ShipStream\Ups\Api\Normalizer\DropLocationAccessPointInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationBusinessClassificationListNormalizer::class, - - \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class => \ShipStream\Ups\Api\Normalizer\BusinessClassificationListBusinessClassificationNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationAccessPointStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationPrivateNetworkListNormalizer::class, - - \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class => \ShipStream\Ups\Api\Normalizer\PrivateNetworkListPrivateNetworkNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationAvailabilityNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class => \ShipStream\Ups\Api\Normalizer\AvailabilityShippingAvailabilityNormalizer::class, - - \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class => \ShipStream\Ups\Api\Normalizer\ShippingAvailabilityUnavailableReasonNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class => \ShipStream\Ups\Api\Normalizer\AvailabilityDCRAvailabilityNormalizer::class, - - \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class => \ShipStream\Ups\Api\Normalizer\DCRAvailabilityUnavailableReasonNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationLocationImage::class => \ShipStream\Ups\Api\Normalizer\DropLocationLocationImageNormalizer::class, - - \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class => \ShipStream\Ups\Api\Normalizer\SearchResultsAvailableLocationAttributesNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesOptionTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesOptionCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesOptionCodeTransportationPickUpScheduleNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesTransportationPickUpSchedulePickUpNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesPickUpPickUpDetailsNormalizer::class, - - \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class => \ShipStream\Ups\Api\Normalizer\GenerateTokenSuccessResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class => \ShipStream\Ups\Api\Normalizer\RefreshTokenSuccessResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTDeleteRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTDeleteResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\DeleteRequest::class => \ShipStream\Ups\Api\Normalizer\DeleteRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\DeleteRequestRequest::class => \ShipStream\Ups\Api\Normalizer\DeleteRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\DeleteResponse::class => \ShipStream\Ups\Api\Normalizer\DeleteResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\DeleteResponseResponse::class => \ShipStream\Ups\Api\Normalizer\DeleteResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryRequestFormsHistoryDocumentIDNormalizer::class, - - \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTUploadRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTUploadResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\UploadRequest::class => \ShipStream\Ups\Api\Normalizer\UploadRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\UploadRequestRequest::class => \ShipStream\Ups\Api\Normalizer\UploadRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class => \ShipStream\Ups\Api\Normalizer\UploadRequestUserCreatedFormNormalizer::class, - - \ShipStream\Ups\Api\Model\UploadResponse::class => \ShipStream\Ups\Api\Normalizer\UploadResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\UploadResponseResponse::class => \ShipStream\Ups\Api\Normalizer\UploadResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class => \ShipStream\Ups\Api\Normalizer\UploadResponseFormsHistoryDocumentIDNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateRequest::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestShipperAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestPickupAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestPickupDateInfoNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateResponse::class => \ShipStream\Ups\Api\Normalizer\PickupRateResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupRateResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class => \ShipStream\Ups\Api\Normalizer\PickupRateResponseRateResultNormalizer::class, - - \ShipStream\Ups\Api\Model\RateResultChargeDetail::class => \ShipStream\Ups\Api\Normalizer\RateResultChargeDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\RateResultTaxCharges::class => \ShipStream\Ups\Api\Normalizer\RateResultTaxChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class => \ShipStream\Ups\Api\Normalizer\PickupRateResponseWeekendServiceTerritoryNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPCancelRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPCancelResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCancelRequest::class => \ShipStream\Ups\Api\Normalizer\PickupCancelRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupCancelRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCancelResponse::class => \ShipStream\Ups\Api\Normalizer\PickupCancelResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupCancelResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class => \ShipStream\Ups\Api\Normalizer\PickupCancelResponseGWNStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPCreationRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPCreationResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequest::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestShipperNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipperAccount::class => \ShipStream\Ups\Api\Normalizer\ShipperAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipperChargeCard::class => \ShipStream\Ups\Api\Normalizer\ShipperChargeCardNormalizer::class, - - \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class => \ShipStream\Ups\Api\Normalizer\ChargeCardCardAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestPickupDateInfoNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestPickupAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupAddressPhone::class => \ShipStream\Ups\Api\Normalizer\PickupAddressPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestPickupPieceNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestTotalWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestTrackingDataNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestTrackingDataWithReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestFreightOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\FreightOptionsShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class => \ShipStream\Ups\Api\Normalizer\FreightOptionsDestinationAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class => \ShipStream\Ups\Api\Normalizer\FreightOptionsShipmentDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentDetailPalletInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\PalletInformationDimensions::class => \ShipStream\Ups\Api\Normalizer\PalletInformationDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DimensionsUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationResponse::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseWeekendServiceTerritoryNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseRateStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseRateResultNormalizer::class, - - \ShipStream\Ups\Api\Model\RateResultDisclaimer::class => \ShipStream\Ups\Api\Normalizer\RateResultDisclaimerNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPPolDivRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPPolDivResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class => \ShipStream\Ups\Api\Normalizer\PickupGetPoliticalDivision1ListRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupGetPoliticalDivision1ListRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class => \ShipStream\Ups\Api\Normalizer\PickupGetPoliticalDivision1ListResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupGetPoliticalDivision1ListResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPServCenterRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPServCenterResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestPickupPieceNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestOriginAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class => \ShipStream\Ups\Api\Normalizer\OriginAddressOriginSearchCriteriaNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestDestinationAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class => \ShipStream\Ups\Api\Normalizer\ServiceCenterLocationDropOffFacilitiesNormalizer::class, - - \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class => \ShipStream\Ups\Api\Normalizer\DropOffFacilitiesAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class => \ShipStream\Ups\Api\Normalizer\DropOffFacilitiesFacilityTimeNormalizer::class, - - \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class => \ShipStream\Ups\Api\Normalizer\FacilityTimeDayOfWeekNormalizer::class, - - \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class => \ShipStream\Ups\Api\Normalizer\DropOffFacilitiesLocalizedInstructionNormalizer::class, - - \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class => \ShipStream\Ups\Api\Normalizer\DropOffFacilitiesDistanceNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class => \ShipStream\Ups\Api\Normalizer\ServiceCenterLocationPickupFacilitiesNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class => \ShipStream\Ups\Api\Normalizer\PickupFacilitiesAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class => \ShipStream\Ups\Api\Normalizer\PickupFacilitiesFacilityTimeNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class => \ShipStream\Ups\Api\Normalizer\PickupFacilitiesFacilityTimeDayOfWeekNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPPendingRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPPendingResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusResponsePendingStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PRENOTIFICATIONRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PRENOTIFICATIONResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationRequest::class => \ShipStream\Ups\Api\Normalizer\PreNotificationRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PreNotificationRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class => \ShipStream\Ups\Api\Normalizer\PreNotificationRequestShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class => \ShipStream\Ups\Api\Normalizer\PreNotificationShipmentShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\PreNotificationShipmentShipFromAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class => \ShipStream\Ups\Api\Normalizer\PreNotificationShipmentPackageNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class => \ShipStream\Ups\Api\Normalizer\PreNotificationPackageChemicalRecordNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationResponse::class => \ShipStream\Ups\Api\Normalizer\PreNotificationResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PreNotificationResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\QUANTUMVIEWRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\QUANTUMVIEWResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewRequest::class => \ShipStream\Ups\Api\Normalizer\QuantumViewRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class => \ShipStream\Ups\Api\Normalizer\QuantumViewRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class => \ShipStream\Ups\Api\Normalizer\QuantumViewRequestSubscriptionRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class => \ShipStream\Ups\Api\Normalizer\SubscriptionRequestDateTimeRangeNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewResponse::class => \ShipStream\Ups\Api\Normalizer\QuantumViewResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class => \ShipStream\Ups\Api\Normalizer\QuantumViewResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class => \ShipStream\Ups\Api\Normalizer\QuantumViewResponseQuantumViewEventsNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class => \ShipStream\Ups\Api\Normalizer\QuantumViewEventsSubscriptionEventsNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class => \ShipStream\Ups\Api\Normalizer\SubscriptionEventsSubscriptionStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class => \ShipStream\Ups\Api\Normalizer\SubscriptionEventsDateRangeNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class => \ShipStream\Ups\Api\Normalizer\SubscriptionEventsSubscriptionFileNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileStatusTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileManifestNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestShipper::class => \ShipStream\Ups\Api\Normalizer\ManifestShipperNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestShipperAddress::class => \ShipStream\Ups\Api\Normalizer\ManifestShipperAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestShipTo::class => \ShipStream\Ups\Api\Normalizer\ManifestShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestShipToAddress::class => \ShipStream\Ups\Api\Normalizer\ManifestShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ManifestReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestService::class => \ShipStream\Ups\Api\Normalizer\ManifestServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestPackage::class => \ShipStream\Ups\Api\Normalizer\ManifestPackageNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageActivity::class => \ShipStream\Ups\Api\Normalizer\PackageActivityNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class => \ShipStream\Ups\Api\Normalizer\ManifestPackageDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class => \ShipStream\Ups\Api\Normalizer\PackageDimensionalWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DimensionalWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class => \ShipStream\Ups\Api\Normalizer\ManifestPackagePackageWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ManifestPackageReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class => \ShipStream\Ups\Api\Normalizer\ManifestPackagePackageServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class => \ShipStream\Ups\Api\Normalizer\ManifestPackageServiceOptionsCODNormalizer::class, - - \ShipStream\Ups\Api\Model\CODCODAmount::class => \ShipStream\Ups\Api\Normalizer\CODCODAmountNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsInsuredValueNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\ManifestShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsCallTagARSNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestCustomsValue::class => \ShipStream\Ups\Api\Normalizer\ManifestCustomsValueNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestBillToAccount::class => \ShipStream\Ups\Api\Normalizer\ManifestBillToAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestUAPAddress::class => \ShipStream\Ups\Api\Normalizer\ManifestUAPAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\UAPAddressAddress::class => \ShipStream\Ups\Api\Normalizer\UAPAddressAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileOriginNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\OriginPackageReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\OriginShipmentReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginActivityLocation::class => \ShipStream\Ups\Api\Normalizer\OriginActivityLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class => \ShipStream\Ups\Api\Normalizer\ActivityLocationAddressArtifactFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginBillToAccount::class => \ShipStream\Ups\Api\Normalizer\OriginBillToAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionFileException::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileExceptionNormalizer::class, - - \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ExceptionPackageReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ExceptionShipmentReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class => \ShipStream\Ups\Api\Normalizer\ExceptionUpdatedAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class => \ShipStream\Ups\Api\Normalizer\UpdatedAddressAddressExtendedInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\ExceptionResolution::class => \ShipStream\Ups\Api\Normalizer\ExceptionResolutionNormalizer::class, - - \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class => \ShipStream\Ups\Api\Normalizer\ExceptionActivityLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class => \ShipStream\Ups\Api\Normalizer\ExceptionBillToAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileDeliveryNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\DeliveryPackageReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\DeliveryShipmentReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class => \ShipStream\Ups\Api\Normalizer\DeliveryActivityLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class => \ShipStream\Ups\Api\Normalizer\DeliveryDeliveryLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class => \ShipStream\Ups\Api\Normalizer\DeliveryLocationAddressArtifactFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class => \ShipStream\Ups\Api\Normalizer\AddressArtifactFormatAddressExtendedInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryCOD::class => \ShipStream\Ups\Api\Normalizer\DeliveryCODNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class => \ShipStream\Ups\Api\Normalizer\DeliveryBillToAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileGenericNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\GenericShipmentReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\GenericPackageReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericService::class => \ShipStream\Ups\Api\Normalizer\GenericServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericActivity::class => \ShipStream\Ups\Api\Normalizer\GenericActivityNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericBillToAccount::class => \ShipStream\Ups\Api\Normalizer\GenericBillToAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericShipTo::class => \ShipStream\Ups\Api\Normalizer\GenericShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericFailureNotification::class => \ShipStream\Ups\Api\Normalizer\GenericFailureNotificationNormalizer::class, - - \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class => \ShipStream\Ups\Api\Normalizer\FailureNotificationFailureNotificationCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\RATERequestWrapper::class => \ShipStream\Ups\Api\Normalizer\RATERequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\RATEResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\RATEResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\RateRequest::class => \ShipStream\Ups\Api\Normalizer\RateRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\RateRequestRequest::class => \ShipStream\Ups\Api\Normalizer\RateRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\RateRequestPickupType::class => \ShipStream\Ups\Api\Normalizer\RateRequestPickupTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class => \ShipStream\Ups\Api\Normalizer\RateRequestCustomerClassificationNormalizer::class, - - \ShipStream\Ups\Api\Model\RateRequestShipment::class => \ShipStream\Ups\Api\Normalizer\RateRequestShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentShipper::class => \ShipStream\Ups\Api\Normalizer\RateShipmentShipperNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipperAddress::class => \ShipStream\Ups\Api\Normalizer\ShipperAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentShipTo::class => \ShipStream\Ups\Api\Normalizer\RateShipmentShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipToAddress::class => \ShipStream\Ups\Api\Normalizer\ShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class => \ShipStream\Ups\Api\Normalizer\RateShipmentShipFromNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\ShipFromAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class => \ShipStream\Ups\Api\Normalizer\RateShipmentAlternateDeliveryAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class => \ShipStream\Ups\Api\Normalizer\RateAlternateDeliveryAddressAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipmentIndicationTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class => \ShipStream\Ups\Api\Normalizer\ShipmentPaymentDetailsNormalizer::class, - - \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class => \ShipStream\Ups\Api\Normalizer\PaymentDetailsShipmentChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class => \ShipStream\Ups\Api\Normalizer\RateShipmentChargeBillShipperNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargeBillReceiverNormalizer::class, - - \ShipStream\Ups\Api\Model\BillReceiverAddress::class => \ShipStream\Ups\Api\Normalizer\BillReceiverAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class => \ShipStream\Ups\Api\Normalizer\RateShipmentChargeBillThirdPartyNormalizer::class, - - \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class => \ShipStream\Ups\Api\Normalizer\RateBillThirdPartyAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\RateShipmentFRSPaymentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class => \ShipStream\Ups\Api\Normalizer\FRSPaymentInformationTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class => \ShipStream\Ups\Api\Normalizer\FRSPaymentInformationAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentFreightShipmentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class => \ShipStream\Ups\Api\Normalizer\FreightShipmentInformationFreightDensityInfoNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class => \ShipStream\Ups\Api\Normalizer\FreightDensityInfoAdjustedHeightNormalizer::class, - - \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\AdjustedHeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\FreightDensityInfoHandlingUnitsNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitsType::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitsTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitsDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitsUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipmentTotalWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\ShipmentTotalWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentPackage::class => \ShipStream\Ups\Api\Normalizer\RateShipmentPackageNormalizer::class, - - \ShipStream\Ups\Api\Model\PackagePackagingType::class => \ShipStream\Ups\Api\Normalizer\PackagePackagingTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageDimensions::class => \ShipStream\Ups\Api\Normalizer\PackageDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageDimWeight::class => \ShipStream\Ups\Api\Normalizer\PackageDimWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DimWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageCommodity::class => \ShipStream\Ups\Api\Normalizer\PackageCommodityNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityNMFC::class => \ShipStream\Ups\Api\Normalizer\CommodityNMFCNormalizer::class, - - \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class => \ShipStream\Ups\Api\Normalizer\RatePackagePackageServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class => \ShipStream\Ups\Api\Normalizer\RatePackageServiceOptionsDeliveryConfirmationNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsAccessPointCODNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsCODNormalizer::class, - - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\RatePackageServiceOptionsDeclaredValueNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsShipperDeclaredValueNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsInsuranceNormalizer::class, - - \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class => \ShipStream\Ups\Api\Normalizer\InsuranceBasicFlexibleParcelIndicatorNormalizer::class, - - \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class => \ShipStream\Ups\Api\Normalizer\InsuranceExtendedFlexibleParcelIndicatorNormalizer::class, - - \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class => \ShipStream\Ups\Api\Normalizer\InsuranceTimeInTransitFlexibleParcelIndicatorNormalizer::class, - - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class => \ShipStream\Ups\Api\Normalizer\RatePackageServiceOptionsHazMatNormalizer::class, - - \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class => \ShipStream\Ups\Api\Normalizer\HazMatHazMatChemicalRecordNormalizer::class, - - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class => \ShipStream\Ups\Api\Normalizer\RatePackageServiceOptionsDryIceNormalizer::class, - - \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class => \ShipStream\Ups\Api\Normalizer\DryIceDryIceWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DryIceWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageSimpleRate::class => \ShipStream\Ups\Api\Normalizer\PackageSimpleRateNormalizer::class, - - \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class => \ShipStream\Ups\Api\Normalizer\RatePackageUPSPremierNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\RateShipmentShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsAccessPointCODNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsCODNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsCODCODAmountNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class => \ShipStream\Ups\Api\Normalizer\RateShipmentServiceOptionsDeliveryConfirmationNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsPickupOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsDeliveryOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class => \ShipStream\Ups\Api\Normalizer\RateShipmentServiceOptionsRestrictedArticlesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsImportControlNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsReturnServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipmentRatingOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class => \ShipStream\Ups\Api\Normalizer\ShipmentInvoiceLineTotalNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentPromotionalDiscountInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentDeliveryTimeInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class => \ShipStream\Ups\Api\Normalizer\DeliveryTimeInformationPickupNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class => \ShipStream\Ups\Api\Normalizer\DeliveryTimeInformationReturnContractServicesNormalizer::class, - - \ShipStream\Ups\Api\Model\RateResponse::class => \ShipStream\Ups\Api\Normalizer\RateResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\RateResponseResponse::class => \ShipStream\Ups\Api\Normalizer\RateResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class => \ShipStream\Ups\Api\Normalizer\RateResponseRatedShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentDisclaimerNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentService::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentRatedShipmentAlertNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentBillingWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\BillingWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTransportationChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentBaseServiceChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentItemizedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentFRSShipmentDataNormalizer::class, - - \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class => \ShipStream\Ups\Api\Normalizer\FRSShipmentDataTransportationChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class => \ShipStream\Ups\Api\Normalizer\TransportationChargesGrossChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class => \ShipStream\Ups\Api\Normalizer\TransportationChargesDiscountAmountNormalizer::class, - - \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class => \ShipStream\Ups\Api\Normalizer\TransportationChargesNetChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class => \ShipStream\Ups\Api\Normalizer\FRSShipmentDataFreightDensityRateNormalizer::class, - - \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\FRSShipmentDataHandlingUnitsNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitsAdjustedHeightNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class => \ShipStream\Ups\Api\Normalizer\RatedPackageBaseServiceChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentServiceOptionsChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTaxChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTotalChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTotalChargesWithTaxesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentNegotiatedRateChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\NegotiatedRateChargesItemizedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class => \ShipStream\Ups\Api\Normalizer\NegotiatedRateChargesTaxChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class => \ShipStream\Ups\Api\Normalizer\NegotiatedRateChargesTotalChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class => \ShipStream\Ups\Api\Normalizer\NegotiatedRateChargesTotalChargesWithTaxesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentRatedPackageNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageTransportationChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageServiceOptionsChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageTotalChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class => \ShipStream\Ups\Api\Normalizer\RatedPackageBillingWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\RatedPackageBillingWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class => \ShipStream\Ups\Api\Normalizer\RatedPackageAccessorialNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageItemizedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class => \ShipStream\Ups\Api\Normalizer\RatedPackageRateModifierNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageNegotiatedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\NegotiatedChargesItemizedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class => \ShipStream\Ups\Api\Normalizer\RatedPackageSimpleRateNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTimeInTransitNormalizer::class, - - \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class => \ShipStream\Ups\Api\Normalizer\TimeInTransitServiceSummaryNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceSummaryService::class => \ShipStream\Ups\Api\Normalizer\ServiceSummaryServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class => \ShipStream\Ups\Api\Normalizer\ServiceSummaryEstimatedArrivalNormalizer::class, - - \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class => \ShipStream\Ups\Api\Normalizer\EstimatedArrivalArrivalNormalizer::class, - - \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class => \ShipStream\Ups\Api\Normalizer\EstimatedArrivalPickupNormalizer::class, - - \ShipStream\Ups\Api\Model\SHIPRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\SHIPRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\SHIPResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\SHIPResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentRequest::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentReturnService::class => \ShipStream\Ups\Api\Normalizer\ShipmentReturnServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipper::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipperNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipperPhone::class => \ShipStream\Ups\Api\Normalizer\ShipperPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipTo::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipToPhone::class => \ShipStream\Ups\Api\Normalizer\ShipToPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class => \ShipStream\Ups\Api\Normalizer\ShipmentAlternateDeliveryAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class => \ShipStream\Ups\Api\Normalizer\AlternateDeliveryAddressAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipFrom::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipFromNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class => \ShipStream\Ups\Api\Normalizer\ShipFromTaxIDTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipFromPhone::class => \ShipStream\Ups\Api\Normalizer\ShipFromPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class => \ShipStream\Ups\Api\Normalizer\ShipFromVendorInfoNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentPaymentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class => \ShipStream\Ups\Api\Normalizer\PaymentInformationShipmentChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargeBillShipperNormalizer::class, - - \ShipStream\Ups\Api\Model\BillShipperCreditCard::class => \ShipStream\Ups\Api\Normalizer\BillShipperCreditCardNormalizer::class, - - \ShipStream\Ups\Api\Model\CreditCardAddress::class => \ShipStream\Ups\Api\Normalizer\CreditCardAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargeBillThirdPartyNormalizer::class, - - \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class => \ShipStream\Ups\Api\Normalizer\BillThirdPartyAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentFRSPaymentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class => \ShipStream\Ups\Api\Normalizer\ShipmentDGSignatoryInfoNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ShipmentReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsNotificationNormalizer::class, - - \ShipStream\Ups\Api\Model\NotificationEMail::class => \ShipStream\Ups\Api\Normalizer\NotificationEMailNormalizer::class, - - \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class => \ShipStream\Ups\Api\Normalizer\NotificationVoiceMessageNormalizer::class, - - \ShipStream\Ups\Api\Model\NotificationTextMessage::class => \ShipStream\Ups\Api\Normalizer\NotificationTextMessageNormalizer::class, - - \ShipStream\Ups\Api\Model\NotificationLocale::class => \ShipStream\Ups\Api\Normalizer\NotificationLocaleNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsLabelDeliveryNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class => \ShipStream\Ups\Api\Normalizer\LabelDeliveryEMailNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsInternationalFormsNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsUserCreatedFormNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsUPSPremiumCareFormNormalizer::class, - - \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class => \ShipStream\Ups\Api\Normalizer\UPSPremiumCareFormLanguageForUPSPremiumCareNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsCN22FormNormalizer::class, - - \ShipStream\Ups\Api\Model\CN22FormCN22Content::class => \ShipStream\Ups\Api\Normalizer\CN22FormCN22ContentNormalizer::class, - - \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class => \ShipStream\Ups\Api\Normalizer\CN22ContentCN22ContentWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\CN22ContentWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsEEIFilingOptionNormalizer::class, - - \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class => \ShipStream\Ups\Api\Normalizer\EEIFilingOptionUPSFiledNormalizer::class, - - \ShipStream\Ups\Api\Model\UPSFiledPOA::class => \ShipStream\Ups\Api\Normalizer\UPSFiledPOANormalizer::class, - - \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class => \ShipStream\Ups\Api\Normalizer\EEIFilingOptionShipperFiledNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsContacts::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsContactsNormalizer::class, - - \ShipStream\Ups\Api\Model\ContactsForwardAgent::class => \ShipStream\Ups\Api\Normalizer\ContactsForwardAgentNormalizer::class, - - \ShipStream\Ups\Api\Model\ForwardAgentAddress::class => \ShipStream\Ups\Api\Normalizer\ForwardAgentAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class => \ShipStream\Ups\Api\Normalizer\ContactsUltimateConsigneeNormalizer::class, - - \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class => \ShipStream\Ups\Api\Normalizer\UltimateConsigneeAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class => \ShipStream\Ups\Api\Normalizer\UltimateConsigneeUltimateConsigneeTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class => \ShipStream\Ups\Api\Normalizer\ContactsIntermediateConsigneeNormalizer::class, - - \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class => \ShipStream\Ups\Api\Normalizer\IntermediateConsigneeAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ContactsProducer::class => \ShipStream\Ups\Api\Normalizer\ContactsProducerNormalizer::class, - - \ShipStream\Ups\Api\Model\ProducerAddress::class => \ShipStream\Ups\Api\Normalizer\ProducerAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ProducerPhone::class => \ShipStream\Ups\Api\Normalizer\ProducerPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\ContactsSoldTo::class => \ShipStream\Ups\Api\Normalizer\ContactsSoldToNormalizer::class, - - \ShipStream\Ups\Api\Model\SoldToPhone::class => \ShipStream\Ups\Api\Normalizer\SoldToPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\SoldToAddress::class => \ShipStream\Ups\Api\Normalizer\SoldToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsProduct::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsProductNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductUnit::class => \ShipStream\Ups\Api\Normalizer\ProductUnitNormalizer::class, - - \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\UnitUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class => \ShipStream\Ups\Api\Normalizer\ProductNetCostDateRangeNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductProductWeight::class => \ShipStream\Ups\Api\Normalizer\ProductProductWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\ProductWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductScheduleB::class => \ShipStream\Ups\Api\Normalizer\ProductScheduleBNormalizer::class, - - \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\ScheduleBUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class => \ShipStream\Ups\Api\Normalizer\ProductExcludeFromFormNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductPackingListInfo::class => \ShipStream\Ups\Api\Normalizer\ProductPackingListInfoNormalizer::class, - - \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class => \ShipStream\Ups\Api\Normalizer\PackingListInfoPackageAssociatedNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductEEIInformation::class => \ShipStream\Ups\Api\Normalizer\ProductEEIInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\EEIInformationLicense::class => \ShipStream\Ups\Api\Normalizer\EEIInformationLicenseNormalizer::class, - - \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class => \ShipStream\Ups\Api\Normalizer\EEIInformationDDTCInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DDTCInformationUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsDiscountNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsFreightChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsInsuranceChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsOtherChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsBlanketPeriodNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsDeliveryConfirmationNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsLabelMethodNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsPreAlertNotificationNormalizer::class, - - \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class => \ShipStream\Ups\Api\Normalizer\PreAlertNotificationEMailMessageNormalizer::class, - - \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class => \ShipStream\Ups\Api\Normalizer\PreAlertNotificationVoiceMessageNormalizer::class, - - \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class => \ShipStream\Ups\Api\Normalizer\PreAlertNotificationTextMessageNormalizer::class, - - \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class => \ShipStream\Ups\Api\Normalizer\PreAlertNotificationLocaleNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsRestrictedArticlesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentPackage::class => \ShipStream\Ups\Api\Normalizer\ShipmentPackageNormalizer::class, - - \ShipStream\Ups\Api\Model\PackagePackaging::class => \ShipStream\Ups\Api\Normalizer\PackagePackagingNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\PackageReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageUPSPremier::class => \ShipStream\Ups\Api\Normalizer\PackageUPSPremierNormalizer::class, - - \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class => \ShipStream\Ups\Api\Normalizer\UPSPremierHandlingInstructionsNormalizer::class, - - \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class => \ShipStream\Ups\Api\Normalizer\PackagePackageServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsDeliveryConfirmationNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsDeclaredValueNormalizer::class, - - \ShipStream\Ups\Api\Model\DeclaredValueType::class => \ShipStream\Ups\Api\Normalizer\DeclaredValueTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsCODCODAmountNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsNotificationNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsNotificationEMailNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsHazMatNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsDryIceNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class => \ShipStream\Ups\Api\Normalizer\PackageHazMatPackageInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestLabelSpecificationNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\LabelSpecificationLabelImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class => \ShipStream\Ups\Api\Normalizer\LabelSpecificationLabelStockSizeNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class => \ShipStream\Ups\Api\Normalizer\LabelSpecificationInstructionNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestReceiptSpecificationNormalizer::class, - - \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class => \ShipStream\Ups\Api\Normalizer\ReceiptSpecificationImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResponse::class => \ShipStream\Ups\Api\Normalizer\ShipmentResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class => \ShipStream\Ups\Api\Normalizer\ShipmentResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class => \ShipStream\Ups\Api\Normalizer\ShipmentResponseShipmentResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsDisclaimerNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsShipmentChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesBaseServiceChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesTransportationChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesItemizedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesServiceOptionsChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesTaxChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesTotalChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesTotalChargesWithTaxesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsNegotiatedRateChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsFRSShipmentDataNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsBillingWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsPackageResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class => \ShipStream\Ups\Api\Normalizer\PackageResultsBaseServiceChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class => \ShipStream\Ups\Api\Normalizer\PackageResultsServiceOptionsChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class => \ShipStream\Ups\Api\Normalizer\PackageResultsShippingLabelNormalizer::class, - - \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\ShippingLabelImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class => \ShipStream\Ups\Api\Normalizer\PackageResultsShippingReceiptNormalizer::class, - - \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class => \ShipStream\Ups\Api\Normalizer\ShippingReceiptImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class => \ShipStream\Ups\Api\Normalizer\PackageResultsAccessorialNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class => \ShipStream\Ups\Api\Normalizer\PackageResultsSimpleRateNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsForm::class => \ShipStream\Ups\Api\Normalizer\PackageResultsFormNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsFormImageNormalizer::class, - - \ShipStream\Ups\Api\Model\FormImage::class => \ShipStream\Ups\Api\Normalizer\FormImageNormalizer::class, - - \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\HighValueReportImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\CODTurnInPageImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\ImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\PackageResultsItemizedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class => \ShipStream\Ups\Api\Normalizer\PackageResultsNegotiatedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class => \ShipStream\Ups\Api\Normalizer\PackageResultsRateModifierNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsControlLogReceiptNormalizer::class, - - \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class => \ShipStream\Ups\Api\Normalizer\ControlLogReceiptImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsForm::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsFormNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsCODTurnInPageNormalizer::class, - - \ShipStream\Ups\Api\Model\CODTurnInPageImage::class => \ShipStream\Ups\Api\Normalizer\CODTurnInPageImageNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsHighValueReportNormalizer::class, - - \ShipStream\Ups\Api\Model\HighValueReportImage::class => \ShipStream\Ups\Api\Normalizer\HighValueReportImageNormalizer::class, - - \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\VOIDSHIPMENTRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\VOIDSHIPMENTResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentRequest::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class => \ShipStream\Ups\Api\Normalizer\VoidRequestTransactionReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentRequestVoidShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentResponse::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class => \ShipStream\Ups\Api\Normalizer\VoidResponseResponseStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class => \ShipStream\Ups\Api\Normalizer\VoidResponseTransactionReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentResponseSummaryResultNormalizer::class, - - \ShipStream\Ups\Api\Model\SummaryResultStatus::class => \ShipStream\Ups\Api\Normalizer\SummaryResultStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentResponsePackageLevelResultNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class => \ShipStream\Ups\Api\Normalizer\PackageLevelResultStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\LABELRECOVERYRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\LABELRECOVERYResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class => \ShipStream\Ups\Api\Normalizer\LRRequestTransactionReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestLabelSpecificationNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryLabelSpecificationLabelImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryLabelSpecificationLabelStockSizeNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestTranslateNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestLabelDeliveryNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestReferenceValuesNormalizer::class, - - \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ReferenceValuesReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestUPSPremiumCareFormNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class => \ShipStream\Ups\Api\Normalizer\LRResponseResponseStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class => \ShipStream\Ups\Api\Normalizer\LRResponseTransactionReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseLabelResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class => \ShipStream\Ups\Api\Normalizer\LabelResultsLabelImageNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\LabelImageLabelImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class => \ShipStream\Ups\Api\Normalizer\LabelResultsMailInnovationsLabelImageNormalizer::class, - - \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\MailInnovationsLabelImageLabelImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelResultsReceipt::class => \ShipStream\Ups\Api\Normalizer\LabelResultsReceiptNormalizer::class, - - \ShipStream\Ups\Api\Model\ReceiptImage::class => \ShipStream\Ups\Api\Normalizer\ReceiptImageNormalizer::class, - - \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\ReceiptImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelResultsForm::class => \ShipStream\Ups\Api\Normalizer\LabelResultsFormNormalizer::class, - - \ShipStream\Ups\Api\Model\LRFormImage::class => \ShipStream\Ups\Api\Normalizer\LRFormImageNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseCODTurnInPageNormalizer::class, - - \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class => \ShipStream\Ups\Api\Normalizer\LRCODTurnInPageImageNormalizer::class, - - \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\LRCODTurnInPageImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseFormNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryFormImageNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseHighValueReportNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseTrackingCandidateNormalizer::class, - - \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class => \ShipStream\Ups\Api\Normalizer\TrackingCandidatePickupDateRangeNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTPICKUPRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTPICKUPResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequest::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestRequesterNormalizer::class, - - \ShipStream\Ups\Api\Model\RequesterPhone::class => \ShipStream\Ups\Api\Normalizer\RequesterPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestShipFromNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class => \ShipStream\Ups\Api\Normalizer\FreightPickupShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestShipmentDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class => \ShipStream\Ups\Api\Normalizer\ShipmentDetailPackagingTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentDetailWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\WeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestExistingShipmentIDNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestPOMNormalizer::class, - - \ShipStream\Ups\Api\Model\POMPickupNotifications::class => \ShipStream\Ups\Api\Normalizer\POMPickupNotificationsNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class => \ShipStream\Ups\Api\Normalizer\PickupNotificationsEMailNotificationNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupResponse::class => \ShipStream\Ups\Api\Normalizer\FreightPickupResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class => \ShipStream\Ups\Api\Normalizer\FreightPickupResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTPICKUPCANCELRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTPICKUPCANCELResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class => \ShipStream\Ups\Api\Normalizer\FreightCancelPickupRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class => \ShipStream\Ups\Api\Normalizer\FreightCancelPickupRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class => \ShipStream\Ups\Api\Normalizer\FreightCancelPickupResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class => \ShipStream\Ups\Api\Normalizer\FreightCancelPickupResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightCancelStatus::class => \ShipStream\Ups\Api\Normalizer\FreightCancelStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTRATERequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTRATEResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequest::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestShipFromNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\FreightRateShipFromAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class => \ShipStream\Ups\Api\Normalizer\FreightRateShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestPaymentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class => \ShipStream\Ups\Api\Normalizer\FreightRatePaymentInformationPayerNormalizer::class, - - \ShipStream\Ups\Api\Model\PayerAddress::class => \ShipStream\Ups\Api\Normalizer\PayerAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class => \ShipStream\Ups\Api\Normalizer\PaymentInformationShipmentBillingOptionNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestService::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestHandlingUnitOneNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitOneType::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitOneTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestHandlingUnitTwoNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitTwoTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestCommodityNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityWeight::class => \ShipStream\Ups\Api\Normalizer\CommodityWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class => \ShipStream\Ups\Api\Normalizer\CommodityAdjustedWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\AdjustedWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityDimensions::class => \ShipStream\Ups\Api\Normalizer\CommodityDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityPackagingType::class => \ShipStream\Ups\Api\Normalizer\CommodityPackagingTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityCommodityValue::class => \ShipStream\Ups\Api\Normalizer\CommodityCommodityValueNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class => \ShipStream\Ups\Api\Normalizer\CommodityNMFCCommodityNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class => \ShipStream\Ups\Api\Normalizer\FreightShipmentServiceOptionsPickupOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class => \ShipStream\Ups\Api\Normalizer\FreightShipmentServiceOptionsDeliveryOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsOverSeasLegNormalizer::class, - - \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class => \ShipStream\Ups\Api\Normalizer\OverSeasLegDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\OverSeasLegValue::class => \ShipStream\Ups\Api\Normalizer\OverSeasLegValueNormalizer::class, - - \ShipStream\Ups\Api\Model\ValueCube::class => \ShipStream\Ups\Api\Normalizer\ValueCubeNormalizer::class, - - \ShipStream\Ups\Api\Model\ValueCWT::class => \ShipStream\Ups\Api\Normalizer\ValueCWTNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class => \ShipStream\Ups\Api\Normalizer\FreightShipmentServiceOptionsCODNormalizer::class, - - \ShipStream\Ups\Api\Model\CODCODValue::class => \ShipStream\Ups\Api\Normalizer\CODCODValueNormalizer::class, - - \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class => \ShipStream\Ups\Api\Normalizer\CODCODPaymentMethodNormalizer::class, - - \ShipStream\Ups\Api\Model\CODCODBillingOption::class => \ShipStream\Ups\Api\Normalizer\CODCODBillingOptionNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class => \ShipStream\Ups\Api\Normalizer\FreightRateCODRemitToNormalizer::class, - - \ShipStream\Ups\Api\Model\RemitToAddress::class => \ShipStream\Ups\Api\Normalizer\RemitToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsDangerousGoodsNormalizer::class, - - \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class => \ShipStream\Ups\Api\Normalizer\DangerousGoodsPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class => \ShipStream\Ups\Api\Normalizer\DangerousGoodsTransportationModeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsSortingAndSegregatingNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsExcessDeclaredValueNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsHandlingChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingChargeAmount::class => \ShipStream\Ups\Api\Normalizer\HandlingChargeAmountNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsAdjustedHeightNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestPickupRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestAlternateRateOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestGFPOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class => \ShipStream\Ups\Api\Normalizer\GFPOptionsOnCallInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestHandlingUnitWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestHandlingUnitsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponse::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseRate::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseRateNormalizer::class, - - \ShipStream\Ups\Api\Model\RateType::class => \ShipStream\Ups\Api\Normalizer\RateTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\RateFactor::class => \ShipStream\Ups\Api\Normalizer\RateFactorNormalizer::class, - - \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\FactorUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseFreightDensityRateNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseCommodityNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseTotalShipmentChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseBillableShipmentWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\BillableShipmentWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseDimensionalWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseService::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseAlternateRatesResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseAlternateRateTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseRateNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseFreightDensityRateNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseBillableShipmentWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseTimeInTransitNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseTimeInTransitNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseHandlingUnitsNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTSHIPRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTSHIPResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipRequest::class => \ShipStream\Ups\Api\Normalizer\FreightShipRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class => \ShipStream\Ups\Api\Normalizer\FreightShipRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class => \ShipStream\Ups\Api\Normalizer\FreightShipRequestShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentShipFromNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipFromAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentPaymentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\PaymentInformationPayer::class => \ShipStream\Ups\Api\Normalizer\PaymentInformationPayerNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class => \ShipStream\Ups\Api\Normalizer\FreightShipPayerAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PayerPhone::class => \ShipStream\Ups\Api\Normalizer\PayerPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class => \ShipStream\Ups\Api\Normalizer\ShipmentHandlingUnitOneNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class => \ShipStream\Ups\Api\Normalizer\ShipmentHandlingUnitTwoNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class => \ShipStream\Ups\Api\Normalizer\ShipmentExistingShipmentIDNormalizer::class, - - \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class => \ShipStream\Ups\Api\Normalizer\ExistingShipmentIDConfirmationNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ConfirmationNumberType::class => \ShipStream\Ups\Api\Normalizer\ConfirmationNumberTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentCommodity::class => \ShipStream\Ups\Api\Normalizer\ShipmentCommodityNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class => \ShipStream\Ups\Api\Normalizer\FreightShipCommodityDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentReference::class => \ShipStream\Ups\Api\Normalizer\ShipmentReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\ReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ReferenceWeight::class => \ShipStream\Ups\Api\Normalizer\ReferenceWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsEMailInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\EMailInformationEMailType::class => \ShipStream\Ups\Api\Normalizer\EMailInformationEMailTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\EMailInformationEMail::class => \ShipStream\Ups\Api\Normalizer\EMailInformationEMailNormalizer::class, - - \ShipStream\Ups\Api\Model\CODRemitTo::class => \ShipStream\Ups\Api\Normalizer\CODRemitToNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class => \ShipStream\Ups\Api\Normalizer\FreightShipRemitToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RemitToPhone::class => \ShipStream\Ups\Api\Normalizer\RemitToPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentServiceOptionsDangerousGoodsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsDeclaredValueNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class => \ShipStream\Ups\Api\Normalizer\ShipmentPickupRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRequestRequester::class => \ShipStream\Ups\Api\Normalizer\PickupRequestRequesterNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRequestPOM::class => \ShipStream\Ups\Api\Normalizer\PickupRequestPOMNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class => \ShipStream\Ups\Api\Normalizer\FreightShipPOMPickupNotificationsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class => \ShipStream\Ups\Api\Normalizer\FreightShipPickupNotificationsEMailNotificationNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentDocuments::class => \ShipStream\Ups\Api\Normalizer\ShipmentDocumentsNormalizer::class, - - \ShipStream\Ups\Api\Model\DocumentsImage::class => \ShipStream\Ups\Api\Normalizer\DocumentsImageNormalizer::class, - - \ShipStream\Ups\Api\Model\ImageType::class => \ShipStream\Ups\Api\Normalizer\ImageTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\ImageFormat::class => \ShipStream\Ups\Api\Normalizer\ImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ImagePrintFormat::class => \ShipStream\Ups\Api\Normalizer\ImagePrintFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ImagePrintSize::class => \ShipStream\Ups\Api\Normalizer\ImagePrintSizeNormalizer::class, - - \ShipStream\Ups\Api\Model\DocumentsPackingList::class => \ShipStream\Ups\Api\Normalizer\DocumentsPackingListNormalizer::class, - - \ShipStream\Ups\Api\Model\PackingListShipFrom::class => \ShipStream\Ups\Api\Normalizer\PackingListShipFromNormalizer::class, - - \ShipStream\Ups\Api\Model\PackingListShipTo::class => \ShipStream\Ups\Api\Normalizer\PackingListShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\PackingListReference::class => \ShipStream\Ups\Api\Normalizer\PackingListReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class => \ShipStream\Ups\Api\Normalizer\PackingListHandlingUnitNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitCommodityNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\ShipmentHandlingUnitsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipResponse::class => \ShipStream\Ups\Api\Normalizer\FreightShipResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class => \ShipStream\Ups\Api\Normalizer\FreightShipResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class => \ShipStream\Ups\Api\Normalizer\FreightShipResponseShipmentResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsRate::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsRateNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsFreightDensityRateNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsTotalShipmentChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsBillableShipmentWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsService::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsDocumentsNormalizer::class, - - \ShipStream\Ups\Api\Model\DocumentsForms::class => \ShipStream\Ups\Api\Normalizer\DocumentsFormsNormalizer::class, - - \ShipStream\Ups\Api\Model\FormsType::class => \ShipStream\Ups\Api\Normalizer\FormsTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\FormsFormat::class => \ShipStream\Ups\Api\Normalizer\FormsFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsTimeInTransitNormalizer::class, - - \ShipStream\Ups\Api\Model\TimeInTransitRequest::class => \ShipStream\Ups\Api\Normalizer\TimeInTransitRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\TimeInTransitResponse::class => \ShipStream\Ups\Api\Normalizer\TimeInTransitResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ValidationList::class => \ShipStream\Ups\Api\Normalizer\ValidationListNormalizer::class, - - \ShipStream\Ups\Api\Model\EmsResponse::class => \ShipStream\Ups\Api\Normalizer\EmsResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\CandidateAddress::class => \ShipStream\Ups\Api\Normalizer\CandidateAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\Services::class => \ShipStream\Ups\Api\Normalizer\ServicesNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointInformation::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\Activity::class => \ShipStream\Ups\Api\Normalizer\ActivityNormalizer::class, - - \ShipStream\Ups\Api\Model\Address::class => \ShipStream\Ups\Api\Normalizer\AddressNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class => \ShipStream\Ups\Api\Normalizer\AlternateTrackingNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryDate::class => \ShipStream\Ups\Api\Normalizer\DeliveryDateNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryInformation::class => \ShipStream\Ups\Api\Normalizer\DeliveryInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryTime::class => \ShipStream\Ups\Api\Normalizer\DeliveryTimeNormalizer::class, - - \ShipStream\Ups\Api\Model\InquireNumbers::class => \ShipStream\Ups\Api\Normalizer\InquireNumbersNormalizer::class, - - \ShipStream\Ups\Api\Model\Location::class => \ShipStream\Ups\Api\Normalizer\LocationNormalizer::class, - - \ShipStream\Ups\Api\Model\Milestones::class => \ShipStream\Ups\Api\Normalizer\MilestonesNormalizer::class, - - \ShipStream\Ups\Api\Model\Package::class => \ShipStream\Ups\Api\Normalizer\PackageNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageAddress::class => \ShipStream\Ups\Api\Normalizer\PackageAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PaymentInformation::class => \ShipStream\Ups\Api\Normalizer\PaymentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\Service::class => \ShipStream\Ups\Api\Normalizer\ServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\Shipment::class => \ShipStream\Ups\Api\Normalizer\ShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\Signature::class => \ShipStream\Ups\Api\Normalizer\SignatureNormalizer::class, - - \ShipStream\Ups\Api\Model\Status::class => \ShipStream\Ups\Api\Normalizer\StatusNormalizer::class, - - \ShipStream\Ups\Api\Model\SubMilestone::class => \ShipStream\Ups\Api\Normalizer\SubMilestoneNormalizer::class, - - \ShipStream\Ups\Api\Model\TrackApiResponse::class => \ShipStream\Ups\Api\Normalizer\TrackApiResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\TrackResponse::class => \ShipStream\Ups\Api\Normalizer\TrackResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\Warning::class => \ShipStream\Ups\Api\Normalizer\WarningNormalizer::class, - - \ShipStream\Ups\Api\Model\Weight::class => \ShipStream\Ups\Api\Normalizer\WeightNormalizer::class, - - \ShipStream\Ups\Api\Model\Destination::class => \ShipStream\Ups\Api\Normalizer\DestinationNormalizer::class, - - \ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class => \ShipStream\Ups\Api\Normalizer\TrackSubsServiceRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class => \ShipStream\Ups\Api\Normalizer\TrackSubsServiceResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class => \ShipStream\Ups\Api\Normalizer\TrackSubsServiceErrorResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class => \ShipStream\Ups\Api\Normalizer\SecurityV1OauthTokenPostBodyNormalizer::class, - - \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class => \ShipStream\Ups\Api\Normalizer\SecurityV1OauthRefreshPostBodyNormalizer::class, - - \Jane\Component\JsonSchemaRuntime\Reference::class => \ShipStream\Ups\Api\Runtime\Normalizer\ReferenceNormalizer::class, - ], $normalizersCache = []; - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return array_key_exists($type, $this->normalizers); - } - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return is_object($data) && array_key_exists(get_class($data), $this->normalizers); - } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $normalizerClass = $this->normalizers[get_class($object)]; - $normalizer = $this->getNormalizer($normalizerClass); - return $normalizer->normalize($object, $format, $context); - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - $denormalizerClass = $this->normalizers[$type]; - $denormalizer = $this->getNormalizer($denormalizerClass); - return $denormalizer->denormalize($data, $type, $format, $context); - } - private function getNormalizer(string $normalizerClass) - { - return $this->normalizersCache[$normalizerClass] ?? $this->initNormalizer($normalizerClass); - } - private function initNormalizer(string $normalizerClass) - { - $normalizer = new $normalizerClass(); - $normalizer->setNormalizer($this->normalizer); - $normalizer->setDenormalizer($this->denormalizer); - $this->normalizersCache[$normalizerClass] = $normalizer; - return $normalizer; - } - public function getSupportedTypes(?string $format = null): array - { - return [ - - \ShipStream\Ups\Api\Model\XAVRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\XAVResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\XAVRequest::class => false, - \ShipStream\Ups\Api\Model\XAVRequestRequest::class => false, - \ShipStream\Ups\Api\Model\RequestTransactionReference::class => false, - \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class => false, - \ShipStream\Ups\Api\Model\XAVResponse::class => false, - \ShipStream\Ups\Api\Model\XAVResponseResponse::class => false, - \ShipStream\Ups\Api\Model\ResponseResponseStatus::class => false, - \ShipStream\Ups\Api\Model\ResponseAlert::class => false, - \ShipStream\Ups\Api\Model\ResponseTransactionReference::class => false, - \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class => false, - \ShipStream\Ups\Api\Model\XAVResponseCandidate::class => false, - \ShipStream\Ups\Api\Model\CandidateAddressClassification::class => false, - \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class => false, - \ShipStream\Ups\Api\Model\ErrorResponse::class => false, - \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\Error::class => false, - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class => false, - \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class => false, - \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class => false, - \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class => false, - \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class => false, - \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class => false, - \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class => false, - \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class => false, - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentService::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class => false, - \ShipStream\Ups\Api\Model\PackagePackageWeight::class => false, - \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\PackageChemicalRecord::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class => false, - \ShipStream\Ups\Api\Model\ResponseAlertDetail::class => false, - \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class => false, - \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class => false, - \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class => false, - \ShipStream\Ups\Api\Model\LandedCostRequest::class => false, - \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class => false, - \ShipStream\Ups\Api\Model\RequestShipmentItems::class => false, - \ShipStream\Ups\Api\Model\LandedCostResponse::class => false, - \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class => false, - \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class => false, - \ShipStream\Ups\Api\Model\BrokerageFeeItems::class => false, - \ShipStream\Ups\Api\Model\ResponseShipmentItems::class => false, - \ShipStream\Ups\Api\Model\Errors::class => false, - \ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\LocatorRequest::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestRequest::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class => false, - \ShipStream\Ups\Api\Model\OriginAddressGeocode::class => false, - \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class => false, - \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class => false, - \ShipStream\Ups\Api\Model\SearchOptionOptionType::class => false, - \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class => false, - \ShipStream\Ups\Api\Model\SearchOptionRelation::class => false, - \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class => false, - \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class => false, - \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class => false, - \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class => false, - \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class => false, - \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class => false, - \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class => false, - \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class => false, - \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class => false, - \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class => false, - \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class => false, - \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class => false, - \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class => false, - \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class => false, - \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class => false, - \ShipStream\Ups\Api\Model\LocatorResponse::class => false, - \ShipStream\Ups\Api\Model\LocatorResponseResponse::class => false, - \ShipStream\Ups\Api\Model\ResponseError::class => false, - \ShipStream\Ups\Api\Model\ErrorErrorLocation::class => false, - \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class => false, - \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class => false, - \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class => false, - \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class => false, - \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class => false, - \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class => false, - \ShipStream\Ups\Api\Model\DropLocationIVR::class => false, - \ShipStream\Ups\Api\Model\DropLocationGeocode::class => false, - \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class => false, - \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class => false, - \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class => false, - \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class => false, - \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class => false, - \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class => false, - \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class => false, - \ShipStream\Ups\Api\Model\DropLocationDistance::class => false, - \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class => false, - \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class => false, - \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class => false, - \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class => false, - \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class => false, - \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class => false, - \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class => false, - \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class => false, - \ShipStream\Ups\Api\Model\DropLocationSortCode::class => false, - \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class => false, - \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class => false, - \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class => false, - \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class => false, - \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class => false, - \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class => false, - \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class => false, - \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class => false, - \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class => false, - \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class => false, - \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class => false, - \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class => false, - \ShipStream\Ups\Api\Model\DropLocationLocationImage::class => false, - \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class => false, - \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class => false, - \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class => false, - \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class => false, - \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class => false, - \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class => false, - \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class => false, - \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class => false, - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\DeleteRequest::class => false, - \ShipStream\Ups\Api\Model\DeleteRequestRequest::class => false, - \ShipStream\Ups\Api\Model\DeleteResponse::class => false, - \ShipStream\Ups\Api\Model\DeleteResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class => false, - \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class => false, - \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class => false, - \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\UploadRequest::class => false, - \ShipStream\Ups\Api\Model\UploadRequestRequest::class => false, - \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class => false, - \ShipStream\Ups\Api\Model\UploadResponse::class => false, - \ShipStream\Ups\Api\Model\UploadResponseResponse::class => false, - \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class => false, - \ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PickupRateRequest::class => false, - \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class => false, - \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class => false, - \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class => false, - \ShipStream\Ups\Api\Model\PickupRateResponse::class => false, - \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class => false, - \ShipStream\Ups\Api\Model\RateResultChargeDetail::class => false, - \ShipStream\Ups\Api\Model\RateResultTaxCharges::class => false, - \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class => false, - \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PickupCancelRequest::class => false, - \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PickupCancelResponse::class => false, - \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class => false, - \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequest::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class => false, - \ShipStream\Ups\Api\Model\ShipperAccount::class => false, - \ShipStream\Ups\Api\Model\ShipperChargeCard::class => false, - \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class => false, - \ShipStream\Ups\Api\Model\PickupAddressPhone::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class => false, - \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class => false, - \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class => false, - \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class => false, - \ShipStream\Ups\Api\Model\PalletInformationDimensions::class => false, - \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\PickupCreationResponse::class => false, - \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class => false, - \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class => false, - \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class => false, - \ShipStream\Ups\Api\Model\RateResultDisclaimer::class => false, - \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class => false, - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class => false, - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class => false, - \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class => false, - \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class => false, - \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class => false, - \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class => false, - \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class => false, - \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class => false, - \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class => false, - \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class => false, - \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class => false, - \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class => false, - \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class => false, - \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class => false, - \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class => false, - \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class => false, - \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PreNotificationRequest::class => false, - \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class => false, - \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class => false, - \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class => false, - \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class => false, - \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class => false, - \ShipStream\Ups\Api\Model\PreNotificationResponse::class => false, - \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class => false, - \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\QuantumViewRequest::class => false, - \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class => false, - \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class => false, - \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class => false, - \ShipStream\Ups\Api\Model\QuantumViewResponse::class => false, - \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class => false, - \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class => false, - \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class => false, - \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class => false, - \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class => false, - \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class => false, - \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class => false, - \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class => false, - \ShipStream\Ups\Api\Model\ManifestShipper::class => false, - \ShipStream\Ups\Api\Model\ManifestShipperAddress::class => false, - \ShipStream\Ups\Api\Model\ManifestShipTo::class => false, - \ShipStream\Ups\Api\Model\ManifestShipToAddress::class => false, - \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\ManifestService::class => false, - \ShipStream\Ups\Api\Model\ManifestPackage::class => false, - \ShipStream\Ups\Api\Model\PackageActivity::class => false, - \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class => false, - \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class => false, - \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class => false, - \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class => false, - \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class => false, - \ShipStream\Ups\Api\Model\CODCODAmount::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class => false, - \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class => false, - \ShipStream\Ups\Api\Model\ManifestCustomsValue::class => false, - \ShipStream\Ups\Api\Model\ManifestBillToAccount::class => false, - \ShipStream\Ups\Api\Model\ManifestUAPAddress::class => false, - \ShipStream\Ups\Api\Model\UAPAddressAddress::class => false, - \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class => false, - \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\OriginActivityLocation::class => false, - \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class => false, - \ShipStream\Ups\Api\Model\OriginBillToAccount::class => false, - \ShipStream\Ups\Api\Model\SubscriptionFileException::class => false, - \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class => false, - \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class => false, - \ShipStream\Ups\Api\Model\ExceptionResolution::class => false, - \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class => false, - \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class => false, - \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class => false, - \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class => false, - \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class => false, - \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class => false, - \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class => false, - \ShipStream\Ups\Api\Model\DeliveryCOD::class => false, - \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class => false, - \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class => false, - \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\GenericService::class => false, - \ShipStream\Ups\Api\Model\GenericActivity::class => false, - \ShipStream\Ups\Api\Model\GenericBillToAccount::class => false, - \ShipStream\Ups\Api\Model\GenericShipTo::class => false, - \ShipStream\Ups\Api\Model\GenericFailureNotification::class => false, - \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class => false, - \ShipStream\Ups\Api\Model\RATERequestWrapper::class => false, - \ShipStream\Ups\Api\Model\RATEResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\RateRequest::class => false, - \ShipStream\Ups\Api\Model\RateRequestRequest::class => false, - \ShipStream\Ups\Api\Model\RateRequestPickupType::class => false, - \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class => false, - \ShipStream\Ups\Api\Model\RateRequestShipment::class => false, - \ShipStream\Ups\Api\Model\RateShipmentShipper::class => false, - \ShipStream\Ups\Api\Model\ShipperAddress::class => false, - \ShipStream\Ups\Api\Model\RateShipmentShipTo::class => false, - \ShipStream\Ups\Api\Model\ShipToAddress::class => false, - \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class => false, - \ShipStream\Ups\Api\Model\ShipFromAddress::class => false, - \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class => false, - \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class => false, - \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class => false, - \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class => false, - \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class => false, - \ShipStream\Ups\Api\Model\BillReceiverAddress::class => false, - \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class => false, - \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class => false, - \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class => false, - \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class => false, - \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class => false, - \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class => false, - \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class => false, - \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitsType::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class => false, - \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\RateShipmentPackage::class => false, - \ShipStream\Ups\Api\Model\PackagePackagingType::class => false, - \ShipStream\Ups\Api\Model\PackageDimensions::class => false, - \ShipStream\Ups\Api\Model\PackageDimWeight::class => false, - \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\PackageCommodity::class => false, - \ShipStream\Ups\Api\Model\CommodityNMFC::class => false, - \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class => false, - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class => false, - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class => false, - \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class => false, - \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class => false, - \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class => false, - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class => false, - \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class => false, - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class => false, - \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class => false, - \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\PackageSimpleRate::class => false, - \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class => false, - \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class => false, - \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class => false, - \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class => false, - \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class => false, - \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class => false, - \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class => false, - \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class => false, - \ShipStream\Ups\Api\Model\RateResponse::class => false, - \ShipStream\Ups\Api\Model\RateResponseResponse::class => false, - \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentService::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class => false, - \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class => false, - \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class => false, - \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class => false, - \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class => false, - \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class => false, - \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class => false, - \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class => false, - \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class => false, - \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class => false, - \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class => false, - \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class => false, - \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class => false, - \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class => false, - \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class => false, - \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class => false, - \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class => false, - \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class => false, - \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class => false, - \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class => false, - \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class => false, - \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class => false, - \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class => false, - \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class => false, - \ShipStream\Ups\Api\Model\ServiceSummaryService::class => false, - \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class => false, - \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class => false, - \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class => false, - \ShipStream\Ups\Api\Model\SHIPRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\SHIPResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\ShipmentRequest::class => false, - \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class => false, - \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class => false, - \ShipStream\Ups\Api\Model\ShipmentReturnService::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipper::class => false, - \ShipStream\Ups\Api\Model\ShipperPhone::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipTo::class => false, - \ShipStream\Ups\Api\Model\ShipToPhone::class => false, - \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class => false, - \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipFrom::class => false, - \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class => false, - \ShipStream\Ups\Api\Model\ShipFromPhone::class => false, - \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class => false, - \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class => false, - \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class => false, - \ShipStream\Ups\Api\Model\BillShipperCreditCard::class => false, - \ShipStream\Ups\Api\Model\CreditCardAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class => false, - \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class => false, - \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class => false, - \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class => false, - \ShipStream\Ups\Api\Model\NotificationEMail::class => false, - \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class => false, - \ShipStream\Ups\Api\Model\NotificationTextMessage::class => false, - \ShipStream\Ups\Api\Model\NotificationLocale::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class => false, - \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class => false, - \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class => false, - \ShipStream\Ups\Api\Model\CN22FormCN22Content::class => false, - \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class => false, - \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class => false, - \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class => false, - \ShipStream\Ups\Api\Model\UPSFiledPOA::class => false, - \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsContacts::class => false, - \ShipStream\Ups\Api\Model\ContactsForwardAgent::class => false, - \ShipStream\Ups\Api\Model\ForwardAgentAddress::class => false, - \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class => false, - \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class => false, - \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class => false, - \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class => false, - \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class => false, - \ShipStream\Ups\Api\Model\ContactsProducer::class => false, - \ShipStream\Ups\Api\Model\ProducerAddress::class => false, - \ShipStream\Ups\Api\Model\ProducerPhone::class => false, - \ShipStream\Ups\Api\Model\ContactsSoldTo::class => false, - \ShipStream\Ups\Api\Model\SoldToPhone::class => false, - \ShipStream\Ups\Api\Model\SoldToAddress::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsProduct::class => false, - \ShipStream\Ups\Api\Model\ProductUnit::class => false, - \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class => false, - \ShipStream\Ups\Api\Model\ProductProductWeight::class => false, - \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\ProductScheduleB::class => false, - \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class => false, - \ShipStream\Ups\Api\Model\ProductPackingListInfo::class => false, - \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class => false, - \ShipStream\Ups\Api\Model\ProductEEIInformation::class => false, - \ShipStream\Ups\Api\Model\EEIInformationLicense::class => false, - \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class => false, - \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class => false, - \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class => false, - \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class => false, - \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class => false, - \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class => false, - \ShipStream\Ups\Api\Model\ShipmentPackage::class => false, - \ShipStream\Ups\Api\Model\PackagePackaging::class => false, - \ShipStream\Ups\Api\Model\PackageReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\PackageUPSPremier::class => false, - \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class => false, - \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class => false, - \ShipStream\Ups\Api\Model\DeclaredValueType::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class => false, - \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class => false, - \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class => false, - \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class => false, - \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class => false, - \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class => false, - \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class => false, - \ShipStream\Ups\Api\Model\ShipmentResponse::class => false, - \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class => false, - \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class => false, - \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class => false, - \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class => false, - \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class => false, - \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class => false, - \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class => false, - \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class => false, - \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class => false, - \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class => false, - \ShipStream\Ups\Api\Model\PackageResultsForm::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class => false, - \ShipStream\Ups\Api\Model\FormImage::class => false, - \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\ImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class => false, - \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class => false, - \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class => false, - \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsForm::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class => false, - \ShipStream\Ups\Api\Model\CODTurnInPageImage::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class => false, - \ShipStream\Ups\Api\Model\HighValueReportImage::class => false, - \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentRequest::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class => false, - \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentResponse::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class => false, - \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class => false, - \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class => false, - \ShipStream\Ups\Api\Model\SummaryResultStatus::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class => false, - \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class => false, - \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class => false, - \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class => false, - \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class => false, - \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class => false, - \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class => false, - \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class => false, - \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class => false, - \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelResultsReceipt::class => false, - \ShipStream\Ups\Api\Model\ReceiptImage::class => false, - \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelResultsForm::class => false, - \ShipStream\Ups\Api\Model\LRFormImage::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class => false, - \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class => false, - \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class => false, - \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class => false, - \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequest::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class => false, - \ShipStream\Ups\Api\Model\RequesterPhone::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class => false, - \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class => false, - \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class => false, - \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class => false, - \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class => false, - \ShipStream\Ups\Api\Model\POMPickupNotifications::class => false, - \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class => false, - \ShipStream\Ups\Api\Model\FreightPickupResponse::class => false, - \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class => false, - \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class => false, - \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class => false, - \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class => false, - \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class => false, - \ShipStream\Ups\Api\Model\FreightCancelStatus::class => false, - \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class => false, - \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequest::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class => false, - \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class => false, - \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class => false, - \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class => false, - \ShipStream\Ups\Api\Model\PayerAddress::class => false, - \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestService::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitOneType::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class => false, - \ShipStream\Ups\Api\Model\CommodityWeight::class => false, - \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class => false, - \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\CommodityDimensions::class => false, - \ShipStream\Ups\Api\Model\CommodityPackagingType::class => false, - \ShipStream\Ups\Api\Model\CommodityCommodityValue::class => false, - \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class => false, - \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class => false, - \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class => false, - \ShipStream\Ups\Api\Model\OverSeasLegValue::class => false, - \ShipStream\Ups\Api\Model\ValueCube::class => false, - \ShipStream\Ups\Api\Model\ValueCWT::class => false, - \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class => false, - \ShipStream\Ups\Api\Model\CODCODValue::class => false, - \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class => false, - \ShipStream\Ups\Api\Model\CODCODBillingOption::class => false, - \ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class => false, - \ShipStream\Ups\Api\Model\RemitToAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class => false, - \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class => false, - \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class => false, - \ShipStream\Ups\Api\Model\HandlingChargeAmount::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class => false, - \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponse::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseRate::class => false, - \ShipStream\Ups\Api\Model\RateType::class => false, - \ShipStream\Ups\Api\Model\RateFactor::class => false, - \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class => false, - \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseService::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class => false, - \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class => false, - \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class => false, - \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class => false, - \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class => false, - \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class => false, - \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\FreightShipRequest::class => false, - \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class => false, - \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class => false, - \ShipStream\Ups\Api\Model\PaymentInformationPayer::class => false, - \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class => false, - \ShipStream\Ups\Api\Model\PayerPhone::class => false, - \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class => false, - \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class => false, - \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class => false, - \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class => false, - \ShipStream\Ups\Api\Model\ConfirmationNumberType::class => false, - \ShipStream\Ups\Api\Model\ShipmentCommodity::class => false, - \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class => false, - \ShipStream\Ups\Api\Model\ShipmentReference::class => false, - \ShipStream\Ups\Api\Model\ReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\ReferenceWeight::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class => false, - \ShipStream\Ups\Api\Model\EMailInformationEMailType::class => false, - \ShipStream\Ups\Api\Model\EMailInformationEMail::class => false, - \ShipStream\Ups\Api\Model\CODRemitTo::class => false, - \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class => false, - \ShipStream\Ups\Api\Model\RemitToPhone::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class => false, - \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class => false, - \ShipStream\Ups\Api\Model\PickupRequestRequester::class => false, - \ShipStream\Ups\Api\Model\PickupRequestPOM::class => false, - \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class => false, - \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class => false, - \ShipStream\Ups\Api\Model\ShipmentDocuments::class => false, - \ShipStream\Ups\Api\Model\DocumentsImage::class => false, - \ShipStream\Ups\Api\Model\ImageType::class => false, - \ShipStream\Ups\Api\Model\ImageFormat::class => false, - \ShipStream\Ups\Api\Model\ImagePrintFormat::class => false, - \ShipStream\Ups\Api\Model\ImagePrintSize::class => false, - \ShipStream\Ups\Api\Model\DocumentsPackingList::class => false, - \ShipStream\Ups\Api\Model\PackingListShipFrom::class => false, - \ShipStream\Ups\Api\Model\PackingListShipTo::class => false, - \ShipStream\Ups\Api\Model\PackingListReference::class => false, - \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class => false, - \ShipStream\Ups\Api\Model\FreightShipResponse::class => false, - \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class => false, - \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsRate::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsService::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class => false, - \ShipStream\Ups\Api\Model\DocumentsForms::class => false, - \ShipStream\Ups\Api\Model\FormsType::class => false, - \ShipStream\Ups\Api\Model\FormsFormat::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class => false, - \ShipStream\Ups\Api\Model\TimeInTransitRequest::class => false, - \ShipStream\Ups\Api\Model\TimeInTransitResponse::class => false, - \ShipStream\Ups\Api\Model\ValidationList::class => false, - \ShipStream\Ups\Api\Model\EmsResponse::class => false, - \ShipStream\Ups\Api\Model\CandidateAddress::class => false, - \ShipStream\Ups\Api\Model\Services::class => false, - \ShipStream\Ups\Api\Model\AccessPointInformation::class => false, - \ShipStream\Ups\Api\Model\Activity::class => false, - \ShipStream\Ups\Api\Model\Address::class => false, - \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class => false, - \ShipStream\Ups\Api\Model\DeliveryDate::class => false, - \ShipStream\Ups\Api\Model\DeliveryInformation::class => false, - \ShipStream\Ups\Api\Model\DeliveryTime::class => false, - \ShipStream\Ups\Api\Model\InquireNumbers::class => false, - \ShipStream\Ups\Api\Model\Location::class => false, - \ShipStream\Ups\Api\Model\Milestones::class => false, - \ShipStream\Ups\Api\Model\Package::class => false, - \ShipStream\Ups\Api\Model\PackageAddress::class => false, - \ShipStream\Ups\Api\Model\PaymentInformation::class => false, - \ShipStream\Ups\Api\Model\Service::class => false, - \ShipStream\Ups\Api\Model\Shipment::class => false, - \ShipStream\Ups\Api\Model\Signature::class => false, - \ShipStream\Ups\Api\Model\Status::class => false, - \ShipStream\Ups\Api\Model\SubMilestone::class => false, - \ShipStream\Ups\Api\Model\TrackApiResponse::class => false, - \ShipStream\Ups\Api\Model\TrackResponse::class => false, - \ShipStream\Ups\Api\Model\Warning::class => false, - \ShipStream\Ups\Api\Model\Weight::class => false, - \ShipStream\Ups\Api\Model\Destination::class => false, - \ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class => false, - \ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class => false, - \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class => false, - \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class => false, - \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class => false, - \Jane\Component\JsonSchemaRuntime\Reference::class => false, - ]; - } - } -} else { - class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - protected $normalizers = [ - - \ShipStream\Ups\Api\Model\XAVRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\XAVRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\XAVResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVRequest::class => \ShipStream\Ups\Api\Normalizer\XAVRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVRequestRequest::class => \ShipStream\Ups\Api\Normalizer\XAVRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\RequestTransactionReference::class => \ShipStream\Ups\Api\Normalizer\RequestTransactionReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\XAVRequestAddressKeyFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVResponse::class => \ShipStream\Ups\Api\Normalizer\XAVResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVResponseResponse::class => \ShipStream\Ups\Api\Normalizer\XAVResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ResponseResponseStatus::class => \ShipStream\Ups\Api\Normalizer\ResponseResponseStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\ResponseAlert::class => \ShipStream\Ups\Api\Normalizer\ResponseAlertNormalizer::class, - - \ShipStream\Ups\Api\Model\ResponseTransactionReference::class => \ShipStream\Ups\Api\Normalizer\ResponseTransactionReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class => \ShipStream\Ups\Api\Normalizer\XAVResponseAddressClassificationNormalizer::class, - - \ShipStream\Ups\Api\Model\XAVResponseCandidate::class => \ShipStream\Ups\Api\Normalizer\XAVResponseCandidateNormalizer::class, - - \ShipStream\Ups\Api\Model\CandidateAddressClassification::class => \ShipStream\Ups\Api\Normalizer\CandidateAddressClassificationNormalizer::class, - - \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\CandidateAddressKeyFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ErrorResponse::class => \ShipStream\Ups\Api\Normalizer\ErrorResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\ErrorResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\Error::class => \ShipStream\Ups\Api\Normalizer\ErrorNormalizer::class, - - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\DANGEROUSGOODSUTILITYRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\DANGEROUSGOODSUTILITYResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class => \ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataResponseChemicalDataNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class => \ShipStream\Ups\Api\Normalizer\ChemicalDataChemicalDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class => \ShipStream\Ups\Api\Normalizer\ChemicalDataProperShippingNameDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class => \ShipStream\Ups\Api\Normalizer\ChemicalDataPackageQuantityLimitDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\DANGEROUSGOODSUTILITYAPCRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\DANGEROUSGOODSUTILITYAPCResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckRequestShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckShipmentShipFromAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckShipmentShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentService::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckShipmentPackageNormalizer::class, - - \ShipStream\Ups\Api\Model\PackagePackageWeight::class => \ShipStream\Ups\Api\Normalizer\PackagePackageWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\PackageWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageChemicalRecord::class => \ShipStream\Ups\Api\Normalizer\PackageChemicalRecordNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ResponseAlertDetail::class => \ShipStream\Ups\Api\Normalizer\ResponseAlertDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class => \ShipStream\Ups\Api\Normalizer\AlertDetailElementLevelInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class => \ShipStream\Ups\Api\Normalizer\ElementLevelInformationElementIdentifierNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponseServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class => \ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponsePackageResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class => \ShipStream\Ups\Api\Normalizer\PackageResultsChemicalRecordResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\LandedCostRequest::class => \ShipStream\Ups\Api\Normalizer\LandedCostRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class => \ShipStream\Ups\Api\Normalizer\LandedCostRequestShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\RequestShipmentItems::class => \ShipStream\Ups\Api\Normalizer\RequestShipmentItemsNormalizer::class, - - \ShipStream\Ups\Api\Model\LandedCostResponse::class => \ShipStream\Ups\Api\Normalizer\LandedCostResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class => \ShipStream\Ups\Api\Normalizer\LandedCostResponseShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class => \ShipStream\Ups\Api\Normalizer\LandedCostResponseShipmentPerfStatsNormalizer::class, - - \ShipStream\Ups\Api\Model\BrokerageFeeItems::class => \ShipStream\Ups\Api\Normalizer\BrokerageFeeItemsNormalizer::class, - - \ShipStream\Ups\Api\Model\ResponseShipmentItems::class => \ShipStream\Ups\Api\Normalizer\ResponseShipmentItemsNormalizer::class, - - \ShipStream\Ups\Api\Model\Errors::class => \ShipStream\Ups\Api\Normalizer\ErrorsNormalizer::class, - - \ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\LOCATORRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\LOCATORResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequest::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestRequest::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestOriginAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginAddressGeocode::class => \ShipStream\Ups\Api\Normalizer\OriginAddressGeocodeNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\OriginAddressAddressKeyFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestTranslateNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestLocationSearchCriteriaNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaSearchOptionNormalizer::class, - - \ShipStream\Ups\Api\Model\SearchOptionOptionType::class => \ShipStream\Ups\Api\Normalizer\SearchOptionOptionTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class => \ShipStream\Ups\Api\Normalizer\SearchOptionOptionCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\SearchOptionRelation::class => \ShipStream\Ups\Api\Normalizer\SearchOptionRelationNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaServiceSearchNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class => \ShipStream\Ups\Api\Normalizer\ServiceSearchServiceCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class => \ShipStream\Ups\Api\Normalizer\ServiceSearchServiceOptionCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaFreightWillCallSearchNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class => \ShipStream\Ups\Api\Normalizer\FreightWillCallSearchFacilityAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaAccessPointSearchNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class => \ShipStream\Ups\Api\Normalizer\AccessPointSearchIncludeCriteriaNormalizer::class, - - \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class => \ShipStream\Ups\Api\Normalizer\IncludeCriteriaMerchantAccountNumberListNormalizer::class, - - \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class => \ShipStream\Ups\Api\Normalizer\IncludeCriteriaSearchFilterNormalizer::class, - - \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class => \ShipStream\Ups\Api\Normalizer\IncludeCriteriaServiceOfferingListNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class => \ShipStream\Ups\Api\Normalizer\ServiceOfferingListServiceOfferingNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class => \ShipStream\Ups\Api\Normalizer\AccessPointSearchExcludeFromResultNormalizer::class, - - \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class => \ShipStream\Ups\Api\Normalizer\ExcludeFromResultPostalCodeListNormalizer::class, - - \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class => \ShipStream\Ups\Api\Normalizer\PostalCodeListPostalCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class => \ShipStream\Ups\Api\Normalizer\LocationSearchCriteriaOpenTimeCriteriaNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestSortCriteriaNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class => \ShipStream\Ups\Api\Normalizer\LocatorRequestServiceGeoUnitNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorResponse::class => \ShipStream\Ups\Api\Normalizer\LocatorResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorResponseResponse::class => \ShipStream\Ups\Api\Normalizer\LocatorResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ResponseError::class => \ShipStream\Ups\Api\Normalizer\ResponseErrorNormalizer::class, - - \ShipStream\Ups\Api\Model\ErrorErrorLocation::class => \ShipStream\Ups\Api\Normalizer\ErrorErrorLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class => \ShipStream\Ups\Api\Normalizer\LocatorResponseGeocodeNormalizer::class, - - \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class => \ShipStream\Ups\Api\Normalizer\LocatorResponseSearchResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class => \ShipStream\Ups\Api\Normalizer\SearchResultsGeocodeCandidateNormalizer::class, - - \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\GeocodeCandidateAddressKeyFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class => \ShipStream\Ups\Api\Normalizer\GeocodeCandidateGeocodeNormalizer::class, - - \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class => \ShipStream\Ups\Api\Normalizer\SearchResultsDropLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationIVR::class => \ShipStream\Ups\Api\Normalizer\DropLocationIVRNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationGeocode::class => \ShipStream\Ups\Api\Normalizer\DropLocationGeocodeNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class => \ShipStream\Ups\Api\Normalizer\DropLocationAddressKeyFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class => \ShipStream\Ups\Api\Normalizer\DropLocationLocationAttributeNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class => \ShipStream\Ups\Api\Normalizer\LocationAttributeOptionTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class => \ShipStream\Ups\Api\Normalizer\LocationAttributeOptionCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class => \ShipStream\Ups\Api\Normalizer\OptionCodeTransportationPickUpScheduleNormalizer::class, - - \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class => \ShipStream\Ups\Api\Normalizer\TransportationPickUpSchedulePickUpNormalizer::class, - - \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class => \ShipStream\Ups\Api\Normalizer\PickUpPickUpDetailsNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationDistance::class => \ShipStream\Ups\Api\Normalizer\DropLocationDistanceNormalizer::class, - - \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DistanceUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class => \ShipStream\Ups\Api\Normalizer\DropLocationSpecialInstructionsNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class => \ShipStream\Ups\Api\Normalizer\DropLocationAdditionalCommentsNormalizer::class, - - \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class => \ShipStream\Ups\Api\Normalizer\AdditionalCommentsCommentTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class => \ShipStream\Ups\Api\Normalizer\DropLocationOperatingHoursNormalizer::class, - - \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class => \ShipStream\Ups\Api\Normalizer\OperatingHoursStandardHoursNormalizer::class, - - \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class => \ShipStream\Ups\Api\Normalizer\StandardHoursDayOfWeekNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class => \ShipStream\Ups\Api\Normalizer\DropLocationLocalizedInstructionNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class => \ShipStream\Ups\Api\Normalizer\DropLocationPromotionInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationSortCode::class => \ShipStream\Ups\Api\Normalizer\DropLocationSortCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class => \ShipStream\Ups\Api\Normalizer\DropLocationServiceOfferingListNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class => \ShipStream\Ups\Api\Normalizer\DropLocationAccessPointInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationBusinessClassificationListNormalizer::class, - - \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class => \ShipStream\Ups\Api\Normalizer\BusinessClassificationListBusinessClassificationNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationAccessPointStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationPrivateNetworkListNormalizer::class, - - \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class => \ShipStream\Ups\Api\Normalizer\PrivateNetworkListPrivateNetworkNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationAvailabilityNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class => \ShipStream\Ups\Api\Normalizer\AvailabilityShippingAvailabilityNormalizer::class, - - \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class => \ShipStream\Ups\Api\Normalizer\ShippingAvailabilityUnavailableReasonNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class => \ShipStream\Ups\Api\Normalizer\AvailabilityDCRAvailabilityNormalizer::class, - - \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class => \ShipStream\Ups\Api\Normalizer\DCRAvailabilityUnavailableReasonNormalizer::class, - - \ShipStream\Ups\Api\Model\DropLocationLocationImage::class => \ShipStream\Ups\Api\Normalizer\DropLocationLocationImageNormalizer::class, - - \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class => \ShipStream\Ups\Api\Normalizer\SearchResultsAvailableLocationAttributesNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesOptionTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesOptionCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesOptionCodeTransportationPickUpScheduleNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesTransportationPickUpSchedulePickUpNormalizer::class, - - \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class => \ShipStream\Ups\Api\Normalizer\AvailableLocationAttributesPickUpPickUpDetailsNormalizer::class, - - \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class => \ShipStream\Ups\Api\Normalizer\GenerateTokenSuccessResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class => \ShipStream\Ups\Api\Normalizer\RefreshTokenSuccessResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTDeleteRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTDeleteResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\DeleteRequest::class => \ShipStream\Ups\Api\Normalizer\DeleteRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\DeleteRequestRequest::class => \ShipStream\Ups\Api\Normalizer\DeleteRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\DeleteResponse::class => \ShipStream\Ups\Api\Normalizer\DeleteResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\DeleteResponseResponse::class => \ShipStream\Ups\Api\Normalizer\DeleteResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryRequestFormsHistoryDocumentIDNormalizer::class, - - \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PushToImageRepositoryResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTUploadRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PAPERLESSDOCUMENTUploadResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\UploadRequest::class => \ShipStream\Ups\Api\Normalizer\UploadRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\UploadRequestRequest::class => \ShipStream\Ups\Api\Normalizer\UploadRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class => \ShipStream\Ups\Api\Normalizer\UploadRequestUserCreatedFormNormalizer::class, - - \ShipStream\Ups\Api\Model\UploadResponse::class => \ShipStream\Ups\Api\Normalizer\UploadResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\UploadResponseResponse::class => \ShipStream\Ups\Api\Normalizer\UploadResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class => \ShipStream\Ups\Api\Normalizer\UploadResponseFormsHistoryDocumentIDNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateRequest::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestShipperAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestPickupAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class => \ShipStream\Ups\Api\Normalizer\PickupRateRequestPickupDateInfoNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateResponse::class => \ShipStream\Ups\Api\Normalizer\PickupRateResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupRateResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class => \ShipStream\Ups\Api\Normalizer\PickupRateResponseRateResultNormalizer::class, - - \ShipStream\Ups\Api\Model\RateResultChargeDetail::class => \ShipStream\Ups\Api\Normalizer\RateResultChargeDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\RateResultTaxCharges::class => \ShipStream\Ups\Api\Normalizer\RateResultTaxChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class => \ShipStream\Ups\Api\Normalizer\PickupRateResponseWeekendServiceTerritoryNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPCancelRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPCancelResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCancelRequest::class => \ShipStream\Ups\Api\Normalizer\PickupCancelRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupCancelRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCancelResponse::class => \ShipStream\Ups\Api\Normalizer\PickupCancelResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupCancelResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class => \ShipStream\Ups\Api\Normalizer\PickupCancelResponseGWNStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPCreationRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPCreationResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequest::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestShipperNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipperAccount::class => \ShipStream\Ups\Api\Normalizer\ShipperAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipperChargeCard::class => \ShipStream\Ups\Api\Normalizer\ShipperChargeCardNormalizer::class, - - \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class => \ShipStream\Ups\Api\Normalizer\ChargeCardCardAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestPickupDateInfoNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestPickupAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupAddressPhone::class => \ShipStream\Ups\Api\Normalizer\PickupAddressPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestPickupPieceNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestTotalWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestTrackingDataNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestTrackingDataWithReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class => \ShipStream\Ups\Api\Normalizer\PickupCreationRequestFreightOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\FreightOptionsShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class => \ShipStream\Ups\Api\Normalizer\FreightOptionsDestinationAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class => \ShipStream\Ups\Api\Normalizer\FreightOptionsShipmentDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentDetailPalletInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\PalletInformationDimensions::class => \ShipStream\Ups\Api\Normalizer\PalletInformationDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DimensionsUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationResponse::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseWeekendServiceTerritoryNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseRateStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class => \ShipStream\Ups\Api\Normalizer\PickupCreationResponseRateResultNormalizer::class, - - \ShipStream\Ups\Api\Model\RateResultDisclaimer::class => \ShipStream\Ups\Api\Normalizer\RateResultDisclaimerNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPPolDivRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPPolDivResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class => \ShipStream\Ups\Api\Normalizer\PickupGetPoliticalDivision1ListRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupGetPoliticalDivision1ListRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class => \ShipStream\Ups\Api\Normalizer\PickupGetPoliticalDivision1ListResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupGetPoliticalDivision1ListResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPServCenterRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPServCenterResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestPickupPieceNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestOriginAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class => \ShipStream\Ups\Api\Normalizer\OriginAddressOriginSearchCriteriaNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesRequestDestinationAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class => \ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class => \ShipStream\Ups\Api\Normalizer\ServiceCenterLocationDropOffFacilitiesNormalizer::class, - - \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class => \ShipStream\Ups\Api\Normalizer\DropOffFacilitiesAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class => \ShipStream\Ups\Api\Normalizer\DropOffFacilitiesFacilityTimeNormalizer::class, - - \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class => \ShipStream\Ups\Api\Normalizer\FacilityTimeDayOfWeekNormalizer::class, - - \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class => \ShipStream\Ups\Api\Normalizer\DropOffFacilitiesLocalizedInstructionNormalizer::class, - - \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class => \ShipStream\Ups\Api\Normalizer\DropOffFacilitiesDistanceNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class => \ShipStream\Ups\Api\Normalizer\ServiceCenterLocationPickupFacilitiesNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class => \ShipStream\Ups\Api\Normalizer\PickupFacilitiesAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class => \ShipStream\Ups\Api\Normalizer\PickupFacilitiesFacilityTimeNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class => \ShipStream\Ups\Api\Normalizer\PickupFacilitiesFacilityTimeDayOfWeekNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPPendingRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PICKUPPendingResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class => \ShipStream\Ups\Api\Normalizer\PickupPendingStatusResponsePendingStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\PRENOTIFICATIONRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\PRENOTIFICATIONResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationRequest::class => \ShipStream\Ups\Api\Normalizer\PreNotificationRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class => \ShipStream\Ups\Api\Normalizer\PreNotificationRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class => \ShipStream\Ups\Api\Normalizer\PreNotificationRequestShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class => \ShipStream\Ups\Api\Normalizer\PreNotificationShipmentShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\PreNotificationShipmentShipFromAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class => \ShipStream\Ups\Api\Normalizer\PreNotificationShipmentPackageNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class => \ShipStream\Ups\Api\Normalizer\PreNotificationPackageChemicalRecordNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationResponse::class => \ShipStream\Ups\Api\Normalizer\PreNotificationResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class => \ShipStream\Ups\Api\Normalizer\PreNotificationResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\QUANTUMVIEWRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\QUANTUMVIEWResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewRequest::class => \ShipStream\Ups\Api\Normalizer\QuantumViewRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class => \ShipStream\Ups\Api\Normalizer\QuantumViewRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class => \ShipStream\Ups\Api\Normalizer\QuantumViewRequestSubscriptionRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class => \ShipStream\Ups\Api\Normalizer\SubscriptionRequestDateTimeRangeNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewResponse::class => \ShipStream\Ups\Api\Normalizer\QuantumViewResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class => \ShipStream\Ups\Api\Normalizer\QuantumViewResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class => \ShipStream\Ups\Api\Normalizer\QuantumViewResponseQuantumViewEventsNormalizer::class, - - \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class => \ShipStream\Ups\Api\Normalizer\QuantumViewEventsSubscriptionEventsNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class => \ShipStream\Ups\Api\Normalizer\SubscriptionEventsSubscriptionStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class => \ShipStream\Ups\Api\Normalizer\SubscriptionEventsDateRangeNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class => \ShipStream\Ups\Api\Normalizer\SubscriptionEventsSubscriptionFileNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileStatusTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileManifestNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestShipper::class => \ShipStream\Ups\Api\Normalizer\ManifestShipperNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestShipperAddress::class => \ShipStream\Ups\Api\Normalizer\ManifestShipperAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestShipTo::class => \ShipStream\Ups\Api\Normalizer\ManifestShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestShipToAddress::class => \ShipStream\Ups\Api\Normalizer\ManifestShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ManifestReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestService::class => \ShipStream\Ups\Api\Normalizer\ManifestServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestPackage::class => \ShipStream\Ups\Api\Normalizer\ManifestPackageNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageActivity::class => \ShipStream\Ups\Api\Normalizer\PackageActivityNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class => \ShipStream\Ups\Api\Normalizer\ManifestPackageDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class => \ShipStream\Ups\Api\Normalizer\PackageDimensionalWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DimensionalWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class => \ShipStream\Ups\Api\Normalizer\ManifestPackagePackageWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ManifestPackageReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class => \ShipStream\Ups\Api\Normalizer\ManifestPackagePackageServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class => \ShipStream\Ups\Api\Normalizer\ManifestPackageServiceOptionsCODNormalizer::class, - - \ShipStream\Ups\Api\Model\CODCODAmount::class => \ShipStream\Ups\Api\Normalizer\CODCODAmountNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsInsuredValueNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\ManifestShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsCallTagARSNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestCustomsValue::class => \ShipStream\Ups\Api\Normalizer\ManifestCustomsValueNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestBillToAccount::class => \ShipStream\Ups\Api\Normalizer\ManifestBillToAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\ManifestUAPAddress::class => \ShipStream\Ups\Api\Normalizer\ManifestUAPAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\UAPAddressAddress::class => \ShipStream\Ups\Api\Normalizer\UAPAddressAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileOriginNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\OriginPackageReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\OriginShipmentReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginActivityLocation::class => \ShipStream\Ups\Api\Normalizer\OriginActivityLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class => \ShipStream\Ups\Api\Normalizer\ActivityLocationAddressArtifactFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\OriginBillToAccount::class => \ShipStream\Ups\Api\Normalizer\OriginBillToAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionFileException::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileExceptionNormalizer::class, - - \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ExceptionPackageReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ExceptionShipmentReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class => \ShipStream\Ups\Api\Normalizer\ExceptionUpdatedAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class => \ShipStream\Ups\Api\Normalizer\UpdatedAddressAddressExtendedInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\ExceptionResolution::class => \ShipStream\Ups\Api\Normalizer\ExceptionResolutionNormalizer::class, - - \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class => \ShipStream\Ups\Api\Normalizer\ExceptionActivityLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class => \ShipStream\Ups\Api\Normalizer\ExceptionBillToAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileDeliveryNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\DeliveryPackageReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\DeliveryShipmentReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class => \ShipStream\Ups\Api\Normalizer\DeliveryActivityLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class => \ShipStream\Ups\Api\Normalizer\DeliveryDeliveryLocationNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class => \ShipStream\Ups\Api\Normalizer\DeliveryLocationAddressArtifactFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class => \ShipStream\Ups\Api\Normalizer\AddressArtifactFormatAddressExtendedInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryCOD::class => \ShipStream\Ups\Api\Normalizer\DeliveryCODNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class => \ShipStream\Ups\Api\Normalizer\DeliveryBillToAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class => \ShipStream\Ups\Api\Normalizer\SubscriptionFileGenericNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\GenericShipmentReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\GenericPackageReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericService::class => \ShipStream\Ups\Api\Normalizer\GenericServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericActivity::class => \ShipStream\Ups\Api\Normalizer\GenericActivityNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericBillToAccount::class => \ShipStream\Ups\Api\Normalizer\GenericBillToAccountNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericShipTo::class => \ShipStream\Ups\Api\Normalizer\GenericShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\GenericFailureNotification::class => \ShipStream\Ups\Api\Normalizer\GenericFailureNotificationNormalizer::class, - - \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class => \ShipStream\Ups\Api\Normalizer\FailureNotificationFailureNotificationCodeNormalizer::class, - - \ShipStream\Ups\Api\Model\RATERequestWrapper::class => \ShipStream\Ups\Api\Normalizer\RATERequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\RATEResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\RATEResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\RateRequest::class => \ShipStream\Ups\Api\Normalizer\RateRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\RateRequestRequest::class => \ShipStream\Ups\Api\Normalizer\RateRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\RateRequestPickupType::class => \ShipStream\Ups\Api\Normalizer\RateRequestPickupTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class => \ShipStream\Ups\Api\Normalizer\RateRequestCustomerClassificationNormalizer::class, - - \ShipStream\Ups\Api\Model\RateRequestShipment::class => \ShipStream\Ups\Api\Normalizer\RateRequestShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentShipper::class => \ShipStream\Ups\Api\Normalizer\RateShipmentShipperNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipperAddress::class => \ShipStream\Ups\Api\Normalizer\ShipperAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentShipTo::class => \ShipStream\Ups\Api\Normalizer\RateShipmentShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipToAddress::class => \ShipStream\Ups\Api\Normalizer\ShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class => \ShipStream\Ups\Api\Normalizer\RateShipmentShipFromNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\ShipFromAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class => \ShipStream\Ups\Api\Normalizer\RateShipmentAlternateDeliveryAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class => \ShipStream\Ups\Api\Normalizer\RateAlternateDeliveryAddressAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipmentIndicationTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class => \ShipStream\Ups\Api\Normalizer\ShipmentPaymentDetailsNormalizer::class, - - \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class => \ShipStream\Ups\Api\Normalizer\PaymentDetailsShipmentChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class => \ShipStream\Ups\Api\Normalizer\RateShipmentChargeBillShipperNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargeBillReceiverNormalizer::class, - - \ShipStream\Ups\Api\Model\BillReceiverAddress::class => \ShipStream\Ups\Api\Normalizer\BillReceiverAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class => \ShipStream\Ups\Api\Normalizer\RateShipmentChargeBillThirdPartyNormalizer::class, - - \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class => \ShipStream\Ups\Api\Normalizer\RateBillThirdPartyAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\RateShipmentFRSPaymentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class => \ShipStream\Ups\Api\Normalizer\FRSPaymentInformationTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class => \ShipStream\Ups\Api\Normalizer\FRSPaymentInformationAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentFreightShipmentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class => \ShipStream\Ups\Api\Normalizer\FreightShipmentInformationFreightDensityInfoNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class => \ShipStream\Ups\Api\Normalizer\FreightDensityInfoAdjustedHeightNormalizer::class, - - \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\AdjustedHeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\FreightDensityInfoHandlingUnitsNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitsType::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitsTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitsDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitsUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipmentTotalWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\ShipmentTotalWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentPackage::class => \ShipStream\Ups\Api\Normalizer\RateShipmentPackageNormalizer::class, - - \ShipStream\Ups\Api\Model\PackagePackagingType::class => \ShipStream\Ups\Api\Normalizer\PackagePackagingTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageDimensions::class => \ShipStream\Ups\Api\Normalizer\PackageDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageDimWeight::class => \ShipStream\Ups\Api\Normalizer\PackageDimWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DimWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageCommodity::class => \ShipStream\Ups\Api\Normalizer\PackageCommodityNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityNMFC::class => \ShipStream\Ups\Api\Normalizer\CommodityNMFCNormalizer::class, - - \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class => \ShipStream\Ups\Api\Normalizer\RatePackagePackageServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class => \ShipStream\Ups\Api\Normalizer\RatePackageServiceOptionsDeliveryConfirmationNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsAccessPointCODNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsCODNormalizer::class, - - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\RatePackageServiceOptionsDeclaredValueNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsShipperDeclaredValueNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsInsuranceNormalizer::class, - - \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class => \ShipStream\Ups\Api\Normalizer\InsuranceBasicFlexibleParcelIndicatorNormalizer::class, - - \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class => \ShipStream\Ups\Api\Normalizer\InsuranceExtendedFlexibleParcelIndicatorNormalizer::class, - - \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class => \ShipStream\Ups\Api\Normalizer\InsuranceTimeInTransitFlexibleParcelIndicatorNormalizer::class, - - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class => \ShipStream\Ups\Api\Normalizer\RatePackageServiceOptionsHazMatNormalizer::class, - - \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class => \ShipStream\Ups\Api\Normalizer\HazMatHazMatChemicalRecordNormalizer::class, - - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class => \ShipStream\Ups\Api\Normalizer\RatePackageServiceOptionsDryIceNormalizer::class, - - \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class => \ShipStream\Ups\Api\Normalizer\DryIceDryIceWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DryIceWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageSimpleRate::class => \ShipStream\Ups\Api\Normalizer\PackageSimpleRateNormalizer::class, - - \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class => \ShipStream\Ups\Api\Normalizer\RatePackageUPSPremierNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\RateShipmentShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsAccessPointCODNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsCODNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsCODCODAmountNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class => \ShipStream\Ups\Api\Normalizer\RateShipmentServiceOptionsDeliveryConfirmationNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsPickupOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsDeliveryOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class => \ShipStream\Ups\Api\Normalizer\RateShipmentServiceOptionsRestrictedArticlesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsImportControlNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsReturnServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipmentRatingOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class => \ShipStream\Ups\Api\Normalizer\ShipmentInvoiceLineTotalNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentPromotionalDiscountInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentDeliveryTimeInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class => \ShipStream\Ups\Api\Normalizer\DeliveryTimeInformationPickupNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class => \ShipStream\Ups\Api\Normalizer\DeliveryTimeInformationReturnContractServicesNormalizer::class, - - \ShipStream\Ups\Api\Model\RateResponse::class => \ShipStream\Ups\Api\Normalizer\RateResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\RateResponseResponse::class => \ShipStream\Ups\Api\Normalizer\RateResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class => \ShipStream\Ups\Api\Normalizer\RateResponseRatedShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentDisclaimerNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentService::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentRatedShipmentAlertNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentBillingWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\BillingWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTransportationChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentBaseServiceChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentItemizedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentFRSShipmentDataNormalizer::class, - - \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class => \ShipStream\Ups\Api\Normalizer\FRSShipmentDataTransportationChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class => \ShipStream\Ups\Api\Normalizer\TransportationChargesGrossChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class => \ShipStream\Ups\Api\Normalizer\TransportationChargesDiscountAmountNormalizer::class, - - \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class => \ShipStream\Ups\Api\Normalizer\TransportationChargesNetChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class => \ShipStream\Ups\Api\Normalizer\FRSShipmentDataFreightDensityRateNormalizer::class, - - \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\FRSShipmentDataHandlingUnitsNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitsAdjustedHeightNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class => \ShipStream\Ups\Api\Normalizer\RatedPackageBaseServiceChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentServiceOptionsChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTaxChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTotalChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTotalChargesWithTaxesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentNegotiatedRateChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\NegotiatedRateChargesItemizedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class => \ShipStream\Ups\Api\Normalizer\NegotiatedRateChargesTaxChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class => \ShipStream\Ups\Api\Normalizer\NegotiatedRateChargesTotalChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class => \ShipStream\Ups\Api\Normalizer\NegotiatedRateChargesTotalChargesWithTaxesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentRatedPackageNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageTransportationChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageServiceOptionsChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageTotalChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class => \ShipStream\Ups\Api\Normalizer\RatedPackageBillingWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\RatedPackageBillingWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class => \ShipStream\Ups\Api\Normalizer\RatedPackageAccessorialNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageItemizedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class => \ShipStream\Ups\Api\Normalizer\RatedPackageRateModifierNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class => \ShipStream\Ups\Api\Normalizer\RatedPackageNegotiatedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\NegotiatedChargesItemizedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class => \ShipStream\Ups\Api\Normalizer\RatedPackageSimpleRateNormalizer::class, - - \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class => \ShipStream\Ups\Api\Normalizer\RatedShipmentTimeInTransitNormalizer::class, - - \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class => \ShipStream\Ups\Api\Normalizer\TimeInTransitServiceSummaryNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceSummaryService::class => \ShipStream\Ups\Api\Normalizer\ServiceSummaryServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class => \ShipStream\Ups\Api\Normalizer\ServiceSummaryEstimatedArrivalNormalizer::class, - - \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class => \ShipStream\Ups\Api\Normalizer\EstimatedArrivalArrivalNormalizer::class, - - \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class => \ShipStream\Ups\Api\Normalizer\EstimatedArrivalPickupNormalizer::class, - - \ShipStream\Ups\Api\Model\SHIPRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\SHIPRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\SHIPResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\SHIPResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentRequest::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentReturnService::class => \ShipStream\Ups\Api\Normalizer\ShipmentReturnServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipper::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipperNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipperPhone::class => \ShipStream\Ups\Api\Normalizer\ShipperPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipTo::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipToPhone::class => \ShipStream\Ups\Api\Normalizer\ShipToPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class => \ShipStream\Ups\Api\Normalizer\ShipmentAlternateDeliveryAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class => \ShipStream\Ups\Api\Normalizer\AlternateDeliveryAddressAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipFrom::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipFromNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class => \ShipStream\Ups\Api\Normalizer\ShipFromTaxIDTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipFromPhone::class => \ShipStream\Ups\Api\Normalizer\ShipFromPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class => \ShipStream\Ups\Api\Normalizer\ShipFromVendorInfoNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentPaymentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class => \ShipStream\Ups\Api\Normalizer\PaymentInformationShipmentChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargeBillShipperNormalizer::class, - - \ShipStream\Ups\Api\Model\BillShipperCreditCard::class => \ShipStream\Ups\Api\Normalizer\BillShipperCreditCardNormalizer::class, - - \ShipStream\Ups\Api\Model\CreditCardAddress::class => \ShipStream\Ups\Api\Normalizer\CreditCardAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargeBillThirdPartyNormalizer::class, - - \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class => \ShipStream\Ups\Api\Normalizer\BillThirdPartyAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentFRSPaymentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class => \ShipStream\Ups\Api\Normalizer\ShipmentDGSignatoryInfoNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ShipmentReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\ShipmentShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsNotificationNormalizer::class, - - \ShipStream\Ups\Api\Model\NotificationEMail::class => \ShipStream\Ups\Api\Normalizer\NotificationEMailNormalizer::class, - - \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class => \ShipStream\Ups\Api\Normalizer\NotificationVoiceMessageNormalizer::class, - - \ShipStream\Ups\Api\Model\NotificationTextMessage::class => \ShipStream\Ups\Api\Normalizer\NotificationTextMessageNormalizer::class, - - \ShipStream\Ups\Api\Model\NotificationLocale::class => \ShipStream\Ups\Api\Normalizer\NotificationLocaleNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsLabelDeliveryNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class => \ShipStream\Ups\Api\Normalizer\LabelDeliveryEMailNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsInternationalFormsNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsUserCreatedFormNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsUPSPremiumCareFormNormalizer::class, - - \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class => \ShipStream\Ups\Api\Normalizer\UPSPremiumCareFormLanguageForUPSPremiumCareNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsCN22FormNormalizer::class, - - \ShipStream\Ups\Api\Model\CN22FormCN22Content::class => \ShipStream\Ups\Api\Normalizer\CN22FormCN22ContentNormalizer::class, - - \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class => \ShipStream\Ups\Api\Normalizer\CN22ContentCN22ContentWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\CN22ContentWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsEEIFilingOptionNormalizer::class, - - \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class => \ShipStream\Ups\Api\Normalizer\EEIFilingOptionUPSFiledNormalizer::class, - - \ShipStream\Ups\Api\Model\UPSFiledPOA::class => \ShipStream\Ups\Api\Normalizer\UPSFiledPOANormalizer::class, - - \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class => \ShipStream\Ups\Api\Normalizer\EEIFilingOptionShipperFiledNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsContacts::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsContactsNormalizer::class, - - \ShipStream\Ups\Api\Model\ContactsForwardAgent::class => \ShipStream\Ups\Api\Normalizer\ContactsForwardAgentNormalizer::class, - - \ShipStream\Ups\Api\Model\ForwardAgentAddress::class => \ShipStream\Ups\Api\Normalizer\ForwardAgentAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class => \ShipStream\Ups\Api\Normalizer\ContactsUltimateConsigneeNormalizer::class, - - \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class => \ShipStream\Ups\Api\Normalizer\UltimateConsigneeAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class => \ShipStream\Ups\Api\Normalizer\UltimateConsigneeUltimateConsigneeTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class => \ShipStream\Ups\Api\Normalizer\ContactsIntermediateConsigneeNormalizer::class, - - \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class => \ShipStream\Ups\Api\Normalizer\IntermediateConsigneeAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ContactsProducer::class => \ShipStream\Ups\Api\Normalizer\ContactsProducerNormalizer::class, - - \ShipStream\Ups\Api\Model\ProducerAddress::class => \ShipStream\Ups\Api\Normalizer\ProducerAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ProducerPhone::class => \ShipStream\Ups\Api\Normalizer\ProducerPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\ContactsSoldTo::class => \ShipStream\Ups\Api\Normalizer\ContactsSoldToNormalizer::class, - - \ShipStream\Ups\Api\Model\SoldToPhone::class => \ShipStream\Ups\Api\Normalizer\SoldToPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\SoldToAddress::class => \ShipStream\Ups\Api\Normalizer\SoldToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsProduct::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsProductNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductUnit::class => \ShipStream\Ups\Api\Normalizer\ProductUnitNormalizer::class, - - \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\UnitUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class => \ShipStream\Ups\Api\Normalizer\ProductNetCostDateRangeNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductProductWeight::class => \ShipStream\Ups\Api\Normalizer\ProductProductWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\ProductWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductScheduleB::class => \ShipStream\Ups\Api\Normalizer\ProductScheduleBNormalizer::class, - - \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\ScheduleBUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class => \ShipStream\Ups\Api\Normalizer\ProductExcludeFromFormNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductPackingListInfo::class => \ShipStream\Ups\Api\Normalizer\ProductPackingListInfoNormalizer::class, - - \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class => \ShipStream\Ups\Api\Normalizer\PackingListInfoPackageAssociatedNormalizer::class, - - \ShipStream\Ups\Api\Model\ProductEEIInformation::class => \ShipStream\Ups\Api\Normalizer\ProductEEIInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\EEIInformationLicense::class => \ShipStream\Ups\Api\Normalizer\EEIInformationLicenseNormalizer::class, - - \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class => \ShipStream\Ups\Api\Normalizer\EEIInformationDDTCInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\DDTCInformationUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsDiscountNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsFreightChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsInsuranceChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsOtherChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class => \ShipStream\Ups\Api\Normalizer\InternationalFormsBlanketPeriodNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsDeliveryConfirmationNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsLabelMethodNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsPreAlertNotificationNormalizer::class, - - \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class => \ShipStream\Ups\Api\Normalizer\PreAlertNotificationEMailMessageNormalizer::class, - - \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class => \ShipStream\Ups\Api\Normalizer\PreAlertNotificationVoiceMessageNormalizer::class, - - \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class => \ShipStream\Ups\Api\Normalizer\PreAlertNotificationTextMessageNormalizer::class, - - \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class => \ShipStream\Ups\Api\Normalizer\PreAlertNotificationLocaleNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsRestrictedArticlesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentPackage::class => \ShipStream\Ups\Api\Normalizer\ShipmentPackageNormalizer::class, - - \ShipStream\Ups\Api\Model\PackagePackaging::class => \ShipStream\Ups\Api\Normalizer\PackagePackagingNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\PackageReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageUPSPremier::class => \ShipStream\Ups\Api\Normalizer\PackageUPSPremierNormalizer::class, - - \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class => \ShipStream\Ups\Api\Normalizer\UPSPremierHandlingInstructionsNormalizer::class, - - \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class => \ShipStream\Ups\Api\Normalizer\PackagePackageServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsDeliveryConfirmationNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsDeclaredValueNormalizer::class, - - \ShipStream\Ups\Api\Model\DeclaredValueType::class => \ShipStream\Ups\Api\Normalizer\DeclaredValueTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsCODCODAmountNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsNotificationNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsNotificationEMailNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsHazMatNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class => \ShipStream\Ups\Api\Normalizer\PackageServiceOptionsDryIceNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class => \ShipStream\Ups\Api\Normalizer\PackageHazMatPackageInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestLabelSpecificationNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\LabelSpecificationLabelImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class => \ShipStream\Ups\Api\Normalizer\LabelSpecificationLabelStockSizeNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class => \ShipStream\Ups\Api\Normalizer\LabelSpecificationInstructionNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class => \ShipStream\Ups\Api\Normalizer\ShipmentRequestReceiptSpecificationNormalizer::class, - - \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class => \ShipStream\Ups\Api\Normalizer\ReceiptSpecificationImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResponse::class => \ShipStream\Ups\Api\Normalizer\ShipmentResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class => \ShipStream\Ups\Api\Normalizer\ShipmentResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class => \ShipStream\Ups\Api\Normalizer\ShipmentResponseShipmentResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsDisclaimerNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsShipmentChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesBaseServiceChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesTransportationChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesItemizedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesServiceOptionsChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesTaxChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesTotalChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class => \ShipStream\Ups\Api\Normalizer\ShipmentChargesTotalChargesWithTaxesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsNegotiatedRateChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsFRSShipmentDataNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsBillingWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsPackageResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class => \ShipStream\Ups\Api\Normalizer\PackageResultsBaseServiceChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class => \ShipStream\Ups\Api\Normalizer\PackageResultsServiceOptionsChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class => \ShipStream\Ups\Api\Normalizer\PackageResultsShippingLabelNormalizer::class, - - \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\ShippingLabelImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class => \ShipStream\Ups\Api\Normalizer\PackageResultsShippingReceiptNormalizer::class, - - \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class => \ShipStream\Ups\Api\Normalizer\ShippingReceiptImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class => \ShipStream\Ups\Api\Normalizer\PackageResultsAccessorialNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class => \ShipStream\Ups\Api\Normalizer\PackageResultsSimpleRateNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsForm::class => \ShipStream\Ups\Api\Normalizer\PackageResultsFormNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsFormImageNormalizer::class, - - \ShipStream\Ups\Api\Model\FormImage::class => \ShipStream\Ups\Api\Normalizer\FormImageNormalizer::class, - - \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\HighValueReportImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\CODTurnInPageImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\ImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class => \ShipStream\Ups\Api\Normalizer\PackageResultsItemizedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class => \ShipStream\Ups\Api\Normalizer\PackageResultsNegotiatedChargesNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class => \ShipStream\Ups\Api\Normalizer\PackageResultsRateModifierNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsControlLogReceiptNormalizer::class, - - \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class => \ShipStream\Ups\Api\Normalizer\ControlLogReceiptImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsForm::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsFormNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsCODTurnInPageNormalizer::class, - - \ShipStream\Ups\Api\Model\CODTurnInPageImage::class => \ShipStream\Ups\Api\Normalizer\CODTurnInPageImageNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsHighValueReportNormalizer::class, - - \ShipStream\Ups\Api\Model\HighValueReportImage::class => \ShipStream\Ups\Api\Normalizer\HighValueReportImageNormalizer::class, - - \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\VOIDSHIPMENTRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\VOIDSHIPMENTResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentRequest::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class => \ShipStream\Ups\Api\Normalizer\VoidRequestTransactionReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentRequestVoidShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentResponse::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class => \ShipStream\Ups\Api\Normalizer\VoidResponseResponseStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class => \ShipStream\Ups\Api\Normalizer\VoidResponseTransactionReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentResponseSummaryResultNormalizer::class, - - \ShipStream\Ups\Api\Model\SummaryResultStatus::class => \ShipStream\Ups\Api\Normalizer\SummaryResultStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class => \ShipStream\Ups\Api\Normalizer\VoidShipmentResponsePackageLevelResultNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class => \ShipStream\Ups\Api\Normalizer\PackageLevelResultStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\LABELRECOVERYRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\LABELRECOVERYResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class => \ShipStream\Ups\Api\Normalizer\LRRequestTransactionReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestLabelSpecificationNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryLabelSpecificationLabelImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryLabelSpecificationLabelStockSizeNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestTranslateNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestLabelDeliveryNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestReferenceValuesNormalizer::class, - - \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ReferenceValuesReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryRequestUPSPremiumCareFormNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class => \ShipStream\Ups\Api\Normalizer\LRResponseResponseStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class => \ShipStream\Ups\Api\Normalizer\LRResponseTransactionReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseLabelResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class => \ShipStream\Ups\Api\Normalizer\LabelResultsLabelImageNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\LabelImageLabelImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class => \ShipStream\Ups\Api\Normalizer\LabelResultsMailInnovationsLabelImageNormalizer::class, - - \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class => \ShipStream\Ups\Api\Normalizer\MailInnovationsLabelImageLabelImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelResultsReceipt::class => \ShipStream\Ups\Api\Normalizer\LabelResultsReceiptNormalizer::class, - - \ShipStream\Ups\Api\Model\ReceiptImage::class => \ShipStream\Ups\Api\Normalizer\ReceiptImageNormalizer::class, - - \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\ReceiptImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelResultsForm::class => \ShipStream\Ups\Api\Normalizer\LabelResultsFormNormalizer::class, - - \ShipStream\Ups\Api\Model\LRFormImage::class => \ShipStream\Ups\Api\Normalizer\LRFormImageNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseCODTurnInPageNormalizer::class, - - \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class => \ShipStream\Ups\Api\Normalizer\LRCODTurnInPageImageNormalizer::class, - - \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\LRCODTurnInPageImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseFormNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryFormImageNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryImageImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseHighValueReportNormalizer::class, - - \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class => \ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseTrackingCandidateNormalizer::class, - - \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class => \ShipStream\Ups\Api\Normalizer\TrackingCandidatePickupDateRangeNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTPICKUPRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTPICKUPResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequest::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestRequesterNormalizer::class, - - \ShipStream\Ups\Api\Model\RequesterPhone::class => \ShipStream\Ups\Api\Normalizer\RequesterPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestShipFromNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class => \ShipStream\Ups\Api\Normalizer\FreightPickupShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestShipmentDetailNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class => \ShipStream\Ups\Api\Normalizer\ShipmentDetailPackagingTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentDetailWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\WeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestExistingShipmentIDNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class => \ShipStream\Ups\Api\Normalizer\FreightPickupRequestPOMNormalizer::class, - - \ShipStream\Ups\Api\Model\POMPickupNotifications::class => \ShipStream\Ups\Api\Normalizer\POMPickupNotificationsNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class => \ShipStream\Ups\Api\Normalizer\PickupNotificationsEMailNotificationNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupResponse::class => \ShipStream\Ups\Api\Normalizer\FreightPickupResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class => \ShipStream\Ups\Api\Normalizer\FreightPickupResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTPICKUPCANCELRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTPICKUPCANCELResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class => \ShipStream\Ups\Api\Normalizer\FreightCancelPickupRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class => \ShipStream\Ups\Api\Normalizer\FreightCancelPickupRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class => \ShipStream\Ups\Api\Normalizer\FreightCancelPickupResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class => \ShipStream\Ups\Api\Normalizer\FreightCancelPickupResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightCancelStatus::class => \ShipStream\Ups\Api\Normalizer\FreightCancelStatusNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTRATERequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTRATEResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequest::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestShipFromNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\FreightRateShipFromAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class => \ShipStream\Ups\Api\Normalizer\FreightRateShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestPaymentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class => \ShipStream\Ups\Api\Normalizer\FreightRatePaymentInformationPayerNormalizer::class, - - \ShipStream\Ups\Api\Model\PayerAddress::class => \ShipStream\Ups\Api\Normalizer\PayerAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class => \ShipStream\Ups\Api\Normalizer\PaymentInformationShipmentBillingOptionNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestService::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestHandlingUnitOneNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitOneType::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitOneTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestHandlingUnitTwoNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitTwoTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestCommodityNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityWeight::class => \ShipStream\Ups\Api\Normalizer\CommodityWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class => \ShipStream\Ups\Api\Normalizer\CommodityAdjustedWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\AdjustedWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityDimensions::class => \ShipStream\Ups\Api\Normalizer\CommodityDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityPackagingType::class => \ShipStream\Ups\Api\Normalizer\CommodityPackagingTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityCommodityValue::class => \ShipStream\Ups\Api\Normalizer\CommodityCommodityValueNormalizer::class, - - \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class => \ShipStream\Ups\Api\Normalizer\CommodityNMFCCommodityNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class => \ShipStream\Ups\Api\Normalizer\FreightShipmentServiceOptionsPickupOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class => \ShipStream\Ups\Api\Normalizer\FreightShipmentServiceOptionsDeliveryOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsOverSeasLegNormalizer::class, - - \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class => \ShipStream\Ups\Api\Normalizer\OverSeasLegDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\OverSeasLegValue::class => \ShipStream\Ups\Api\Normalizer\OverSeasLegValueNormalizer::class, - - \ShipStream\Ups\Api\Model\ValueCube::class => \ShipStream\Ups\Api\Normalizer\ValueCubeNormalizer::class, - - \ShipStream\Ups\Api\Model\ValueCWT::class => \ShipStream\Ups\Api\Normalizer\ValueCWTNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class => \ShipStream\Ups\Api\Normalizer\FreightShipmentServiceOptionsCODNormalizer::class, - - \ShipStream\Ups\Api\Model\CODCODValue::class => \ShipStream\Ups\Api\Normalizer\CODCODValueNormalizer::class, - - \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class => \ShipStream\Ups\Api\Normalizer\CODCODPaymentMethodNormalizer::class, - - \ShipStream\Ups\Api\Model\CODCODBillingOption::class => \ShipStream\Ups\Api\Normalizer\CODCODBillingOptionNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class => \ShipStream\Ups\Api\Normalizer\FreightRateCODRemitToNormalizer::class, - - \ShipStream\Ups\Api\Model\RemitToAddress::class => \ShipStream\Ups\Api\Normalizer\RemitToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsDangerousGoodsNormalizer::class, - - \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class => \ShipStream\Ups\Api\Normalizer\DangerousGoodsPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class => \ShipStream\Ups\Api\Normalizer\DangerousGoodsTransportationModeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsSortingAndSegregatingNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsExcessDeclaredValueNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsHandlingChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingChargeAmount::class => \ShipStream\Ups\Api\Normalizer\HandlingChargeAmountNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsAdjustedHeightNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestPickupRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestAlternateRateOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestGFPOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class => \ShipStream\Ups\Api\Normalizer\GFPOptionsOnCallInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestHandlingUnitWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\FreightRateRequestHandlingUnitsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponse::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseRate::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseRateNormalizer::class, - - \ShipStream\Ups\Api\Model\RateType::class => \ShipStream\Ups\Api\Normalizer\RateTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\RateFactor::class => \ShipStream\Ups\Api\Normalizer\RateFactorNormalizer::class, - - \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\FactorUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseFreightDensityRateNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseCommodityNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseTotalShipmentChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseBillableShipmentWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\BillableShipmentWeightUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseDimensionalWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseService::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseAlternateRatesResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseAlternateRateTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseRateNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseFreightDensityRateNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseBillableShipmentWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class => \ShipStream\Ups\Api\Normalizer\AlternateRatesResponseTimeInTransitNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseTimeInTransitNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\FreightRateResponseHandlingUnitsNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTSHIPRequestWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class => \ShipStream\Ups\Api\Normalizer\FREIGHTSHIPResponseWrapperNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipRequest::class => \ShipStream\Ups\Api\Normalizer\FreightShipRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class => \ShipStream\Ups\Api\Normalizer\FreightShipRequestRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class => \ShipStream\Ups\Api\Normalizer\FreightShipRequestShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentShipFromNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipFromAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentPaymentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\PaymentInformationPayer::class => \ShipStream\Ups\Api\Normalizer\PaymentInformationPayerNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class => \ShipStream\Ups\Api\Normalizer\FreightShipPayerAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PayerPhone::class => \ShipStream\Ups\Api\Normalizer\PayerPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class => \ShipStream\Ups\Api\Normalizer\ShipmentHandlingUnitOneNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class => \ShipStream\Ups\Api\Normalizer\ShipmentHandlingUnitTwoNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class => \ShipStream\Ups\Api\Normalizer\ShipmentExistingShipmentIDNormalizer::class, - - \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class => \ShipStream\Ups\Api\Normalizer\ExistingShipmentIDConfirmationNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ConfirmationNumberType::class => \ShipStream\Ups\Api\Normalizer\ConfirmationNumberTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentCommodity::class => \ShipStream\Ups\Api\Normalizer\ShipmentCommodityNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class => \ShipStream\Ups\Api\Normalizer\FreightShipCommodityDimensionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentReference::class => \ShipStream\Ups\Api\Normalizer\ShipmentReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\ReferenceNumber::class => \ShipStream\Ups\Api\Normalizer\ReferenceNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\ReferenceWeight::class => \ShipStream\Ups\Api\Normalizer\ReferenceWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentShipmentServiceOptionsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsEMailInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\EMailInformationEMailType::class => \ShipStream\Ups\Api\Normalizer\EMailInformationEMailTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\EMailInformationEMail::class => \ShipStream\Ups\Api\Normalizer\EMailInformationEMailNormalizer::class, - - \ShipStream\Ups\Api\Model\CODRemitTo::class => \ShipStream\Ups\Api\Normalizer\CODRemitToNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class => \ShipStream\Ups\Api\Normalizer\FreightShipRemitToAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\RemitToPhone::class => \ShipStream\Ups\Api\Normalizer\RemitToPhoneNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class => \ShipStream\Ups\Api\Normalizer\FreightShipShipmentServiceOptionsDangerousGoodsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class => \ShipStream\Ups\Api\Normalizer\ShipmentServiceOptionsDeclaredValueNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class => \ShipStream\Ups\Api\Normalizer\ShipmentPickupRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRequestRequester::class => \ShipStream\Ups\Api\Normalizer\PickupRequestRequesterNormalizer::class, - - \ShipStream\Ups\Api\Model\PickupRequestPOM::class => \ShipStream\Ups\Api\Normalizer\PickupRequestPOMNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class => \ShipStream\Ups\Api\Normalizer\FreightShipPOMPickupNotificationsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class => \ShipStream\Ups\Api\Normalizer\FreightShipPickupNotificationsEMailNotificationNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentDocuments::class => \ShipStream\Ups\Api\Normalizer\ShipmentDocumentsNormalizer::class, - - \ShipStream\Ups\Api\Model\DocumentsImage::class => \ShipStream\Ups\Api\Normalizer\DocumentsImageNormalizer::class, - - \ShipStream\Ups\Api\Model\ImageType::class => \ShipStream\Ups\Api\Normalizer\ImageTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\ImageFormat::class => \ShipStream\Ups\Api\Normalizer\ImageFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ImagePrintFormat::class => \ShipStream\Ups\Api\Normalizer\ImagePrintFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ImagePrintSize::class => \ShipStream\Ups\Api\Normalizer\ImagePrintSizeNormalizer::class, - - \ShipStream\Ups\Api\Model\DocumentsPackingList::class => \ShipStream\Ups\Api\Normalizer\DocumentsPackingListNormalizer::class, - - \ShipStream\Ups\Api\Model\PackingListShipFrom::class => \ShipStream\Ups\Api\Normalizer\PackingListShipFromNormalizer::class, - - \ShipStream\Ups\Api\Model\PackingListShipTo::class => \ShipStream\Ups\Api\Normalizer\PackingListShipToNormalizer::class, - - \ShipStream\Ups\Api\Model\PackingListReference::class => \ShipStream\Ups\Api\Normalizer\PackingListReferenceNormalizer::class, - - \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class => \ShipStream\Ups\Api\Normalizer\PackingListHandlingUnitNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitCommodityNormalizer::class, - - \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class => \ShipStream\Ups\Api\Normalizer\HandlingUnitUnitOfMeasurementNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class => \ShipStream\Ups\Api\Normalizer\ShipmentHandlingUnitsNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipResponse::class => \ShipStream\Ups\Api\Normalizer\FreightShipResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class => \ShipStream\Ups\Api\Normalizer\FreightShipResponseResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class => \ShipStream\Ups\Api\Normalizer\FreightShipResponseShipmentResultsNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsRate::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsRateNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsFreightDensityRateNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsTotalShipmentChargeNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsBillableShipmentWeightNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsService::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsDocumentsNormalizer::class, - - \ShipStream\Ups\Api\Model\DocumentsForms::class => \ShipStream\Ups\Api\Normalizer\DocumentsFormsNormalizer::class, - - \ShipStream\Ups\Api\Model\FormsType::class => \ShipStream\Ups\Api\Normalizer\FormsTypeNormalizer::class, - - \ShipStream\Ups\Api\Model\FormsFormat::class => \ShipStream\Ups\Api\Normalizer\FormsFormatNormalizer::class, - - \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class => \ShipStream\Ups\Api\Normalizer\ShipmentResultsTimeInTransitNormalizer::class, - - \ShipStream\Ups\Api\Model\TimeInTransitRequest::class => \ShipStream\Ups\Api\Normalizer\TimeInTransitRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\TimeInTransitResponse::class => \ShipStream\Ups\Api\Normalizer\TimeInTransitResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\ValidationList::class => \ShipStream\Ups\Api\Normalizer\ValidationListNormalizer::class, - - \ShipStream\Ups\Api\Model\EmsResponse::class => \ShipStream\Ups\Api\Normalizer\EmsResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\CandidateAddress::class => \ShipStream\Ups\Api\Normalizer\CandidateAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\Services::class => \ShipStream\Ups\Api\Normalizer\ServicesNormalizer::class, - - \ShipStream\Ups\Api\Model\AccessPointInformation::class => \ShipStream\Ups\Api\Normalizer\AccessPointInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\Activity::class => \ShipStream\Ups\Api\Normalizer\ActivityNormalizer::class, - - \ShipStream\Ups\Api\Model\Address::class => \ShipStream\Ups\Api\Normalizer\AddressNormalizer::class, - - \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class => \ShipStream\Ups\Api\Normalizer\AlternateTrackingNumberNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryDate::class => \ShipStream\Ups\Api\Normalizer\DeliveryDateNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryInformation::class => \ShipStream\Ups\Api\Normalizer\DeliveryInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\DeliveryTime::class => \ShipStream\Ups\Api\Normalizer\DeliveryTimeNormalizer::class, - - \ShipStream\Ups\Api\Model\InquireNumbers::class => \ShipStream\Ups\Api\Normalizer\InquireNumbersNormalizer::class, - - \ShipStream\Ups\Api\Model\Location::class => \ShipStream\Ups\Api\Normalizer\LocationNormalizer::class, - - \ShipStream\Ups\Api\Model\Milestones::class => \ShipStream\Ups\Api\Normalizer\MilestonesNormalizer::class, - - \ShipStream\Ups\Api\Model\Package::class => \ShipStream\Ups\Api\Normalizer\PackageNormalizer::class, - - \ShipStream\Ups\Api\Model\PackageAddress::class => \ShipStream\Ups\Api\Normalizer\PackageAddressNormalizer::class, - - \ShipStream\Ups\Api\Model\PaymentInformation::class => \ShipStream\Ups\Api\Normalizer\PaymentInformationNormalizer::class, - - \ShipStream\Ups\Api\Model\Service::class => \ShipStream\Ups\Api\Normalizer\ServiceNormalizer::class, - - \ShipStream\Ups\Api\Model\Shipment::class => \ShipStream\Ups\Api\Normalizer\ShipmentNormalizer::class, - - \ShipStream\Ups\Api\Model\Signature::class => \ShipStream\Ups\Api\Normalizer\SignatureNormalizer::class, - - \ShipStream\Ups\Api\Model\Status::class => \ShipStream\Ups\Api\Normalizer\StatusNormalizer::class, - - \ShipStream\Ups\Api\Model\SubMilestone::class => \ShipStream\Ups\Api\Normalizer\SubMilestoneNormalizer::class, - - \ShipStream\Ups\Api\Model\TrackApiResponse::class => \ShipStream\Ups\Api\Normalizer\TrackApiResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\TrackResponse::class => \ShipStream\Ups\Api\Normalizer\TrackResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\Warning::class => \ShipStream\Ups\Api\Normalizer\WarningNormalizer::class, - - \ShipStream\Ups\Api\Model\Weight::class => \ShipStream\Ups\Api\Normalizer\WeightNormalizer::class, - - \ShipStream\Ups\Api\Model\Destination::class => \ShipStream\Ups\Api\Normalizer\DestinationNormalizer::class, - - \ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class => \ShipStream\Ups\Api\Normalizer\TrackSubsServiceRequestNormalizer::class, - - \ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class => \ShipStream\Ups\Api\Normalizer\TrackSubsServiceResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class => \ShipStream\Ups\Api\Normalizer\TrackSubsServiceErrorResponseNormalizer::class, - - \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class => \ShipStream\Ups\Api\Normalizer\SecurityV1OauthTokenPostBodyNormalizer::class, - - \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class => \ShipStream\Ups\Api\Normalizer\SecurityV1OauthRefreshPostBodyNormalizer::class, - - \Jane\Component\JsonSchemaRuntime\Reference::class => \ShipStream\Ups\Api\Runtime\Normalizer\ReferenceNormalizer::class, - ], $normalizersCache = []; - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return array_key_exists($type, $this->normalizers); - } - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return is_object($data) && array_key_exists(get_class($data), $this->normalizers); - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $normalizerClass = $this->normalizers[get_class($object)]; - $normalizer = $this->getNormalizer($normalizerClass); - return $normalizer->normalize($object, $format, $context); - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - $denormalizerClass = $this->normalizers[$type]; - $denormalizer = $this->getNormalizer($denormalizerClass); - return $denormalizer->denormalize($data, $type, $format, $context); - } - private function getNormalizer(string $normalizerClass) - { - return $this->normalizersCache[$normalizerClass] ?? $this->initNormalizer($normalizerClass); - } - private function initNormalizer(string $normalizerClass) - { - $normalizer = new $normalizerClass(); - $normalizer->setNormalizer($this->normalizer); - $normalizer->setDenormalizer($this->denormalizer); - $this->normalizersCache[$normalizerClass] = $normalizer; - return $normalizer; - } - public function getSupportedTypes(?string $format = null): array - { - return [ - - \ShipStream\Ups\Api\Model\XAVRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\XAVResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\XAVRequest::class => false, - \ShipStream\Ups\Api\Model\XAVRequestRequest::class => false, - \ShipStream\Ups\Api\Model\RequestTransactionReference::class => false, - \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class => false, - \ShipStream\Ups\Api\Model\XAVResponse::class => false, - \ShipStream\Ups\Api\Model\XAVResponseResponse::class => false, - \ShipStream\Ups\Api\Model\ResponseResponseStatus::class => false, - \ShipStream\Ups\Api\Model\ResponseAlert::class => false, - \ShipStream\Ups\Api\Model\ResponseTransactionReference::class => false, - \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class => false, - \ShipStream\Ups\Api\Model\XAVResponseCandidate::class => false, - \ShipStream\Ups\Api\Model\CandidateAddressClassification::class => false, - \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class => false, - \ShipStream\Ups\Api\Model\ErrorResponse::class => false, - \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\Error::class => false, - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class => false, - \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class => false, - \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class => false, - \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class => false, - \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class => false, - \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class => false, - \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class => false, - \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class => false, - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentService::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class => false, - \ShipStream\Ups\Api\Model\PackagePackageWeight::class => false, - \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\PackageChemicalRecord::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class => false, - \ShipStream\Ups\Api\Model\ResponseAlertDetail::class => false, - \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class => false, - \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class => false, - \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class => false, - \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class => false, - \ShipStream\Ups\Api\Model\LandedCostRequest::class => false, - \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class => false, - \ShipStream\Ups\Api\Model\RequestShipmentItems::class => false, - \ShipStream\Ups\Api\Model\LandedCostResponse::class => false, - \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class => false, - \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class => false, - \ShipStream\Ups\Api\Model\BrokerageFeeItems::class => false, - \ShipStream\Ups\Api\Model\ResponseShipmentItems::class => false, - \ShipStream\Ups\Api\Model\Errors::class => false, - \ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\LocatorRequest::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestRequest::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class => false, - \ShipStream\Ups\Api\Model\OriginAddressGeocode::class => false, - \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class => false, - \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class => false, - \ShipStream\Ups\Api\Model\SearchOptionOptionType::class => false, - \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class => false, - \ShipStream\Ups\Api\Model\SearchOptionRelation::class => false, - \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class => false, - \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class => false, - \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class => false, - \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class => false, - \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class => false, - \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class => false, - \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class => false, - \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class => false, - \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class => false, - \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class => false, - \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class => false, - \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class => false, - \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class => false, - \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class => false, - \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class => false, - \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class => false, - \ShipStream\Ups\Api\Model\LocatorResponse::class => false, - \ShipStream\Ups\Api\Model\LocatorResponseResponse::class => false, - \ShipStream\Ups\Api\Model\ResponseError::class => false, - \ShipStream\Ups\Api\Model\ErrorErrorLocation::class => false, - \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class => false, - \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class => false, - \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class => false, - \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class => false, - \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class => false, - \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class => false, - \ShipStream\Ups\Api\Model\DropLocationIVR::class => false, - \ShipStream\Ups\Api\Model\DropLocationGeocode::class => false, - \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class => false, - \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class => false, - \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class => false, - \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class => false, - \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class => false, - \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class => false, - \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class => false, - \ShipStream\Ups\Api\Model\DropLocationDistance::class => false, - \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class => false, - \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class => false, - \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class => false, - \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class => false, - \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class => false, - \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class => false, - \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class => false, - \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class => false, - \ShipStream\Ups\Api\Model\DropLocationSortCode::class => false, - \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class => false, - \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class => false, - \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class => false, - \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class => false, - \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class => false, - \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class => false, - \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class => false, - \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class => false, - \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class => false, - \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class => false, - \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class => false, - \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class => false, - \ShipStream\Ups\Api\Model\DropLocationLocationImage::class => false, - \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class => false, - \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class => false, - \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class => false, - \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class => false, - \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class => false, - \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class => false, - \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class => false, - \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class => false, - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\DeleteRequest::class => false, - \ShipStream\Ups\Api\Model\DeleteRequestRequest::class => false, - \ShipStream\Ups\Api\Model\DeleteResponse::class => false, - \ShipStream\Ups\Api\Model\DeleteResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class => false, - \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class => false, - \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class => false, - \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\UploadRequest::class => false, - \ShipStream\Ups\Api\Model\UploadRequestRequest::class => false, - \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class => false, - \ShipStream\Ups\Api\Model\UploadResponse::class => false, - \ShipStream\Ups\Api\Model\UploadResponseResponse::class => false, - \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class => false, - \ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PickupRateRequest::class => false, - \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class => false, - \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class => false, - \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class => false, - \ShipStream\Ups\Api\Model\PickupRateResponse::class => false, - \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class => false, - \ShipStream\Ups\Api\Model\RateResultChargeDetail::class => false, - \ShipStream\Ups\Api\Model\RateResultTaxCharges::class => false, - \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class => false, - \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PickupCancelRequest::class => false, - \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PickupCancelResponse::class => false, - \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class => false, - \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequest::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class => false, - \ShipStream\Ups\Api\Model\ShipperAccount::class => false, - \ShipStream\Ups\Api\Model\ShipperChargeCard::class => false, - \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class => false, - \ShipStream\Ups\Api\Model\PickupAddressPhone::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class => false, - \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class => false, - \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class => false, - \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class => false, - \ShipStream\Ups\Api\Model\PalletInformationDimensions::class => false, - \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\PickupCreationResponse::class => false, - \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class => false, - \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class => false, - \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class => false, - \ShipStream\Ups\Api\Model\RateResultDisclaimer::class => false, - \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class => false, - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class => false, - \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class => false, - \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class => false, - \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class => false, - \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class => false, - \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class => false, - \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class => false, - \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class => false, - \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class => false, - \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class => false, - \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class => false, - \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class => false, - \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class => false, - \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class => false, - \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class => false, - \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class => false, - \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class => false, - \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\PreNotificationRequest::class => false, - \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class => false, - \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class => false, - \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class => false, - \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class => false, - \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class => false, - \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class => false, - \ShipStream\Ups\Api\Model\PreNotificationResponse::class => false, - \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class => false, - \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\QuantumViewRequest::class => false, - \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class => false, - \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class => false, - \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class => false, - \ShipStream\Ups\Api\Model\QuantumViewResponse::class => false, - \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class => false, - \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class => false, - \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class => false, - \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class => false, - \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class => false, - \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class => false, - \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class => false, - \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class => false, - \ShipStream\Ups\Api\Model\ManifestShipper::class => false, - \ShipStream\Ups\Api\Model\ManifestShipperAddress::class => false, - \ShipStream\Ups\Api\Model\ManifestShipTo::class => false, - \ShipStream\Ups\Api\Model\ManifestShipToAddress::class => false, - \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\ManifestService::class => false, - \ShipStream\Ups\Api\Model\ManifestPackage::class => false, - \ShipStream\Ups\Api\Model\PackageActivity::class => false, - \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class => false, - \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class => false, - \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class => false, - \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class => false, - \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class => false, - \ShipStream\Ups\Api\Model\CODCODAmount::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class => false, - \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class => false, - \ShipStream\Ups\Api\Model\ManifestCustomsValue::class => false, - \ShipStream\Ups\Api\Model\ManifestBillToAccount::class => false, - \ShipStream\Ups\Api\Model\ManifestUAPAddress::class => false, - \ShipStream\Ups\Api\Model\UAPAddressAddress::class => false, - \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class => false, - \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\OriginActivityLocation::class => false, - \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class => false, - \ShipStream\Ups\Api\Model\OriginBillToAccount::class => false, - \ShipStream\Ups\Api\Model\SubscriptionFileException::class => false, - \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class => false, - \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class => false, - \ShipStream\Ups\Api\Model\ExceptionResolution::class => false, - \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class => false, - \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class => false, - \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class => false, - \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class => false, - \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class => false, - \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class => false, - \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class => false, - \ShipStream\Ups\Api\Model\DeliveryCOD::class => false, - \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class => false, - \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class => false, - \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\GenericService::class => false, - \ShipStream\Ups\Api\Model\GenericActivity::class => false, - \ShipStream\Ups\Api\Model\GenericBillToAccount::class => false, - \ShipStream\Ups\Api\Model\GenericShipTo::class => false, - \ShipStream\Ups\Api\Model\GenericFailureNotification::class => false, - \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class => false, - \ShipStream\Ups\Api\Model\RATERequestWrapper::class => false, - \ShipStream\Ups\Api\Model\RATEResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\RateRequest::class => false, - \ShipStream\Ups\Api\Model\RateRequestRequest::class => false, - \ShipStream\Ups\Api\Model\RateRequestPickupType::class => false, - \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class => false, - \ShipStream\Ups\Api\Model\RateRequestShipment::class => false, - \ShipStream\Ups\Api\Model\RateShipmentShipper::class => false, - \ShipStream\Ups\Api\Model\ShipperAddress::class => false, - \ShipStream\Ups\Api\Model\RateShipmentShipTo::class => false, - \ShipStream\Ups\Api\Model\ShipToAddress::class => false, - \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class => false, - \ShipStream\Ups\Api\Model\ShipFromAddress::class => false, - \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class => false, - \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class => false, - \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class => false, - \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class => false, - \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class => false, - \ShipStream\Ups\Api\Model\BillReceiverAddress::class => false, - \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class => false, - \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class => false, - \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class => false, - \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class => false, - \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class => false, - \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class => false, - \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class => false, - \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitsType::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class => false, - \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\RateShipmentPackage::class => false, - \ShipStream\Ups\Api\Model\PackagePackagingType::class => false, - \ShipStream\Ups\Api\Model\PackageDimensions::class => false, - \ShipStream\Ups\Api\Model\PackageDimWeight::class => false, - \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\PackageCommodity::class => false, - \ShipStream\Ups\Api\Model\CommodityNMFC::class => false, - \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class => false, - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class => false, - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class => false, - \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class => false, - \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class => false, - \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class => false, - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class => false, - \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class => false, - \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class => false, - \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class => false, - \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\PackageSimpleRate::class => false, - \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class => false, - \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class => false, - \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class => false, - \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class => false, - \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class => false, - \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class => false, - \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class => false, - \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class => false, - \ShipStream\Ups\Api\Model\RateResponse::class => false, - \ShipStream\Ups\Api\Model\RateResponseResponse::class => false, - \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentService::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class => false, - \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class => false, - \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class => false, - \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class => false, - \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class => false, - \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class => false, - \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class => false, - \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class => false, - \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class => false, - \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class => false, - \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class => false, - \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class => false, - \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class => false, - \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class => false, - \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class => false, - \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class => false, - \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class => false, - \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class => false, - \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class => false, - \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class => false, - \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class => false, - \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class => false, - \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class => false, - \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class => false, - \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class => false, - \ShipStream\Ups\Api\Model\ServiceSummaryService::class => false, - \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class => false, - \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class => false, - \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class => false, - \ShipStream\Ups\Api\Model\SHIPRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\SHIPResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\ShipmentRequest::class => false, - \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class => false, - \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class => false, - \ShipStream\Ups\Api\Model\ShipmentReturnService::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipper::class => false, - \ShipStream\Ups\Api\Model\ShipperPhone::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipTo::class => false, - \ShipStream\Ups\Api\Model\ShipToPhone::class => false, - \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class => false, - \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipFrom::class => false, - \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class => false, - \ShipStream\Ups\Api\Model\ShipFromPhone::class => false, - \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class => false, - \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class => false, - \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class => false, - \ShipStream\Ups\Api\Model\BillShipperCreditCard::class => false, - \ShipStream\Ups\Api\Model\CreditCardAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class => false, - \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class => false, - \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class => false, - \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class => false, - \ShipStream\Ups\Api\Model\NotificationEMail::class => false, - \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class => false, - \ShipStream\Ups\Api\Model\NotificationTextMessage::class => false, - \ShipStream\Ups\Api\Model\NotificationLocale::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class => false, - \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class => false, - \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class => false, - \ShipStream\Ups\Api\Model\CN22FormCN22Content::class => false, - \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class => false, - \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class => false, - \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class => false, - \ShipStream\Ups\Api\Model\UPSFiledPOA::class => false, - \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsContacts::class => false, - \ShipStream\Ups\Api\Model\ContactsForwardAgent::class => false, - \ShipStream\Ups\Api\Model\ForwardAgentAddress::class => false, - \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class => false, - \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class => false, - \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class => false, - \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class => false, - \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class => false, - \ShipStream\Ups\Api\Model\ContactsProducer::class => false, - \ShipStream\Ups\Api\Model\ProducerAddress::class => false, - \ShipStream\Ups\Api\Model\ProducerPhone::class => false, - \ShipStream\Ups\Api\Model\ContactsSoldTo::class => false, - \ShipStream\Ups\Api\Model\SoldToPhone::class => false, - \ShipStream\Ups\Api\Model\SoldToAddress::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsProduct::class => false, - \ShipStream\Ups\Api\Model\ProductUnit::class => false, - \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class => false, - \ShipStream\Ups\Api\Model\ProductProductWeight::class => false, - \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\ProductScheduleB::class => false, - \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class => false, - \ShipStream\Ups\Api\Model\ProductPackingListInfo::class => false, - \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class => false, - \ShipStream\Ups\Api\Model\ProductEEIInformation::class => false, - \ShipStream\Ups\Api\Model\EEIInformationLicense::class => false, - \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class => false, - \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class => false, - \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class => false, - \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class => false, - \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class => false, - \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class => false, - \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class => false, - \ShipStream\Ups\Api\Model\ShipmentPackage::class => false, - \ShipStream\Ups\Api\Model\PackagePackaging::class => false, - \ShipStream\Ups\Api\Model\PackageReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\PackageUPSPremier::class => false, - \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class => false, - \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class => false, - \ShipStream\Ups\Api\Model\DeclaredValueType::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class => false, - \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class => false, - \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class => false, - \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class => false, - \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class => false, - \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class => false, - \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class => false, - \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class => false, - \ShipStream\Ups\Api\Model\ShipmentResponse::class => false, - \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class => false, - \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class => false, - \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class => false, - \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class => false, - \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class => false, - \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class => false, - \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class => false, - \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class => false, - \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class => false, - \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class => false, - \ShipStream\Ups\Api\Model\PackageResultsForm::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class => false, - \ShipStream\Ups\Api\Model\FormImage::class => false, - \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\ImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class => false, - \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class => false, - \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class => false, - \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsForm::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class => false, - \ShipStream\Ups\Api\Model\CODTurnInPageImage::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class => false, - \ShipStream\Ups\Api\Model\HighValueReportImage::class => false, - \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentRequest::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class => false, - \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentResponse::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class => false, - \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class => false, - \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class => false, - \ShipStream\Ups\Api\Model\SummaryResultStatus::class => false, - \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class => false, - \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class => false, - \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class => false, - \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class => false, - \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class => false, - \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class => false, - \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class => false, - \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class => false, - \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class => false, - \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelResultsReceipt::class => false, - \ShipStream\Ups\Api\Model\ReceiptImage::class => false, - \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelResultsForm::class => false, - \ShipStream\Ups\Api\Model\LRFormImage::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class => false, - \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class => false, - \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class => false, - \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class => false, - \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class => false, - \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequest::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class => false, - \ShipStream\Ups\Api\Model\RequesterPhone::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class => false, - \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class => false, - \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class => false, - \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class => false, - \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class => false, - \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class => false, - \ShipStream\Ups\Api\Model\POMPickupNotifications::class => false, - \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class => false, - \ShipStream\Ups\Api\Model\FreightPickupResponse::class => false, - \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class => false, - \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class => false, - \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class => false, - \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class => false, - \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class => false, - \ShipStream\Ups\Api\Model\FreightCancelStatus::class => false, - \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class => false, - \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequest::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class => false, - \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class => false, - \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class => false, - \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class => false, - \ShipStream\Ups\Api\Model\PayerAddress::class => false, - \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestService::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitOneType::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class => false, - \ShipStream\Ups\Api\Model\CommodityWeight::class => false, - \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class => false, - \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\CommodityDimensions::class => false, - \ShipStream\Ups\Api\Model\CommodityPackagingType::class => false, - \ShipStream\Ups\Api\Model\CommodityCommodityValue::class => false, - \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class => false, - \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class => false, - \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class => false, - \ShipStream\Ups\Api\Model\OverSeasLegValue::class => false, - \ShipStream\Ups\Api\Model\ValueCube::class => false, - \ShipStream\Ups\Api\Model\ValueCWT::class => false, - \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class => false, - \ShipStream\Ups\Api\Model\CODCODValue::class => false, - \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class => false, - \ShipStream\Ups\Api\Model\CODCODBillingOption::class => false, - \ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class => false, - \ShipStream\Ups\Api\Model\RemitToAddress::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class => false, - \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class => false, - \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class => false, - \ShipStream\Ups\Api\Model\HandlingChargeAmount::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class => false, - \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponse::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseRate::class => false, - \ShipStream\Ups\Api\Model\RateType::class => false, - \ShipStream\Ups\Api\Model\RateFactor::class => false, - \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class => false, - \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseService::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class => false, - \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class => false, - \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class => false, - \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class => false, - \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class => false, - \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class => false, - \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class => false, - \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class => false, - \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class => false, - \ShipStream\Ups\Api\Model\FreightShipRequest::class => false, - \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class => false, - \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class => false, - \ShipStream\Ups\Api\Model\PaymentInformationPayer::class => false, - \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class => false, - \ShipStream\Ups\Api\Model\PayerPhone::class => false, - \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class => false, - \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class => false, - \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class => false, - \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class => false, - \ShipStream\Ups\Api\Model\ConfirmationNumberType::class => false, - \ShipStream\Ups\Api\Model\ShipmentCommodity::class => false, - \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class => false, - \ShipStream\Ups\Api\Model\ShipmentReference::class => false, - \ShipStream\Ups\Api\Model\ReferenceNumber::class => false, - \ShipStream\Ups\Api\Model\ReferenceWeight::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class => false, - \ShipStream\Ups\Api\Model\EMailInformationEMailType::class => false, - \ShipStream\Ups\Api\Model\EMailInformationEMail::class => false, - \ShipStream\Ups\Api\Model\CODRemitTo::class => false, - \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class => false, - \ShipStream\Ups\Api\Model\RemitToPhone::class => false, - \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class => false, - \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class => false, - \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class => false, - \ShipStream\Ups\Api\Model\PickupRequestRequester::class => false, - \ShipStream\Ups\Api\Model\PickupRequestPOM::class => false, - \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class => false, - \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class => false, - \ShipStream\Ups\Api\Model\ShipmentDocuments::class => false, - \ShipStream\Ups\Api\Model\DocumentsImage::class => false, - \ShipStream\Ups\Api\Model\ImageType::class => false, - \ShipStream\Ups\Api\Model\ImageFormat::class => false, - \ShipStream\Ups\Api\Model\ImagePrintFormat::class => false, - \ShipStream\Ups\Api\Model\ImagePrintSize::class => false, - \ShipStream\Ups\Api\Model\DocumentsPackingList::class => false, - \ShipStream\Ups\Api\Model\PackingListShipFrom::class => false, - \ShipStream\Ups\Api\Model\PackingListShipTo::class => false, - \ShipStream\Ups\Api\Model\PackingListReference::class => false, - \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class => false, - \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class => false, - \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class => false, - \ShipStream\Ups\Api\Model\FreightShipResponse::class => false, - \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class => false, - \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsRate::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsService::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class => false, - \ShipStream\Ups\Api\Model\DocumentsForms::class => false, - \ShipStream\Ups\Api\Model\FormsType::class => false, - \ShipStream\Ups\Api\Model\FormsFormat::class => false, - \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class => false, - \ShipStream\Ups\Api\Model\TimeInTransitRequest::class => false, - \ShipStream\Ups\Api\Model\TimeInTransitResponse::class => false, - \ShipStream\Ups\Api\Model\ValidationList::class => false, - \ShipStream\Ups\Api\Model\EmsResponse::class => false, - \ShipStream\Ups\Api\Model\CandidateAddress::class => false, - \ShipStream\Ups\Api\Model\Services::class => false, - \ShipStream\Ups\Api\Model\AccessPointInformation::class => false, - \ShipStream\Ups\Api\Model\Activity::class => false, - \ShipStream\Ups\Api\Model\Address::class => false, - \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class => false, - \ShipStream\Ups\Api\Model\DeliveryDate::class => false, - \ShipStream\Ups\Api\Model\DeliveryInformation::class => false, - \ShipStream\Ups\Api\Model\DeliveryTime::class => false, - \ShipStream\Ups\Api\Model\InquireNumbers::class => false, - \ShipStream\Ups\Api\Model\Location::class => false, - \ShipStream\Ups\Api\Model\Milestones::class => false, - \ShipStream\Ups\Api\Model\Package::class => false, - \ShipStream\Ups\Api\Model\PackageAddress::class => false, - \ShipStream\Ups\Api\Model\PaymentInformation::class => false, - \ShipStream\Ups\Api\Model\Service::class => false, - \ShipStream\Ups\Api\Model\Shipment::class => false, - \ShipStream\Ups\Api\Model\Signature::class => false, - \ShipStream\Ups\Api\Model\Status::class => false, - \ShipStream\Ups\Api\Model\SubMilestone::class => false, - \ShipStream\Ups\Api\Model\TrackApiResponse::class => false, - \ShipStream\Ups\Api\Model\TrackResponse::class => false, - \ShipStream\Ups\Api\Model\Warning::class => false, - \ShipStream\Ups\Api\Model\Weight::class => false, - \ShipStream\Ups\Api\Model\Destination::class => false, - \ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class => false, - \ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class => false, - \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class => false, - \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class => false, - \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class => false, - \Jane\Component\JsonSchemaRuntime\Reference::class => false, - ]; - } + return array_key_exists($type, $this->normalizers); + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && array_key_exists(get_class($data), $this->normalizers); + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $normalizerClass = $this->normalizers[get_class($data)]; + $normalizer = $this->getNormalizer($normalizerClass); + return $normalizer->normalize($data, $format, $context); + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + $denormalizerClass = $this->normalizers[$type]; + $denormalizer = $this->getNormalizer($denormalizerClass); + return $denormalizer->denormalize($data, $type, $format, $context); + } + private function getNormalizer(string $normalizerClass) + { + return $this->normalizersCache[$normalizerClass] ?? $this->initNormalizer($normalizerClass); + } + private function initNormalizer(string $normalizerClass) + { + $normalizer = new $normalizerClass(); + $normalizer->setNormalizer($this->normalizer); + $normalizer->setDenormalizer($this->denormalizer); + $this->normalizersCache[$normalizerClass] = $normalizer; + return $normalizer; + } + public function getSupportedTypes(?string $format = null): array + { + return [ + + \ShipStream\Ups\Api\Model\XAVRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\XAVResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\XAVRequest::class => false, + \ShipStream\Ups\Api\Model\XAVRequestRequest::class => false, + \ShipStream\Ups\Api\Model\RequestTransactionReference::class => false, + \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class => false, + \ShipStream\Ups\Api\Model\XAVResponse::class => false, + \ShipStream\Ups\Api\Model\XAVResponseResponse::class => false, + \ShipStream\Ups\Api\Model\ResponseResponseStatus::class => false, + \ShipStream\Ups\Api\Model\ResponseAlert::class => false, + \ShipStream\Ups\Api\Model\ResponseTransactionReference::class => false, + \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class => false, + \ShipStream\Ups\Api\Model\XAVResponseCandidate::class => false, + \ShipStream\Ups\Api\Model\CandidateAddressClassification::class => false, + \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class => false, + \ShipStream\Ups\Api\Model\ErrorResponse::class => false, + \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\Error::class => false, + \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequest::class => false, + \ShipStream\Ups\Api\Model\ChemicalReferenceDataRequestRequest::class => false, + \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponse::class => false, + \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseResponse::class => false, + \ShipStream\Ups\Api\Model\ChemicalReferenceDataResponseChemicalData::class => false, + \ShipStream\Ups\Api\Model\ChemicalDataChemicalDetail::class => false, + \ShipStream\Ups\Api\Model\ChemicalDataProperShippingNameDetail::class => false, + \ShipStream\Ups\Api\Model\ChemicalDataPackageQuantityLimitDetail::class => false, + \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\DANGEROUSGOODSUTILITYAPCResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequest::class => false, + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestRequest::class => false, + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckRequestShipment::class => false, + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipFromAddress::class => false, + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentShipToAddress::class => false, + \ShipStream\Ups\Api\Model\ShipmentService::class => false, + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckShipmentPackage::class => false, + \ShipStream\Ups\Api\Model\PackagePackageWeight::class => false, + \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\PackageChemicalRecord::class => false, + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponse::class => false, + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseResponse::class => false, + \ShipStream\Ups\Api\Model\ResponseAlertDetail::class => false, + \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class => false, + \ShipStream\Ups\Api\Model\ElementLevelInformationElementIdentifier::class => false, + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponseService::class => false, + \ShipStream\Ups\Api\Model\AcceptanceAuditPreCheckResponsePackageResults::class => false, + \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class => false, + \ShipStream\Ups\Api\Model\LandedCostRequest::class => false, + \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class => false, + \ShipStream\Ups\Api\Model\RequestShipmentItems::class => false, + \ShipStream\Ups\Api\Model\LandedCostResponse::class => false, + \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class => false, + \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class => false, + \ShipStream\Ups\Api\Model\BrokerageFeeItems::class => false, + \ShipStream\Ups\Api\Model\ResponseShipmentItems::class => false, + \ShipStream\Ups\Api\Model\Errors::class => false, + \ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\LocatorRequest::class => false, + \ShipStream\Ups\Api\Model\LocatorRequestRequest::class => false, + \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class => false, + \ShipStream\Ups\Api\Model\OriginAddressGeocode::class => false, + \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class => false, + \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class => false, + \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class => false, + \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class => false, + \ShipStream\Ups\Api\Model\SearchOptionOptionType::class => false, + \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class => false, + \ShipStream\Ups\Api\Model\SearchOptionRelation::class => false, + \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class => false, + \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class => false, + \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class => false, + \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class => false, + \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class => false, + \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class => false, + \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class => false, + \ShipStream\Ups\Api\Model\IncludeCriteriaMerchantAccountNumberList::class => false, + \ShipStream\Ups\Api\Model\IncludeCriteriaSearchFilter::class => false, + \ShipStream\Ups\Api\Model\IncludeCriteriaServiceOfferingList::class => false, + \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class => false, + \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class => false, + \ShipStream\Ups\Api\Model\ExcludeFromResultPostalCodeList::class => false, + \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class => false, + \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class => false, + \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class => false, + \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class => false, + \ShipStream\Ups\Api\Model\LocatorResponse::class => false, + \ShipStream\Ups\Api\Model\LocatorResponseResponse::class => false, + \ShipStream\Ups\Api\Model\ResponseError::class => false, + \ShipStream\Ups\Api\Model\ErrorErrorLocation::class => false, + \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class => false, + \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class => false, + \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class => false, + \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class => false, + \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class => false, + \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class => false, + \ShipStream\Ups\Api\Model\DropLocationIVR::class => false, + \ShipStream\Ups\Api\Model\DropLocationGeocode::class => false, + \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class => false, + \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class => false, + \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class => false, + \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class => false, + \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class => false, + \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class => false, + \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class => false, + \ShipStream\Ups\Api\Model\DropLocationDistance::class => false, + \ShipStream\Ups\Api\Model\DistanceUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class => false, + \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class => false, + \ShipStream\Ups\Api\Model\AdditionalCommentsCommentType::class => false, + \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class => false, + \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class => false, + \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class => false, + \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class => false, + \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class => false, + \ShipStream\Ups\Api\Model\DropLocationSortCode::class => false, + \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class => false, + \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class => false, + \ShipStream\Ups\Api\Model\AccessPointInformationBusinessClassificationList::class => false, + \ShipStream\Ups\Api\Model\BusinessClassificationListBusinessClassification::class => false, + \ShipStream\Ups\Api\Model\AccessPointInformationAccessPointStatus::class => false, + \ShipStream\Ups\Api\Model\AccessPointInformationPrivateNetworkList::class => false, + \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class => false, + \ShipStream\Ups\Api\Model\AccessPointInformationAvailability::class => false, + \ShipStream\Ups\Api\Model\AvailabilityShippingAvailability::class => false, + \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class => false, + \ShipStream\Ups\Api\Model\AvailabilityDCRAvailability::class => false, + \ShipStream\Ups\Api\Model\DCRAvailabilityUnavailableReason::class => false, + \ShipStream\Ups\Api\Model\DropLocationLocationImage::class => false, + \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class => false, + \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class => false, + \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class => false, + \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCodeTransportationPickUpSchedule::class => false, + \ShipStream\Ups\Api\Model\AvailableLocationAttributesTransportationPickUpSchedulePickUp::class => false, + \ShipStream\Ups\Api\Model\AvailableLocationAttributesPickUpPickUpDetails::class => false, + \ShipStream\Ups\Api\Model\GenerateTokenSuccessResponse::class => false, + \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class => false, + \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\DeleteRequest::class => false, + \ShipStream\Ups\Api\Model\DeleteRequestRequest::class => false, + \ShipStream\Ups\Api\Model\DeleteResponse::class => false, + \ShipStream\Ups\Api\Model\DeleteResponseResponse::class => false, + \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class => false, + \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class => false, + \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class => false, + \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class => false, + \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class => false, + \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\UploadRequest::class => false, + \ShipStream\Ups\Api\Model\UploadRequestRequest::class => false, + \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class => false, + \ShipStream\Ups\Api\Model\UploadResponse::class => false, + \ShipStream\Ups\Api\Model\UploadResponseResponse::class => false, + \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class => false, + \ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\PickupRateRequest::class => false, + \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class => false, + \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class => false, + \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class => false, + \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class => false, + \ShipStream\Ups\Api\Model\PickupRateResponse::class => false, + \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class => false, + \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class => false, + \ShipStream\Ups\Api\Model\RateResultChargeDetail::class => false, + \ShipStream\Ups\Api\Model\RateResultTaxCharges::class => false, + \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class => false, + \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\PickupCancelRequest::class => false, + \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class => false, + \ShipStream\Ups\Api\Model\PickupCancelResponse::class => false, + \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class => false, + \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class => false, + \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\PickupCreationRequest::class => false, + \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class => false, + \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class => false, + \ShipStream\Ups\Api\Model\ShipperAccount::class => false, + \ShipStream\Ups\Api\Model\ShipperChargeCard::class => false, + \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class => false, + \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class => false, + \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class => false, + \ShipStream\Ups\Api\Model\PickupAddressPhone::class => false, + \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class => false, + \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class => false, + \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class => false, + \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class => false, + \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class => false, + \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class => false, + \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class => false, + \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class => false, + \ShipStream\Ups\Api\Model\PalletInformationDimensions::class => false, + \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\PickupCreationResponse::class => false, + \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class => false, + \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class => false, + \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class => false, + \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class => false, + \ShipStream\Ups\Api\Model\RateResultDisclaimer::class => false, + \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class => false, + \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class => false, + \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class => false, + \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class => false, + \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class => false, + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class => false, + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class => false, + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class => false, + \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class => false, + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class => false, + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class => false, + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class => false, + \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class => false, + \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class => false, + \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class => false, + \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class => false, + \ShipStream\Ups\Api\Model\FacilityTimeDayOfWeek::class => false, + \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class => false, + \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class => false, + \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class => false, + \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class => false, + \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class => false, + \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class => false, + \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class => false, + \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class => false, + \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class => false, + \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class => false, + \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class => false, + \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\PreNotificationRequest::class => false, + \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class => false, + \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class => false, + \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class => false, + \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class => false, + \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class => false, + \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class => false, + \ShipStream\Ups\Api\Model\PreNotificationResponse::class => false, + \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class => false, + \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\QuantumViewRequest::class => false, + \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class => false, + \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class => false, + \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class => false, + \ShipStream\Ups\Api\Model\QuantumViewResponse::class => false, + \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class => false, + \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class => false, + \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class => false, + \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class => false, + \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class => false, + \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class => false, + \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class => false, + \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class => false, + \ShipStream\Ups\Api\Model\ManifestShipper::class => false, + \ShipStream\Ups\Api\Model\ManifestShipperAddress::class => false, + \ShipStream\Ups\Api\Model\ManifestShipTo::class => false, + \ShipStream\Ups\Api\Model\ManifestShipToAddress::class => false, + \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\ManifestService::class => false, + \ShipStream\Ups\Api\Model\ManifestPackage::class => false, + \ShipStream\Ups\Api\Model\PackageActivity::class => false, + \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class => false, + \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class => false, + \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class => false, + \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class => false, + \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class => false, + \ShipStream\Ups\Api\Model\CODCODAmount::class => false, + \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class => false, + \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class => false, + \ShipStream\Ups\Api\Model\ManifestCustomsValue::class => false, + \ShipStream\Ups\Api\Model\ManifestBillToAccount::class => false, + \ShipStream\Ups\Api\Model\ManifestUAPAddress::class => false, + \ShipStream\Ups\Api\Model\UAPAddressAddress::class => false, + \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class => false, + \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\OriginActivityLocation::class => false, + \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class => false, + \ShipStream\Ups\Api\Model\OriginBillToAccount::class => false, + \ShipStream\Ups\Api\Model\SubscriptionFileException::class => false, + \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class => false, + \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class => false, + \ShipStream\Ups\Api\Model\ExceptionResolution::class => false, + \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class => false, + \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class => false, + \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class => false, + \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class => false, + \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class => false, + \ShipStream\Ups\Api\Model\DeliveryLocationAddressArtifactFormat::class => false, + \ShipStream\Ups\Api\Model\AddressArtifactFormatAddressExtendedInformation::class => false, + \ShipStream\Ups\Api\Model\DeliveryCOD::class => false, + \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class => false, + \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class => false, + \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\GenericService::class => false, + \ShipStream\Ups\Api\Model\GenericActivity::class => false, + \ShipStream\Ups\Api\Model\GenericBillToAccount::class => false, + \ShipStream\Ups\Api\Model\GenericShipTo::class => false, + \ShipStream\Ups\Api\Model\GenericFailureNotification::class => false, + \ShipStream\Ups\Api\Model\FailureNotificationFailureNotificationCode::class => false, + \ShipStream\Ups\Api\Model\RATERequestWrapper::class => false, + \ShipStream\Ups\Api\Model\RATEResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\RateRequest::class => false, + \ShipStream\Ups\Api\Model\RateRequestRequest::class => false, + \ShipStream\Ups\Api\Model\RateRequestPickupType::class => false, + \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class => false, + \ShipStream\Ups\Api\Model\RateRequestShipment::class => false, + \ShipStream\Ups\Api\Model\RateShipmentShipper::class => false, + \ShipStream\Ups\Api\Model\ShipperAddress::class => false, + \ShipStream\Ups\Api\Model\RateShipmentShipTo::class => false, + \ShipStream\Ups\Api\Model\ShipToAddress::class => false, + \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class => false, + \ShipStream\Ups\Api\Model\ShipFromAddress::class => false, + \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class => false, + \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class => false, + \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class => false, + \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class => false, + \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class => false, + \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class => false, + \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class => false, + \ShipStream\Ups\Api\Model\BillReceiverAddress::class => false, + \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class => false, + \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class => false, + \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class => false, + \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class => false, + \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class => false, + \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class => false, + \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class => false, + \ShipStream\Ups\Api\Model\FreightDensityInfoAdjustedHeight::class => false, + \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\FreightDensityInfoHandlingUnits::class => false, + \ShipStream\Ups\Api\Model\HandlingUnitsType::class => false, + \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class => false, + \ShipStream\Ups\Api\Model\HandlingUnitsUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class => false, + \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\RateShipmentPackage::class => false, + \ShipStream\Ups\Api\Model\PackagePackagingType::class => false, + \ShipStream\Ups\Api\Model\PackageDimensions::class => false, + \ShipStream\Ups\Api\Model\PackageDimWeight::class => false, + \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\PackageCommodity::class => false, + \ShipStream\Ups\Api\Model\CommodityNMFC::class => false, + \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class => false, + \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class => false, + \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class => false, + \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class => false, + \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class => false, + \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class => false, + \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class => false, + \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class => false, + \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class => false, + \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class => false, + \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class => false, + \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class => false, + \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class => false, + \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class => false, + \ShipStream\Ups\Api\Model\DryIceWeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\PackageSimpleRate::class => false, + \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class => false, + \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class => false, + \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class => false, + \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class => false, + \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class => false, + \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class => false, + \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class => false, + \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class => false, + \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class => false, + \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class => false, + \ShipStream\Ups\Api\Model\RateResponse::class => false, + \ShipStream\Ups\Api\Model\RateResponseResponse::class => false, + \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentService::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class => false, + \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class => false, + \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class => false, + \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class => false, + \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class => false, + \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class => false, + \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class => false, + \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class => false, + \ShipStream\Ups\Api\Model\HandlingUnitsAdjustedHeight::class => false, + \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class => false, + \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class => false, + \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class => false, + \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class => false, + \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class => false, + \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class => false, + \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class => false, + \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class => false, + \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class => false, + \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class => false, + \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class => false, + \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class => false, + \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class => false, + \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class => false, + \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class => false, + \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class => false, + \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class => false, + \ShipStream\Ups\Api\Model\ServiceSummaryService::class => false, + \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class => false, + \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class => false, + \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class => false, + \ShipStream\Ups\Api\Model\SHIPRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\SHIPResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\ShipmentRequest::class => false, + \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class => false, + \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class => false, + \ShipStream\Ups\Api\Model\ShipmentReturnService::class => false, + \ShipStream\Ups\Api\Model\ShipmentShipper::class => false, + \ShipStream\Ups\Api\Model\ShipperPhone::class => false, + \ShipStream\Ups\Api\Model\ShipmentShipTo::class => false, + \ShipStream\Ups\Api\Model\ShipToPhone::class => false, + \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class => false, + \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class => false, + \ShipStream\Ups\Api\Model\ShipmentShipFrom::class => false, + \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class => false, + \ShipStream\Ups\Api\Model\ShipFromPhone::class => false, + \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class => false, + \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class => false, + \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class => false, + \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class => false, + \ShipStream\Ups\Api\Model\BillShipperCreditCard::class => false, + \ShipStream\Ups\Api\Model\CreditCardAddress::class => false, + \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class => false, + \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class => false, + \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class => false, + \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class => false, + \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class => false, + \ShipStream\Ups\Api\Model\NotificationEMail::class => false, + \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class => false, + \ShipStream\Ups\Api\Model\NotificationTextMessage::class => false, + \ShipStream\Ups\Api\Model\NotificationLocale::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class => false, + \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class => false, + \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class => false, + \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class => false, + \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class => false, + \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class => false, + \ShipStream\Ups\Api\Model\CN22FormCN22Content::class => false, + \ShipStream\Ups\Api\Model\CN22ContentCN22ContentWeight::class => false, + \ShipStream\Ups\Api\Model\CN22ContentWeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class => false, + \ShipStream\Ups\Api\Model\EEIFilingOptionUPSFiled::class => false, + \ShipStream\Ups\Api\Model\UPSFiledPOA::class => false, + \ShipStream\Ups\Api\Model\EEIFilingOptionShipperFiled::class => false, + \ShipStream\Ups\Api\Model\InternationalFormsContacts::class => false, + \ShipStream\Ups\Api\Model\ContactsForwardAgent::class => false, + \ShipStream\Ups\Api\Model\ForwardAgentAddress::class => false, + \ShipStream\Ups\Api\Model\ContactsUltimateConsignee::class => false, + \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class => false, + \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class => false, + \ShipStream\Ups\Api\Model\ContactsIntermediateConsignee::class => false, + \ShipStream\Ups\Api\Model\IntermediateConsigneeAddress::class => false, + \ShipStream\Ups\Api\Model\ContactsProducer::class => false, + \ShipStream\Ups\Api\Model\ProducerAddress::class => false, + \ShipStream\Ups\Api\Model\ProducerPhone::class => false, + \ShipStream\Ups\Api\Model\ContactsSoldTo::class => false, + \ShipStream\Ups\Api\Model\SoldToPhone::class => false, + \ShipStream\Ups\Api\Model\SoldToAddress::class => false, + \ShipStream\Ups\Api\Model\InternationalFormsProduct::class => false, + \ShipStream\Ups\Api\Model\ProductUnit::class => false, + \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class => false, + \ShipStream\Ups\Api\Model\ProductProductWeight::class => false, + \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\ProductScheduleB::class => false, + \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class => false, + \ShipStream\Ups\Api\Model\ProductPackingListInfo::class => false, + \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class => false, + \ShipStream\Ups\Api\Model\ProductEEIInformation::class => false, + \ShipStream\Ups\Api\Model\EEIInformationLicense::class => false, + \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class => false, + \ShipStream\Ups\Api\Model\DDTCInformationUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class => false, + \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class => false, + \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class => false, + \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class => false, + \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class => false, + \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class => false, + \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class => false, + \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class => false, + \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class => false, + \ShipStream\Ups\Api\Model\ShipmentPackage::class => false, + \ShipStream\Ups\Api\Model\PackagePackaging::class => false, + \ShipStream\Ups\Api\Model\PackageReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\PackageUPSPremier::class => false, + \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class => false, + \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class => false, + \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class => false, + \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class => false, + \ShipStream\Ups\Api\Model\DeclaredValueType::class => false, + \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class => false, + \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class => false, + \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class => false, + \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class => false, + \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class => false, + \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class => false, + \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class => false, + \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class => false, + \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class => false, + \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class => false, + \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class => false, + \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class => false, + \ShipStream\Ups\Api\Model\ShipmentResponse::class => false, + \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class => false, + \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class => false, + \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class => false, + \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class => false, + \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class => false, + \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class => false, + \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class => false, + \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class => false, + \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class => false, + \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class => false, + \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class => false, + \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class => false, + \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class => false, + \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class => false, + \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class => false, + \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class => false, + \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class => false, + \ShipStream\Ups\Api\Model\PackageResultsForm::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class => false, + \ShipStream\Ups\Api\Model\FormImage::class => false, + \ShipStream\Ups\Api\Model\HighValueReportImageImageFormat::class => false, + \ShipStream\Ups\Api\Model\CODTurnInPageImageImageFormat::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class => false, + \ShipStream\Ups\Api\Model\ImageImageFormat::class => false, + \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class => false, + \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class => false, + \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class => false, + \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsForm::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class => false, + \ShipStream\Ups\Api\Model\CODTurnInPageImage::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class => false, + \ShipStream\Ups\Api\Model\HighValueReportImage::class => false, + \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\VoidShipmentRequest::class => false, + \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class => false, + \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class => false, + \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class => false, + \ShipStream\Ups\Api\Model\VoidShipmentResponse::class => false, + \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class => false, + \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class => false, + \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class => false, + \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class => false, + \ShipStream\Ups\Api\Model\SummaryResultStatus::class => false, + \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class => false, + \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class => false, + \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class => false, + \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class => false, + \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class => false, + \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class => false, + \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class => false, + \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class => false, + \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class => false, + \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class => false, + \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class => false, + \ShipStream\Ups\Api\Model\LabelResultsReceipt::class => false, + \ShipStream\Ups\Api\Model\ReceiptImage::class => false, + \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class => false, + \ShipStream\Ups\Api\Model\LabelResultsForm::class => false, + \ShipStream\Ups\Api\Model\LRFormImage::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class => false, + \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class => false, + \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class => false, + \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class => false, + \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class => false, + \ShipStream\Ups\Api\Model\FREIGHTPICKUPRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\FREIGHTPICKUPResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\FreightPickupRequest::class => false, + \ShipStream\Ups\Api\Model\FreightPickupRequestRequest::class => false, + \ShipStream\Ups\Api\Model\FreightPickupRequestRequester::class => false, + \ShipStream\Ups\Api\Model\RequesterPhone::class => false, + \ShipStream\Ups\Api\Model\FreightPickupRequestShipFrom::class => false, + \ShipStream\Ups\Api\Model\FreightPickupRequestShipTo::class => false, + \ShipStream\Ups\Api\Model\FreightPickupShipToAddress::class => false, + \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentServiceOptions::class => false, + \ShipStream\Ups\Api\Model\FreightPickupRequestShipmentDetail::class => false, + \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class => false, + \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class => false, + \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\FreightPickupRequestExistingShipmentID::class => false, + \ShipStream\Ups\Api\Model\FreightPickupRequestPOM::class => false, + \ShipStream\Ups\Api\Model\POMPickupNotifications::class => false, + \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class => false, + \ShipStream\Ups\Api\Model\FreightPickupResponse::class => false, + \ShipStream\Ups\Api\Model\FreightPickupResponseResponse::class => false, + \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\FREIGHTPICKUPCANCELResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\FreightCancelPickupRequest::class => false, + \ShipStream\Ups\Api\Model\FreightCancelPickupRequestRequest::class => false, + \ShipStream\Ups\Api\Model\FreightCancelPickupResponse::class => false, + \ShipStream\Ups\Api\Model\FreightCancelPickupResponseResponse::class => false, + \ShipStream\Ups\Api\Model\FreightCancelStatus::class => false, + \ShipStream\Ups\Api\Model\FREIGHTRATERequestWrapper::class => false, + \ShipStream\Ups\Api\Model\FREIGHTRATEResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequest::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestRequest::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestShipFrom::class => false, + \ShipStream\Ups\Api\Model\FreightRateShipFromAddress::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestShipTo::class => false, + \ShipStream\Ups\Api\Model\FreightRateShipToAddress::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestPaymentInformation::class => false, + \ShipStream\Ups\Api\Model\FreightRatePaymentInformationPayer::class => false, + \ShipStream\Ups\Api\Model\PayerAddress::class => false, + \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestService::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitOne::class => false, + \ShipStream\Ups\Api\Model\HandlingUnitOneType::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitTwo::class => false, + \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestCommodity::class => false, + \ShipStream\Ups\Api\Model\CommodityWeight::class => false, + \ShipStream\Ups\Api\Model\CommodityAdjustedWeight::class => false, + \ShipStream\Ups\Api\Model\AdjustedWeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\CommodityDimensions::class => false, + \ShipStream\Ups\Api\Model\CommodityPackagingType::class => false, + \ShipStream\Ups\Api\Model\CommodityCommodityValue::class => false, + \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestShipmentServiceOptions::class => false, + \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsPickupOptions::class => false, + \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsDeliveryOptions::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class => false, + \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class => false, + \ShipStream\Ups\Api\Model\OverSeasLegValue::class => false, + \ShipStream\Ups\Api\Model\ValueCube::class => false, + \ShipStream\Ups\Api\Model\ValueCWT::class => false, + \ShipStream\Ups\Api\Model\FreightShipmentServiceOptionsCOD::class => false, + \ShipStream\Ups\Api\Model\CODCODValue::class => false, + \ShipStream\Ups\Api\Model\CODCODPaymentMethod::class => false, + \ShipStream\Ups\Api\Model\CODCODBillingOption::class => false, + \ShipStream\Ups\Api\Model\FreightRateCODRemitTo::class => false, + \ShipStream\Ups\Api\Model\RemitToAddress::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class => false, + \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class => false, + \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class => false, + \ShipStream\Ups\Api\Model\HandlingChargeAmount::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestPickupRequest::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestAlternateRateOptions::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestGFPOptions::class => false, + \ShipStream\Ups\Api\Model\GFPOptionsOnCallInformation::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnitWeight::class => false, + \ShipStream\Ups\Api\Model\HandlingUnitWeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\FreightRateRequestHandlingUnits::class => false, + \ShipStream\Ups\Api\Model\FreightRateResponse::class => false, + \ShipStream\Ups\Api\Model\FreightRateResponseResponse::class => false, + \ShipStream\Ups\Api\Model\FreightRateResponseRate::class => false, + \ShipStream\Ups\Api\Model\RateType::class => false, + \ShipStream\Ups\Api\Model\RateFactor::class => false, + \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\FreightRateResponseFreightDensityRate::class => false, + \ShipStream\Ups\Api\Model\FreightRateResponseCommodity::class => false, + \ShipStream\Ups\Api\Model\FreightRateResponseTotalShipmentCharge::class => false, + \ShipStream\Ups\Api\Model\FreightRateResponseBillableShipmentWeight::class => false, + \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\FreightRateResponseDimensionalWeight::class => false, + \ShipStream\Ups\Api\Model\FreightRateResponseService::class => false, + \ShipStream\Ups\Api\Model\FreightRateResponseAlternateRatesResponse::class => false, + \ShipStream\Ups\Api\Model\AlternateRatesResponseAlternateRateType::class => false, + \ShipStream\Ups\Api\Model\AlternateRatesResponseRate::class => false, + \ShipStream\Ups\Api\Model\AlternateRatesResponseFreightDensityRate::class => false, + \ShipStream\Ups\Api\Model\AlternateRatesResponseBillableShipmentWeight::class => false, + \ShipStream\Ups\Api\Model\AlternateRatesResponseTimeInTransit::class => false, + \ShipStream\Ups\Api\Model\FreightRateResponseTimeInTransit::class => false, + \ShipStream\Ups\Api\Model\FreightRateResponseHandlingUnits::class => false, + \ShipStream\Ups\Api\Model\FREIGHTSHIPRequestWrapper::class => false, + \ShipStream\Ups\Api\Model\FREIGHTSHIPResponseWrapper::class => false, + \ShipStream\Ups\Api\Model\FreightShipRequest::class => false, + \ShipStream\Ups\Api\Model\FreightShipRequestRequest::class => false, + \ShipStream\Ups\Api\Model\FreightShipRequestShipment::class => false, + \ShipStream\Ups\Api\Model\FreightShipShipmentShipFrom::class => false, + \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class => false, + \ShipStream\Ups\Api\Model\FreightShipShipmentShipTo::class => false, + \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class => false, + \ShipStream\Ups\Api\Model\FreightShipShipmentPaymentInformation::class => false, + \ShipStream\Ups\Api\Model\PaymentInformationPayer::class => false, + \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class => false, + \ShipStream\Ups\Api\Model\PayerPhone::class => false, + \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class => false, + \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class => false, + \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class => false, + \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class => false, + \ShipStream\Ups\Api\Model\ConfirmationNumberType::class => false, + \ShipStream\Ups\Api\Model\ShipmentCommodity::class => false, + \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class => false, + \ShipStream\Ups\Api\Model\ShipmentReference::class => false, + \ShipStream\Ups\Api\Model\ReferenceNumber::class => false, + \ShipStream\Ups\Api\Model\ReferenceWeight::class => false, + \ShipStream\Ups\Api\Model\FreightShipShipmentShipmentServiceOptions::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class => false, + \ShipStream\Ups\Api\Model\EMailInformationEMailType::class => false, + \ShipStream\Ups\Api\Model\EMailInformationEMail::class => false, + \ShipStream\Ups\Api\Model\CODRemitTo::class => false, + \ShipStream\Ups\Api\Model\FreightShipRemitToAddress::class => false, + \ShipStream\Ups\Api\Model\RemitToPhone::class => false, + \ShipStream\Ups\Api\Model\FreightShipShipmentServiceOptionsDangerousGoods::class => false, + \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class => false, + \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class => false, + \ShipStream\Ups\Api\Model\PickupRequestRequester::class => false, + \ShipStream\Ups\Api\Model\PickupRequestPOM::class => false, + \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class => false, + \ShipStream\Ups\Api\Model\FreightShipPickupNotificationsEMailNotification::class => false, + \ShipStream\Ups\Api\Model\ShipmentDocuments::class => false, + \ShipStream\Ups\Api\Model\DocumentsImage::class => false, + \ShipStream\Ups\Api\Model\ImageType::class => false, + \ShipStream\Ups\Api\Model\ImageFormat::class => false, + \ShipStream\Ups\Api\Model\ImagePrintFormat::class => false, + \ShipStream\Ups\Api\Model\ImagePrintSize::class => false, + \ShipStream\Ups\Api\Model\DocumentsPackingList::class => false, + \ShipStream\Ups\Api\Model\PackingListShipFrom::class => false, + \ShipStream\Ups\Api\Model\PackingListShipTo::class => false, + \ShipStream\Ups\Api\Model\PackingListReference::class => false, + \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class => false, + \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class => false, + \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class => false, + \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class => false, + \ShipStream\Ups\Api\Model\FreightShipResponse::class => false, + \ShipStream\Ups\Api\Model\FreightShipResponseResponse::class => false, + \ShipStream\Ups\Api\Model\FreightShipResponseShipmentResults::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsRate::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsService::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class => false, + \ShipStream\Ups\Api\Model\DocumentsForms::class => false, + \ShipStream\Ups\Api\Model\FormsType::class => false, + \ShipStream\Ups\Api\Model\FormsFormat::class => false, + \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class => false, + \ShipStream\Ups\Api\Model\TimeInTransitRequest::class => false, + \ShipStream\Ups\Api\Model\TimeInTransitResponse::class => false, + \ShipStream\Ups\Api\Model\ValidationList::class => false, + \ShipStream\Ups\Api\Model\EmsResponse::class => false, + \ShipStream\Ups\Api\Model\CandidateAddress::class => false, + \ShipStream\Ups\Api\Model\Services::class => false, + \ShipStream\Ups\Api\Model\AccessPointInformation::class => false, + \ShipStream\Ups\Api\Model\Activity::class => false, + \ShipStream\Ups\Api\Model\Address::class => false, + \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class => false, + \ShipStream\Ups\Api\Model\DeliveryDate::class => false, + \ShipStream\Ups\Api\Model\DeliveryInformation::class => false, + \ShipStream\Ups\Api\Model\DeliveryTime::class => false, + \ShipStream\Ups\Api\Model\InquireNumbers::class => false, + \ShipStream\Ups\Api\Model\Location::class => false, + \ShipStream\Ups\Api\Model\Milestones::class => false, + \ShipStream\Ups\Api\Model\Package::class => false, + \ShipStream\Ups\Api\Model\PackageAddress::class => false, + \ShipStream\Ups\Api\Model\PaymentInformation::class => false, + \ShipStream\Ups\Api\Model\Service::class => false, + \ShipStream\Ups\Api\Model\Shipment::class => false, + \ShipStream\Ups\Api\Model\Signature::class => false, + \ShipStream\Ups\Api\Model\Status::class => false, + \ShipStream\Ups\Api\Model\SubMilestone::class => false, + \ShipStream\Ups\Api\Model\TrackApiResponse::class => false, + \ShipStream\Ups\Api\Model\TrackResponse::class => false, + \ShipStream\Ups\Api\Model\Warning::class => false, + \ShipStream\Ups\Api\Model\Weight::class => false, + \ShipStream\Ups\Api\Model\Destination::class => false, + \ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class => false, + \ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class => false, + \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class => false, + \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class => false, + \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class => false, + \Jane\Component\JsonSchemaRuntime\Reference::class => false, + ]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LABELRECOVERYRequestWrapperNormalizer.php b/src/Api/Normalizer/LABELRECOVERYRequestWrapperNormalizer.php index ea03445f..7072f4d6 100644 --- a/src/Api/Normalizer/LABELRECOVERYRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/LABELRECOVERYRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LABELRECOVERYRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LABELRECOVERYRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LabelRecoveryRequest', $data)) { - $object->setLabelRecoveryRequest($this->denormalizer->denormalize($data['LabelRecoveryRequest'], \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class, 'json', $context)); - unset($data['LabelRecoveryRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['LabelRecoveryRequest'] = $this->normalizer->normalize($object->getLabelRecoveryRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('LabelRecoveryRequest', $data)) { + $object->setLabelRecoveryRequest($this->denormalizer->denormalize($data['LabelRecoveryRequest'], \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class, 'json', $context)); + unset($data['LabelRecoveryRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LABELRECOVERYRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['LabelRecoveryRequest'] = $this->normalizer->normalize($data->getLabelRecoveryRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('LabelRecoveryRequest', $data)) { - $object->setLabelRecoveryRequest($this->denormalizer->denormalize($data['LabelRecoveryRequest'], \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class, 'json', $context)); - unset($data['LabelRecoveryRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['LabelRecoveryRequest'] = $this->normalizer->normalize($object->getLabelRecoveryRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LABELRECOVERYRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LABELRECOVERYResponseWrapperNormalizer.php b/src/Api/Normalizer/LABELRECOVERYResponseWrapperNormalizer.php index e86aea7c..436c0b5d 100644 --- a/src/Api/Normalizer/LABELRECOVERYResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/LABELRECOVERYResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LABELRECOVERYResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LABELRECOVERYResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LabelRecoveryResponse', $data)) { - $object->setLabelRecoveryResponse($this->denormalizer->denormalize($data['LabelRecoveryResponse'], \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class, 'json', $context)); - unset($data['LabelRecoveryResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['LabelRecoveryResponse'] = $this->normalizer->normalize($object->getLabelRecoveryResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('LabelRecoveryResponse', $data)) { + $object->setLabelRecoveryResponse($this->denormalizer->denormalize($data['LabelRecoveryResponse'], \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class, 'json', $context)); + unset($data['LabelRecoveryResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LABELRECOVERYResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['LabelRecoveryResponse'] = $this->normalizer->normalize($data->getLabelRecoveryResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('LabelRecoveryResponse', $data)) { - $object->setLabelRecoveryResponse($this->denormalizer->denormalize($data['LabelRecoveryResponse'], \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class, 'json', $context)); - unset($data['LabelRecoveryResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['LabelRecoveryResponse'] = $this->normalizer->normalize($object->getLabelRecoveryResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LABELRECOVERYResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LOCATORRequestWrapperNormalizer.php b/src/Api/Normalizer/LOCATORRequestWrapperNormalizer.php index 09ed819d..a6b0bfb6 100644 --- a/src/Api/Normalizer/LOCATORRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/LOCATORRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LOCATORRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LOCATORRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LOCATORRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LocatorRequest', $data)) { - $object->setLocatorRequest($this->denormalizer->denormalize($data['LocatorRequest'], \ShipStream\Ups\Api\Model\LocatorRequest::class, 'json', $context)); - unset($data['LocatorRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LOCATORRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['LocatorRequest'] = $this->normalizer->normalize($object->getLocatorRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('LocatorRequest', $data)) { + $object->setLocatorRequest($this->denormalizer->denormalize($data['LocatorRequest'], \ShipStream\Ups\Api\Model\LocatorRequest::class, 'json', $context)); + unset($data['LocatorRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LOCATORRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LOCATORRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['LocatorRequest'] = $this->normalizer->normalize($data->getLocatorRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('LocatorRequest', $data)) { - $object->setLocatorRequest($this->denormalizer->denormalize($data['LocatorRequest'], \ShipStream\Ups\Api\Model\LocatorRequest::class, 'json', $context)); - unset($data['LocatorRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['LocatorRequest'] = $this->normalizer->normalize($object->getLocatorRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LOCATORRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LOCATORResponseWrapperNormalizer.php b/src/Api/Normalizer/LOCATORResponseWrapperNormalizer.php index bc0654d9..399e1afe 100644 --- a/src/Api/Normalizer/LOCATORResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/LOCATORResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LOCATORResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LOCATORResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LOCATORResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LocatorResponse', $data)) { - $object->setLocatorResponse($this->denormalizer->denormalize($data['LocatorResponse'], \ShipStream\Ups\Api\Model\LocatorResponse::class, 'json', $context)); - unset($data['LocatorResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LOCATORResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['LocatorResponse'] = $this->normalizer->normalize($object->getLocatorResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('LocatorResponse', $data)) { + $object->setLocatorResponse($this->denormalizer->denormalize($data['LocatorResponse'], \ShipStream\Ups\Api\Model\LocatorResponse::class, 'json', $context)); + unset($data['LocatorResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LOCATORResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LOCATORResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['LocatorResponse'] = $this->normalizer->normalize($data->getLocatorResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('LocatorResponse', $data)) { - $object->setLocatorResponse($this->denormalizer->denormalize($data['LocatorResponse'], \ShipStream\Ups\Api\Model\LocatorResponse::class, 'json', $context)); - unset($data['LocatorResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['LocatorResponse'] = $this->normalizer->normalize($object->getLocatorResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LOCATORResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LRCODTurnInPageImageImageFormatNormalizer.php b/src/Api/Normalizer/LRCODTurnInPageImageImageFormatNormalizer.php index 925d9066..017d10b1 100644 --- a/src/Api/Normalizer/LRCODTurnInPageImageImageFormatNormalizer.php +++ b/src/Api/Normalizer/LRCODTurnInPageImageImageFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LRCODTurnInPageImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LRCODTurnInPageImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LRCODTurnInPageImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LRCODTurnInPageImageNormalizer.php b/src/Api/Normalizer/LRCODTurnInPageImageNormalizer.php index d3e9432a..f6a61f10 100644 --- a/src/Api/Normalizer/LRCODTurnInPageImageNormalizer.php +++ b/src/Api/Normalizer/LRCODTurnInPageImageNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LRCODTurnInPageImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LRCODTurnInPageImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class; + return $type === \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LRCODTurnInPageImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LRCODTurnInPageImage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class => false]; - } - } -} else { - class LRCODTurnInPageImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class; + if (\array_key_exists('ImageFormat', $data)) { + $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class, 'json', $context)); + unset($data['ImageFormat']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class; + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LRCODTurnInPageImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\LRCODTurnInPageImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ImageFormat'] = $this->normalizer->normalize($data->getImageFormat(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LRFormImageNormalizer.php b/src/Api/Normalizer/LRFormImageNormalizer.php index 0cafe39b..6064a9b2 100644 --- a/src/Api/Normalizer/LRFormImageNormalizer.php +++ b/src/Api/Normalizer/LRFormImageNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LRFormImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LRFormImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LRFormImage::class; + return $type === \ShipStream\Ups\Api\Model\LRFormImage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRFormImage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRFormImage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LRFormImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LRFormImage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LRFormImage::class => false]; - } - } -} else { - class LRFormImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LRFormImage::class; + if (\array_key_exists('ImageFormat', $data)) { + $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ImageImageFormat::class, 'json', $context)); + unset($data['ImageFormat']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRFormImage::class; + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LRFormImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ImageFormat'] = $this->normalizer->normalize($data->getImageFormat(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LRFormImage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LRFormImage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LRRequestTransactionReferenceNormalizer.php b/src/Api/Normalizer/LRRequestTransactionReferenceNormalizer.php index 31f40b47..e2c7c4ff 100644 --- a/src/Api/Normalizer/LRRequestTransactionReferenceNormalizer.php +++ b/src/Api/Normalizer/LRRequestTransactionReferenceNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LRRequestTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LRRequestTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class; + return $type === \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LRRequestTransactionReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CustomerContext', $data)) { - $object->setCustomerContext($data['CustomerContext']); - unset($data['CustomerContext']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LRRequestTransactionReference(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('customerContext') && null !== $object->getCustomerContext()) { - $data['CustomerContext'] = $object->getCustomerContext(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CustomerContext', $data)) { + $object->setCustomerContext($data['CustomerContext']); + unset($data['CustomerContext']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LRRequestTransactionReference::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LRRequestTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class; + $dataArray = []; + if ($data->isInitialized('customerContext') && null !== $data->getCustomerContext()) { + $dataArray['CustomerContext'] = $data->getCustomerContext(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LRRequestTransactionReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CustomerContext', $data)) { - $object->setCustomerContext($data['CustomerContext']); - unset($data['CustomerContext']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('customerContext') && null !== $object->getCustomerContext()) { - $data['CustomerContext'] = $object->getCustomerContext(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LRRequestTransactionReference::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LRRequestTransactionReference::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LRResponseResponseStatusNormalizer.php b/src/Api/Normalizer/LRResponseResponseStatusNormalizer.php index 5a4e54a8..dc8abeb2 100644 --- a/src/Api/Normalizer/LRResponseResponseStatusNormalizer.php +++ b/src/Api/Normalizer/LRResponseResponseStatusNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LRResponseResponseStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LRResponseResponseStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class; + return $type === \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LRResponseResponseStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LRResponseResponseStatus(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LRResponseResponseStatus::class => false]; - } - } -} else { - class LRResponseResponseStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LRResponseResponseStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LRResponseResponseStatus::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LRResponseResponseStatus::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LRResponseTransactionReferenceNormalizer.php b/src/Api/Normalizer/LRResponseTransactionReferenceNormalizer.php index 1585dbfb..599427ac 100644 --- a/src/Api/Normalizer/LRResponseTransactionReferenceNormalizer.php +++ b/src/Api/Normalizer/LRResponseTransactionReferenceNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LRResponseTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LRResponseTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class; + return $type === \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LRResponseTransactionReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CustomerContext', $data)) { - $object->setCustomerContext($data['CustomerContext']); - unset($data['CustomerContext']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LRResponseTransactionReference(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('customerContext') && null !== $object->getCustomerContext()) { - $data['CustomerContext'] = $object->getCustomerContext(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CustomerContext', $data)) { + $object->setCustomerContext($data['CustomerContext']); + unset($data['CustomerContext']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LRResponseTransactionReference::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LRResponseTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class; + $dataArray = []; + if ($data->isInitialized('customerContext') && null !== $data->getCustomerContext()) { + $dataArray['CustomerContext'] = $data->getCustomerContext(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LRResponseTransactionReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CustomerContext', $data)) { - $object->setCustomerContext($data['CustomerContext']); - unset($data['CustomerContext']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('customerContext') && null !== $object->getCustomerContext()) { - $data['CustomerContext'] = $object->getCustomerContext(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LRResponseTransactionReference::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LRResponseTransactionReference::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelDeliveryEMailNormalizer.php b/src/Api/Normalizer/LabelDeliveryEMailNormalizer.php index d6166fa4..5ee929ac 100644 --- a/src/Api/Normalizer/LabelDeliveryEMailNormalizer.php +++ b/src/Api/Normalizer/LabelDeliveryEMailNormalizer.php @@ -5,210 +5,104 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelDeliveryEMailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelDeliveryEMailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelDeliveryEMail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('UndeliverableEMailAddress', $data)) { - $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); - unset($data['UndeliverableEMailAddress']); - } - if (\array_key_exists('FromEMailAddress', $data)) { - $object->setFromEMailAddress($data['FromEMailAddress']); - unset($data['FromEMailAddress']); - } - if (\array_key_exists('FromName', $data)) { - $object->setFromName($data['FromName']); - unset($data['FromName']); - } - if (\array_key_exists('Memo', $data)) { - $object->setMemo($data['Memo']); - unset($data['Memo']); - } - if (\array_key_exists('Subject', $data)) { - $object->setSubject($data['Subject']); - unset($data['Subject']); - } - if (\array_key_exists('SubjectCode', $data)) { - $object->setSubjectCode($data['SubjectCode']); - unset($data['SubjectCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\LabelDeliveryEMail(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['EMailAddress'] = $object->getEMailAddress(); - if ($object->isInitialized('undeliverableEMailAddress') && null !== $object->getUndeliverableEMailAddress()) { - $data['UndeliverableEMailAddress'] = $object->getUndeliverableEMailAddress(); - } - if ($object->isInitialized('fromEMailAddress') && null !== $object->getFromEMailAddress()) { - $data['FromEMailAddress'] = $object->getFromEMailAddress(); - } - if ($object->isInitialized('fromName') && null !== $object->getFromName()) { - $data['FromName'] = $object->getFromName(); - } - if ($object->isInitialized('memo') && null !== $object->getMemo()) { - $data['Memo'] = $object->getMemo(); - } - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['Subject'] = $object->getSubject(); - } - if ($object->isInitialized('subjectCode') && null !== $object->getSubjectCode()) { - $data['SubjectCode'] = $object->getSubjectCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); + } + if (\array_key_exists('UndeliverableEMailAddress', $data)) { + $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); + unset($data['UndeliverableEMailAddress']); + } + if (\array_key_exists('FromEMailAddress', $data)) { + $object->setFromEMailAddress($data['FromEMailAddress']); + unset($data['FromEMailAddress']); + } + if (\array_key_exists('FromName', $data)) { + $object->setFromName($data['FromName']); + unset($data['FromName']); + } + if (\array_key_exists('Memo', $data)) { + $object->setMemo($data['Memo']); + unset($data['Memo']); + } + if (\array_key_exists('Subject', $data)) { + $object->setSubject($data['Subject']); + unset($data['Subject']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelDeliveryEMail::class => false]; + if (\array_key_exists('SubjectCode', $data)) { + $object->setSubjectCode($data['SubjectCode']); + unset($data['SubjectCode']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LabelDeliveryEMailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelDeliveryEMail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('UndeliverableEMailAddress', $data)) { - $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); - unset($data['UndeliverableEMailAddress']); - } - if (\array_key_exists('FromEMailAddress', $data)) { - $object->setFromEMailAddress($data['FromEMailAddress']); - unset($data['FromEMailAddress']); - } - if (\array_key_exists('FromName', $data)) { - $object->setFromName($data['FromName']); - unset($data['FromName']); - } - if (\array_key_exists('Memo', $data)) { - $object->setMemo($data['Memo']); - unset($data['Memo']); - } - if (\array_key_exists('Subject', $data)) { - $object->setSubject($data['Subject']); - unset($data['Subject']); - } - if (\array_key_exists('SubjectCode', $data)) { - $object->setSubjectCode($data['SubjectCode']); - unset($data['SubjectCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['EMailAddress'] = $data->getEMailAddress(); + if ($data->isInitialized('undeliverableEMailAddress') && null !== $data->getUndeliverableEMailAddress()) { + $dataArray['UndeliverableEMailAddress'] = $data->getUndeliverableEMailAddress(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['EMailAddress'] = $object->getEMailAddress(); - if ($object->isInitialized('undeliverableEMailAddress') && null !== $object->getUndeliverableEMailAddress()) { - $data['UndeliverableEMailAddress'] = $object->getUndeliverableEMailAddress(); - } - if ($object->isInitialized('fromEMailAddress') && null !== $object->getFromEMailAddress()) { - $data['FromEMailAddress'] = $object->getFromEMailAddress(); - } - if ($object->isInitialized('fromName') && null !== $object->getFromName()) { - $data['FromName'] = $object->getFromName(); - } - if ($object->isInitialized('memo') && null !== $object->getMemo()) { - $data['Memo'] = $object->getMemo(); - } - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['Subject'] = $object->getSubject(); - } - if ($object->isInitialized('subjectCode') && null !== $object->getSubjectCode()) { - $data['SubjectCode'] = $object->getSubjectCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('fromEMailAddress') && null !== $data->getFromEMailAddress()) { + $dataArray['FromEMailAddress'] = $data->getFromEMailAddress(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelDeliveryEMail::class => false]; + if ($data->isInitialized('fromName') && null !== $data->getFromName()) { + $dataArray['FromName'] = $data->getFromName(); } + if ($data->isInitialized('memo') && null !== $data->getMemo()) { + $dataArray['Memo'] = $data->getMemo(); + } + if ($data->isInitialized('subject') && null !== $data->getSubject()) { + $dataArray['Subject'] = $data->getSubject(); + } + if ($data->isInitialized('subjectCode') && null !== $data->getSubjectCode()) { + $dataArray['SubjectCode'] = $data->getSubjectCode(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelDeliveryEMail::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelImageLabelImageFormatNormalizer.php b/src/Api/Normalizer/LabelImageLabelImageFormatNormalizer.php index 0b73d73e..ad178fe1 100644 --- a/src/Api/Normalizer/LabelImageLabelImageFormatNormalizer.php +++ b/src/Api/Normalizer/LabelImageLabelImageFormatNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelImageLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelImageLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LabelImageLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryFormImageNormalizer.php b/src/Api/Normalizer/LabelRecoveryFormImageNormalizer.php index 5159c009..48d93ae1 100644 --- a/src/Api/Normalizer/LabelRecoveryFormImageNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryFormImageNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryFormImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryFormImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryFormImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryFormImage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class => false]; - } - } -} else { - class LabelRecoveryFormImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class; + if (\array_key_exists('ImageFormat', $data)) { + $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class, 'json', $context)); + unset($data['ImageFormat']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class; + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryFormImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ImageFormat'] = $this->normalizer->normalize($data->getImageFormat(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryImageImageFormatNormalizer.php b/src/Api/Normalizer/LabelRecoveryImageImageFormatNormalizer.php index 9b46c6ea..20e0e2a1 100644 --- a/src/Api/Normalizer/LabelRecoveryImageImageFormatNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryImageImageFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LabelRecoveryImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryImageImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryLabelSpecificationLabelImageFormatNormalizer.php b/src/Api/Normalizer/LabelRecoveryLabelSpecificationLabelImageFormatNormalizer.php index abe9f09c..500db1ce 100644 --- a/src/Api/Normalizer/LabelRecoveryLabelSpecificationLabelImageFormatNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryLabelSpecificationLabelImageFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryLabelSpecificationLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryLabelSpecificationLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LabelRecoveryLabelSpecificationLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryLabelSpecificationLabelStockSizeNormalizer.php b/src/Api/Normalizer/LabelRecoveryLabelSpecificationLabelStockSizeNormalizer.php index e9fb6636..79ecc32f 100644 --- a/src/Api/Normalizer/LabelRecoveryLabelSpecificationLabelStockSizeNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryLabelSpecificationLabelStockSizeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryLabelSpecificationLabelStockSizeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryLabelSpecificationLabelStockSizeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Height'] = $object->getHeight(); - $data['Width'] = $object->getWidth(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class => false]; - } - } -} else { - class LabelRecoveryLabelSpecificationLabelStockSizeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class; + if (\array_key_exists('Height', $data)) { + $object->setHeight($data['Height']); + unset($data['Height']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class; + if (\array_key_exists('Width', $data)) { + $object->setWidth($data['Width']); + unset($data['Width']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Height'] = $object->getHeight(); - $data['Width'] = $object->getWidth(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Height'] = $data->getHeight(); + $dataArray['Width'] = $data->getWidth(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryRequestLabelDeliveryNormalizer.php b/src/Api/Normalizer/LabelRecoveryRequestLabelDeliveryNormalizer.php index ca38f8bd..e75980c2 100644 --- a/src/Api/Normalizer/LabelRecoveryRequestLabelDeliveryNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryRequestLabelDeliveryNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryRequestLabelDeliveryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryRequestLabelDeliveryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LabelLinkIndicator', $data)) { - $object->setLabelLinkIndicator($data['LabelLinkIndicator']); - unset($data['LabelLinkIndicator']); - } - if (\array_key_exists('ResendEMailIndicator', $data)) { - $object->setResendEMailIndicator($data['ResendEMailIndicator']); - unset($data['ResendEMailIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('labelLinkIndicator') && null !== $object->getLabelLinkIndicator()) { - $data['LabelLinkIndicator'] = $object->getLabelLinkIndicator(); - } - if ($object->isInitialized('resendEMailIndicator') && null !== $object->getResendEMailIndicator()) { - $data['ResendEMailIndicator'] = $object->getResendEMailIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('LabelLinkIndicator', $data)) { + $object->setLabelLinkIndicator($data['LabelLinkIndicator']); + unset($data['LabelLinkIndicator']); + } + if (\array_key_exists('ResendEMailIndicator', $data)) { + $object->setResendEMailIndicator($data['ResendEMailIndicator']); + unset($data['ResendEMailIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LabelRecoveryRequestLabelDeliveryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class; + $dataArray = []; + if ($data->isInitialized('labelLinkIndicator') && null !== $data->getLabelLinkIndicator()) { + $dataArray['LabelLinkIndicator'] = $data->getLabelLinkIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LabelLinkIndicator', $data)) { - $object->setLabelLinkIndicator($data['LabelLinkIndicator']); - unset($data['LabelLinkIndicator']); - } - if (\array_key_exists('ResendEMailIndicator', $data)) { - $object->setResendEMailIndicator($data['ResendEMailIndicator']); - unset($data['ResendEMailIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('resendEMailIndicator') && null !== $data->getResendEMailIndicator()) { + $dataArray['ResendEMailIndicator'] = $data->getResendEMailIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('labelLinkIndicator') && null !== $object->getLabelLinkIndicator()) { - $data['LabelLinkIndicator'] = $object->getLabelLinkIndicator(); - } - if ($object->isInitialized('resendEMailIndicator') && null !== $object->getResendEMailIndicator()) { - $data['ResendEMailIndicator'] = $object->getResendEMailIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryRequestLabelSpecificationNormalizer.php b/src/Api/Normalizer/LabelRecoveryRequestLabelSpecificationNormalizer.php index 7d5d53cf..a7a85827 100644 --- a/src/Api/Normalizer/LabelRecoveryRequestLabelSpecificationNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryRequestLabelSpecificationNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryRequestLabelSpecificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryRequestLabelSpecificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HTTPUserAgent', $data)) { - $object->setHTTPUserAgent($data['HTTPUserAgent']); - unset($data['HTTPUserAgent']); - } - if (\array_key_exists('LabelImageFormat', $data)) { - $object->setLabelImageFormat($this->denormalizer->denormalize($data['LabelImageFormat'], \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class, 'json', $context)); - unset($data['LabelImageFormat']); - } - if (\array_key_exists('LabelStockSize', $data)) { - $object->setLabelStockSize($this->denormalizer->denormalize($data['LabelStockSize'], \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class, 'json', $context)); - unset($data['LabelStockSize']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('hTTPUserAgent') && null !== $object->getHTTPUserAgent()) { - $data['HTTPUserAgent'] = $object->getHTTPUserAgent(); - } - if ($object->isInitialized('labelImageFormat') && null !== $object->getLabelImageFormat()) { - $data['LabelImageFormat'] = $this->normalizer->normalize($object->getLabelImageFormat(), 'json', $context); - } - if ($object->isInitialized('labelStockSize') && null !== $object->getLabelStockSize()) { - $data['LabelStockSize'] = $this->normalizer->normalize($object->getLabelStockSize(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('HTTPUserAgent', $data)) { + $object->setHTTPUserAgent($data['HTTPUserAgent']); + unset($data['HTTPUserAgent']); + } + if (\array_key_exists('LabelImageFormat', $data)) { + $object->setLabelImageFormat($this->denormalizer->denormalize($data['LabelImageFormat'], \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class, 'json', $context)); + unset($data['LabelImageFormat']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class => false]; + if (\array_key_exists('LabelStockSize', $data)) { + $object->setLabelStockSize($this->denormalizer->denormalize($data['LabelStockSize'], \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class, 'json', $context)); + unset($data['LabelStockSize']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LabelRecoveryRequestLabelSpecificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class; + $dataArray = []; + if ($data->isInitialized('hTTPUserAgent') && null !== $data->getHTTPUserAgent()) { + $dataArray['HTTPUserAgent'] = $data->getHTTPUserAgent(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class; + if ($data->isInitialized('labelImageFormat') && null !== $data->getLabelImageFormat()) { + $dataArray['LabelImageFormat'] = $this->normalizer->normalize($data->getLabelImageFormat(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HTTPUserAgent', $data)) { - $object->setHTTPUserAgent($data['HTTPUserAgent']); - unset($data['HTTPUserAgent']); - } - if (\array_key_exists('LabelImageFormat', $data)) { - $object->setLabelImageFormat($this->denormalizer->denormalize($data['LabelImageFormat'], \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelImageFormat::class, 'json', $context)); - unset($data['LabelImageFormat']); - } - if (\array_key_exists('LabelStockSize', $data)) { - $object->setLabelStockSize($this->denormalizer->denormalize($data['LabelStockSize'], \ShipStream\Ups\Api\Model\LabelRecoveryLabelSpecificationLabelStockSize::class, 'json', $context)); - unset($data['LabelStockSize']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('labelStockSize') && null !== $data->getLabelStockSize()) { + $dataArray['LabelStockSize'] = $this->normalizer->normalize($data->getLabelStockSize(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('hTTPUserAgent') && null !== $object->getHTTPUserAgent()) { - $data['HTTPUserAgent'] = $object->getHTTPUserAgent(); - } - if ($object->isInitialized('labelImageFormat') && null !== $object->getLabelImageFormat()) { - $data['LabelImageFormat'] = $this->normalizer->normalize($object->getLabelImageFormat(), 'json', $context); - } - if ($object->isInitialized('labelStockSize') && null !== $object->getLabelStockSize()) { - $data['LabelStockSize'] = $this->normalizer->normalize($object->getLabelStockSize(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryRequestNormalizer.php b/src/Api/Normalizer/LabelRecoveryRequestNormalizer.php index 716de9f1..9b0239aa 100644 --- a/src/Api/Normalizer/LabelRecoveryRequestNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryRequestNormalizer.php @@ -5,238 +5,118 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('LabelSpecification', $data)) { - $object->setLabelSpecification($this->denormalizer->denormalize($data['LabelSpecification'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class, 'json', $context)); - unset($data['LabelSpecification']); - } - if (\array_key_exists('Translate', $data)) { - $object->setTranslate($this->denormalizer->denormalize($data['Translate'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class, 'json', $context)); - unset($data['Translate']); - } - if (\array_key_exists('LabelDelivery', $data)) { - $object->setLabelDelivery($this->denormalizer->denormalize($data['LabelDelivery'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class, 'json', $context)); - unset($data['LabelDelivery']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('MailInnovationsTrackingNumber', $data)) { - $object->setMailInnovationsTrackingNumber($data['MailInnovationsTrackingNumber']); - unset($data['MailInnovationsTrackingNumber']); - } - if (\array_key_exists('ReferenceValues', $data)) { - $object->setReferenceValues($this->denormalizer->denormalize($data['ReferenceValues'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class, 'json', $context)); - unset($data['ReferenceValues']); - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - if (\array_key_exists('UPSPremiumCareForm', $data)) { - $object->setUPSPremiumCareForm($this->denormalizer->denormalize($data['UPSPremiumCareForm'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class, 'json', $context)); - unset($data['UPSPremiumCareForm']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('labelSpecification') && null !== $object->getLabelSpecification()) { - $data['LabelSpecification'] = $this->normalizer->normalize($object->getLabelSpecification(), 'json', $context); - } - if ($object->isInitialized('translate') && null !== $object->getTranslate()) { - $data['Translate'] = $this->normalizer->normalize($object->getTranslate(), 'json', $context); - } - if ($object->isInitialized('labelDelivery') && null !== $object->getLabelDelivery()) { - $data['LabelDelivery'] = $this->normalizer->normalize($object->getLabelDelivery(), 'json', $context); - } - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $data['TrackingNumber'] = $object->getTrackingNumber(); - } - if ($object->isInitialized('mailInnovationsTrackingNumber') && null !== $object->getMailInnovationsTrackingNumber()) { - $data['MailInnovationsTrackingNumber'] = $object->getMailInnovationsTrackingNumber(); - } - if ($object->isInitialized('referenceValues') && null !== $object->getReferenceValues()) { - $data['ReferenceValues'] = $this->normalizer->normalize($object->getReferenceValues(), 'json', $context); - } - if ($object->isInitialized('locale') && null !== $object->getLocale()) { - $data['Locale'] = $object->getLocale(); - } - if ($object->isInitialized('uPSPremiumCareForm') && null !== $object->getUPSPremiumCareForm()) { - $data['UPSPremiumCareForm'] = $this->normalizer->normalize($object->getUPSPremiumCareForm(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class, 'json', $context)); + unset($data['Request']); + } + if (\array_key_exists('LabelSpecification', $data)) { + $object->setLabelSpecification($this->denormalizer->denormalize($data['LabelSpecification'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class, 'json', $context)); + unset($data['LabelSpecification']); + } + if (\array_key_exists('Translate', $data)) { + $object->setTranslate($this->denormalizer->denormalize($data['Translate'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class, 'json', $context)); + unset($data['Translate']); + } + if (\array_key_exists('LabelDelivery', $data)) { + $object->setLabelDelivery($this->denormalizer->denormalize($data['LabelDelivery'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class, 'json', $context)); + unset($data['LabelDelivery']); + } + if (\array_key_exists('TrackingNumber', $data)) { + $object->setTrackingNumber($data['TrackingNumber']); + unset($data['TrackingNumber']); + } + if (\array_key_exists('MailInnovationsTrackingNumber', $data)) { + $object->setMailInnovationsTrackingNumber($data['MailInnovationsTrackingNumber']); + unset($data['MailInnovationsTrackingNumber']); + } + if (\array_key_exists('ReferenceValues', $data)) { + $object->setReferenceValues($this->denormalizer->denormalize($data['ReferenceValues'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class, 'json', $context)); + unset($data['ReferenceValues']); + } + if (\array_key_exists('Locale', $data)) { + $object->setLocale($data['Locale']); + unset($data['Locale']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequest::class => false]; + if (\array_key_exists('UPSPremiumCareForm', $data)) { + $object->setUPSPremiumCareForm($this->denormalizer->denormalize($data['UPSPremiumCareForm'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class, 'json', $context)); + unset($data['UPSPremiumCareForm']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LabelRecoveryRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('LabelSpecification', $data)) { - $object->setLabelSpecification($this->denormalizer->denormalize($data['LabelSpecification'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelSpecification::class, 'json', $context)); - unset($data['LabelSpecification']); - } - if (\array_key_exists('Translate', $data)) { - $object->setTranslate($this->denormalizer->denormalize($data['Translate'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class, 'json', $context)); - unset($data['Translate']); - } - if (\array_key_exists('LabelDelivery', $data)) { - $object->setLabelDelivery($this->denormalizer->denormalize($data['LabelDelivery'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestLabelDelivery::class, 'json', $context)); - unset($data['LabelDelivery']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('MailInnovationsTrackingNumber', $data)) { - $object->setMailInnovationsTrackingNumber($data['MailInnovationsTrackingNumber']); - unset($data['MailInnovationsTrackingNumber']); - } - if (\array_key_exists('ReferenceValues', $data)) { - $object->setReferenceValues($this->denormalizer->denormalize($data['ReferenceValues'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class, 'json', $context)); - unset($data['ReferenceValues']); - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - if (\array_key_exists('UPSPremiumCareForm', $data)) { - $object->setUPSPremiumCareForm($this->denormalizer->denormalize($data['UPSPremiumCareForm'], \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class, 'json', $context)); - unset($data['UPSPremiumCareForm']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + if ($data->isInitialized('labelSpecification') && null !== $data->getLabelSpecification()) { + $dataArray['LabelSpecification'] = $this->normalizer->normalize($data->getLabelSpecification(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('labelSpecification') && null !== $object->getLabelSpecification()) { - $data['LabelSpecification'] = $this->normalizer->normalize($object->getLabelSpecification(), 'json', $context); - } - if ($object->isInitialized('translate') && null !== $object->getTranslate()) { - $data['Translate'] = $this->normalizer->normalize($object->getTranslate(), 'json', $context); - } - if ($object->isInitialized('labelDelivery') && null !== $object->getLabelDelivery()) { - $data['LabelDelivery'] = $this->normalizer->normalize($object->getLabelDelivery(), 'json', $context); - } - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $data['TrackingNumber'] = $object->getTrackingNumber(); - } - if ($object->isInitialized('mailInnovationsTrackingNumber') && null !== $object->getMailInnovationsTrackingNumber()) { - $data['MailInnovationsTrackingNumber'] = $object->getMailInnovationsTrackingNumber(); - } - if ($object->isInitialized('referenceValues') && null !== $object->getReferenceValues()) { - $data['ReferenceValues'] = $this->normalizer->normalize($object->getReferenceValues(), 'json', $context); - } - if ($object->isInitialized('locale') && null !== $object->getLocale()) { - $data['Locale'] = $object->getLocale(); - } - if ($object->isInitialized('uPSPremiumCareForm') && null !== $object->getUPSPremiumCareForm()) { - $data['UPSPremiumCareForm'] = $this->normalizer->normalize($object->getUPSPremiumCareForm(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('translate') && null !== $data->getTranslate()) { + $dataArray['Translate'] = $this->normalizer->normalize($data->getTranslate(), 'json', $context); + } + if ($data->isInitialized('labelDelivery') && null !== $data->getLabelDelivery()) { + $dataArray['LabelDelivery'] = $this->normalizer->normalize($data->getLabelDelivery(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequest::class => false]; + if ($data->isInitialized('trackingNumber') && null !== $data->getTrackingNumber()) { + $dataArray['TrackingNumber'] = $data->getTrackingNumber(); } + if ($data->isInitialized('mailInnovationsTrackingNumber') && null !== $data->getMailInnovationsTrackingNumber()) { + $dataArray['MailInnovationsTrackingNumber'] = $data->getMailInnovationsTrackingNumber(); + } + if ($data->isInitialized('referenceValues') && null !== $data->getReferenceValues()) { + $dataArray['ReferenceValues'] = $this->normalizer->normalize($data->getReferenceValues(), 'json', $context); + } + if ($data->isInitialized('locale') && null !== $data->getLocale()) { + $dataArray['Locale'] = $data->getLocale(); + } + if ($data->isInitialized('uPSPremiumCareForm') && null !== $data->getUPSPremiumCareForm()) { + $dataArray['UPSPremiumCareForm'] = $this->normalizer->normalize($data->getUPSPremiumCareForm(), 'json', $context); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryRequestReferenceValuesNormalizer.php b/src/Api/Normalizer/LabelRecoveryRequestReferenceValuesNormalizer.php index ff9305df..2581a5ac 100644 --- a/src/Api/Normalizer/LabelRecoveryRequestReferenceValuesNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryRequestReferenceValuesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryRequestReferenceValuesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryRequestReferenceValuesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ReferenceNumber', $data)) { - $object->setReferenceNumber($this->denormalizer->denormalize($data['ReferenceNumber'], \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class, 'json', $context)); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ReferenceNumber'] = $this->normalizer->normalize($object->getReferenceNumber(), 'json', $context); - $data['ShipperNumber'] = $object->getShipperNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class => false]; - } - } -} else { - class LabelRecoveryRequestReferenceValuesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class; + if (\array_key_exists('ReferenceNumber', $data)) { + $object->setReferenceNumber($this->denormalizer->denormalize($data['ReferenceNumber'], \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class, 'json', $context)); + unset($data['ReferenceNumber']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class; + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ReferenceNumber', $data)) { - $object->setReferenceNumber($this->denormalizer->denormalize($data['ReferenceNumber'], \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class, 'json', $context)); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ReferenceNumber'] = $this->normalizer->normalize($object->getReferenceNumber(), 'json', $context); - $data['ShipperNumber'] = $object->getShipperNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ReferenceNumber'] = $this->normalizer->normalize($data->getReferenceNumber(), 'json', $context); + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestReferenceValues::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryRequestRequestNormalizer.php b/src/Api/Normalizer/LabelRecoveryRequestRequestNormalizer.php index f991976c..7e3e7957 100644 --- a/src/Api/Normalizer/LabelRecoveryRequestRequestNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryRequestRequestNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('SubVersion', $data)) { + $object->setSubVersion($data['SubVersion']); + unset($data['SubVersion']); + } + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class => false]; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LabelRecoveryRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('subVersion') && null !== $data->getSubVersion()) { + $dataArray['SubVersion'] = $data->getSubVersion(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class; + if ($data->isInitialized('requestOption') && null !== $data->getRequestOption()) { + $dataArray['RequestOption'] = $data->getRequestOption(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\LRRequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryRequestTranslateNormalizer.php b/src/Api/Normalizer/LabelRecoveryRequestTranslateNormalizer.php index 7555e7ff..d21f846b 100644 --- a/src/Api/Normalizer/LabelRecoveryRequestTranslateNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryRequestTranslateNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryRequestTranslateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryRequestTranslateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LanguageCode', $data)) { - $object->setLanguageCode($data['LanguageCode']); - unset($data['LanguageCode']); - } - if (\array_key_exists('DialectCode', $data)) { - $object->setDialectCode($data['DialectCode']); - unset($data['DialectCode']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['LanguageCode'] = $object->getLanguageCode(); - $data['DialectCode'] = $object->getDialectCode(); - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('LanguageCode', $data)) { + $object->setLanguageCode($data['LanguageCode']); + unset($data['LanguageCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class => false]; + if (\array_key_exists('DialectCode', $data)) { + $object->setDialectCode($data['DialectCode']); + unset($data['DialectCode']); } - } -} else { - class LabelRecoveryRequestTranslateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LanguageCode', $data)) { - $object->setLanguageCode($data['LanguageCode']); - unset($data['LanguageCode']); - } - if (\array_key_exists('DialectCode', $data)) { - $object->setDialectCode($data['DialectCode']); - unset($data['DialectCode']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['LanguageCode'] = $object->getLanguageCode(); - $data['DialectCode'] = $object->getDialectCode(); - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['LanguageCode'] = $data->getLanguageCode(); + $dataArray['DialectCode'] = $data->getDialectCode(); + $dataArray['Code'] = $data->getCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestTranslate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryRequestUPSPremiumCareFormNormalizer.php b/src/Api/Normalizer/LabelRecoveryRequestUPSPremiumCareFormNormalizer.php index ce9b608d..26fa944b 100644 --- a/src/Api/Normalizer/LabelRecoveryRequestUPSPremiumCareFormNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryRequestUPSPremiumCareFormNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryRequestUPSPremiumCareFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryRequestUPSPremiumCareFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PageSize', $data)) { - $object->setPageSize($data['PageSize']); - unset($data['PageSize']); - } - if (\array_key_exists('PrintType', $data)) { - $object->setPrintType($data['PrintType']); - unset($data['PrintType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PageSize'] = $object->getPageSize(); - $data['PrintType'] = $object->getPrintType(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class => false]; - } - } -} else { - class LabelRecoveryRequestUPSPremiumCareFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class; + if (\array_key_exists('PageSize', $data)) { + $object->setPageSize($data['PageSize']); + unset($data['PageSize']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class; + if (\array_key_exists('PrintType', $data)) { + $object->setPrintType($data['PrintType']); + unset($data['PrintType']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PageSize', $data)) { - $object->setPageSize($data['PageSize']); - unset($data['PageSize']); - } - if (\array_key_exists('PrintType', $data)) { - $object->setPrintType($data['PrintType']); - unset($data['PrintType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PageSize'] = $object->getPageSize(); - $data['PrintType'] = $object->getPrintType(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['PageSize'] = $data->getPageSize(); + $dataArray['PrintType'] = $data->getPrintType(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryRequestUPSPremiumCareForm::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryResponseCODTurnInPageNormalizer.php b/src/Api/Normalizer/LabelRecoveryResponseCODTurnInPageNormalizer.php index dd72fe36..f34035bf 100644 --- a/src/Api/Normalizer/LabelRecoveryResponseCODTurnInPageNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryResponseCODTurnInPageNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryResponseCODTurnInPageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryResponseCODTurnInPageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class, 'json', $context)); - unset($data['Image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Image', $data)) { + $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class, 'json', $context)); + unset($data['Image']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LabelRecoveryResponseCODTurnInPageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Image'] = $this->normalizer->normalize($data->getImage(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\LRCODTurnInPageImage::class, 'json', $context)); - unset($data['Image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryResponseFormNormalizer.php b/src/Api/Normalizer/LabelRecoveryResponseFormNormalizer.php index 7bdd349b..a4644bd1 100644 --- a/src/Api/Normalizer/LabelRecoveryResponseFormNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryResponseFormNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryResponseFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryResponseFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class, 'json', $context)); - unset($data['Image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Image', $data)) { + $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class, 'json', $context)); + unset($data['Image']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LabelRecoveryResponseFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Image'] = $this->normalizer->normalize($data->getImage(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\LabelRecoveryFormImage::class, 'json', $context)); - unset($data['Image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryResponseHighValueReportNormalizer.php b/src/Api/Normalizer/LabelRecoveryResponseHighValueReportNormalizer.php index 71937104..11dff31d 100644 --- a/src/Api/Normalizer/LabelRecoveryResponseHighValueReportNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryResponseHighValueReportNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryResponseHighValueReportNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryResponseHighValueReportNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\HighValueReportImage::class, 'json', $context)); - unset($data['Image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Image', $data)) { + $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\HighValueReportImage::class, 'json', $context)); + unset($data['Image']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LabelRecoveryResponseHighValueReportNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Image'] = $this->normalizer->normalize($data->getImage(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\HighValueReportImage::class, 'json', $context)); - unset($data['Image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryResponseLabelResultsNormalizer.php b/src/Api/Normalizer/LabelRecoveryResponseLabelResultsNormalizer.php index 354856d6..60521c62 100644 --- a/src/Api/Normalizer/LabelRecoveryResponseLabelResultsNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryResponseLabelResultsNormalizer.php @@ -5,200 +5,99 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryResponseLabelResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryResponseLabelResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('LabelImage', $data)) { - $object->setLabelImage($this->denormalizer->denormalize($data['LabelImage'], \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class, 'json', $context)); - unset($data['LabelImage']); - } - if (\array_key_exists('MailInnovationsTrackingNumber', $data)) { - $object->setMailInnovationsTrackingNumber($data['MailInnovationsTrackingNumber']); - unset($data['MailInnovationsTrackingNumber']); - } - if (\array_key_exists('MailInnovationsLabelImage', $data)) { - $object->setMailInnovationsLabelImage($this->denormalizer->denormalize($data['MailInnovationsLabelImage'], \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class, 'json', $context)); - unset($data['MailInnovationsLabelImage']); - } - if (\array_key_exists('Receipt', $data)) { - $object->setReceipt($this->denormalizer->denormalize($data['Receipt'], \ShipStream\Ups\Api\Model\LabelResultsReceipt::class, 'json', $context)); - unset($data['Receipt']); - } - if (\array_key_exists('Form', $data)) { - $object->setForm($this->denormalizer->denormalize($data['Form'], \ShipStream\Ups\Api\Model\LabelResultsForm::class, 'json', $context)); - unset($data['Form']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $data['TrackingNumber'] = $object->getTrackingNumber(); - } - if ($object->isInitialized('labelImage') && null !== $object->getLabelImage()) { - $data['LabelImage'] = $this->normalizer->normalize($object->getLabelImage(), 'json', $context); - } - if ($object->isInitialized('mailInnovationsTrackingNumber') && null !== $object->getMailInnovationsTrackingNumber()) { - $data['MailInnovationsTrackingNumber'] = $object->getMailInnovationsTrackingNumber(); - } - if ($object->isInitialized('mailInnovationsLabelImage') && null !== $object->getMailInnovationsLabelImage()) { - $data['MailInnovationsLabelImage'] = $this->normalizer->normalize($object->getMailInnovationsLabelImage(), 'json', $context); - } - if ($object->isInitialized('receipt') && null !== $object->getReceipt()) { - $data['Receipt'] = $this->normalizer->normalize($object->getReceipt(), 'json', $context); - } - if ($object->isInitialized('form') && null !== $object->getForm()) { - $data['Form'] = $this->normalizer->normalize($object->getForm(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('TrackingNumber', $data)) { + $object->setTrackingNumber($data['TrackingNumber']); + unset($data['TrackingNumber']); + } + if (\array_key_exists('LabelImage', $data)) { + $object->setLabelImage($this->denormalizer->denormalize($data['LabelImage'], \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class, 'json', $context)); + unset($data['LabelImage']); + } + if (\array_key_exists('MailInnovationsTrackingNumber', $data)) { + $object->setMailInnovationsTrackingNumber($data['MailInnovationsTrackingNumber']); + unset($data['MailInnovationsTrackingNumber']); + } + if (\array_key_exists('MailInnovationsLabelImage', $data)) { + $object->setMailInnovationsLabelImage($this->denormalizer->denormalize($data['MailInnovationsLabelImage'], \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class, 'json', $context)); + unset($data['MailInnovationsLabelImage']); + } + if (\array_key_exists('Receipt', $data)) { + $object->setReceipt($this->denormalizer->denormalize($data['Receipt'], \ShipStream\Ups\Api\Model\LabelResultsReceipt::class, 'json', $context)); + unset($data['Receipt']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class => false]; + if (\array_key_exists('Form', $data)) { + $object->setForm($this->denormalizer->denormalize($data['Form'], \ShipStream\Ups\Api\Model\LabelResultsForm::class, 'json', $context)); + unset($data['Form']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LabelRecoveryResponseLabelResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('LabelImage', $data)) { - $object->setLabelImage($this->denormalizer->denormalize($data['LabelImage'], \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class, 'json', $context)); - unset($data['LabelImage']); - } - if (\array_key_exists('MailInnovationsTrackingNumber', $data)) { - $object->setMailInnovationsTrackingNumber($data['MailInnovationsTrackingNumber']); - unset($data['MailInnovationsTrackingNumber']); - } - if (\array_key_exists('MailInnovationsLabelImage', $data)) { - $object->setMailInnovationsLabelImage($this->denormalizer->denormalize($data['MailInnovationsLabelImage'], \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class, 'json', $context)); - unset($data['MailInnovationsLabelImage']); - } - if (\array_key_exists('Receipt', $data)) { - $object->setReceipt($this->denormalizer->denormalize($data['Receipt'], \ShipStream\Ups\Api\Model\LabelResultsReceipt::class, 'json', $context)); - unset($data['Receipt']); - } - if (\array_key_exists('Form', $data)) { - $object->setForm($this->denormalizer->denormalize($data['Form'], \ShipStream\Ups\Api\Model\LabelResultsForm::class, 'json', $context)); - unset($data['Form']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('trackingNumber') && null !== $data->getTrackingNumber()) { + $dataArray['TrackingNumber'] = $data->getTrackingNumber(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $data['TrackingNumber'] = $object->getTrackingNumber(); - } - if ($object->isInitialized('labelImage') && null !== $object->getLabelImage()) { - $data['LabelImage'] = $this->normalizer->normalize($object->getLabelImage(), 'json', $context); - } - if ($object->isInitialized('mailInnovationsTrackingNumber') && null !== $object->getMailInnovationsTrackingNumber()) { - $data['MailInnovationsTrackingNumber'] = $object->getMailInnovationsTrackingNumber(); - } - if ($object->isInitialized('mailInnovationsLabelImage') && null !== $object->getMailInnovationsLabelImage()) { - $data['MailInnovationsLabelImage'] = $this->normalizer->normalize($object->getMailInnovationsLabelImage(), 'json', $context); - } - if ($object->isInitialized('receipt') && null !== $object->getReceipt()) { - $data['Receipt'] = $this->normalizer->normalize($object->getReceipt(), 'json', $context); - } - if ($object->isInitialized('form') && null !== $object->getForm()) { - $data['Form'] = $this->normalizer->normalize($object->getForm(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('labelImage') && null !== $data->getLabelImage()) { + $dataArray['LabelImage'] = $this->normalizer->normalize($data->getLabelImage(), 'json', $context); + } + if ($data->isInitialized('mailInnovationsTrackingNumber') && null !== $data->getMailInnovationsTrackingNumber()) { + $dataArray['MailInnovationsTrackingNumber'] = $data->getMailInnovationsTrackingNumber(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class => false]; + if ($data->isInitialized('mailInnovationsLabelImage') && null !== $data->getMailInnovationsLabelImage()) { + $dataArray['MailInnovationsLabelImage'] = $this->normalizer->normalize($data->getMailInnovationsLabelImage(), 'json', $context); } + if ($data->isInitialized('receipt') && null !== $data->getReceipt()) { + $dataArray['Receipt'] = $this->normalizer->normalize($data->getReceipt(), 'json', $context); + } + if ($data->isInitialized('form') && null !== $data->getForm()) { + $dataArray['Form'] = $this->normalizer->normalize($data->getForm(), 'json', $context); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryResponseNormalizer.php b/src/Api/Normalizer/LabelRecoveryResponseNormalizer.php index bde4812e..88db939a 100644 --- a/src/Api/Normalizer/LabelRecoveryResponseNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryResponseNormalizer.php @@ -5,238 +5,118 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('ShipmentIdentificationNumber', $data)) { - $object->setShipmentIdentificationNumber($data['ShipmentIdentificationNumber']); - unset($data['ShipmentIdentificationNumber']); - } - if (\array_key_exists('LabelResults', $data)) { - $values = []; - foreach ($data['LabelResults'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class, 'json', $context); - } - $object->setLabelResults($values); - unset($data['LabelResults']); - } - if (\array_key_exists('CODTurnInPage', $data)) { - $object->setCODTurnInPage($this->denormalizer->denormalize($data['CODTurnInPage'], \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class, 'json', $context)); - unset($data['CODTurnInPage']); - } - if (\array_key_exists('Form', $data)) { - $object->setForm($this->denormalizer->denormalize($data['Form'], \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class, 'json', $context)); - unset($data['Form']); - } - if (\array_key_exists('HighValueReport', $data)) { - $object->setHighValueReport($this->denormalizer->denormalize($data['HighValueReport'], \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class, 'json', $context)); - unset($data['HighValueReport']); - } - if (\array_key_exists('TrackingCandidate', $data)) { - $values_1 = []; - foreach ($data['TrackingCandidate'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class, 'json', $context); - } - $object->setTrackingCandidate($values_1); - unset($data['TrackingCandidate']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('shipmentIdentificationNumber') && null !== $object->getShipmentIdentificationNumber()) { - $data['ShipmentIdentificationNumber'] = $object->getShipmentIdentificationNumber(); - } + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class, 'json', $context)); + unset($data['Response']); + } + if (\array_key_exists('ShipmentIdentificationNumber', $data)) { + $object->setShipmentIdentificationNumber($data['ShipmentIdentificationNumber']); + unset($data['ShipmentIdentificationNumber']); + } + if (\array_key_exists('LabelResults', $data)) { $values = []; - foreach ($object->getLabelResults() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['LabelResults'] = $values; - if ($object->isInitialized('cODTurnInPage') && null !== $object->getCODTurnInPage()) { - $data['CODTurnInPage'] = $this->normalizer->normalize($object->getCODTurnInPage(), 'json', $context); + foreach ($data['LabelResults'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class, 'json', $context); } - if ($object->isInitialized('form') && null !== $object->getForm()) { - $data['Form'] = $this->normalizer->normalize($object->getForm(), 'json', $context); - } - if ($object->isInitialized('highValueReport') && null !== $object->getHighValueReport()) { - $data['HighValueReport'] = $this->normalizer->normalize($object->getHighValueReport(), 'json', $context); - } - if ($object->isInitialized('trackingCandidate') && null !== $object->getTrackingCandidate()) { - $values_1 = []; - foreach ($object->getTrackingCandidate() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['TrackingCandidate'] = $values_1; - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setLabelResults($values); + unset($data['LabelResults']); + } + if (\array_key_exists('CODTurnInPage', $data)) { + $object->setCODTurnInPage($this->denormalizer->denormalize($data['CODTurnInPage'], \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class, 'json', $context)); + unset($data['CODTurnInPage']); + } + if (\array_key_exists('Form', $data)) { + $object->setForm($this->denormalizer->denormalize($data['Form'], \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class, 'json', $context)); + unset($data['Form']); + } + if (\array_key_exists('HighValueReport', $data)) { + $object->setHighValueReport($this->denormalizer->denormalize($data['HighValueReport'], \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class, 'json', $context)); + unset($data['HighValueReport']); + } + if (\array_key_exists('TrackingCandidate', $data)) { + $values_1 = []; + foreach ($data['TrackingCandidate'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class, 'json', $context); } - return $data; + $object->setTrackingCandidate($values_1); + unset($data['TrackingCandidate']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponse::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } } + return $object; } -} else { - class LabelRecoveryResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('ShipmentIdentificationNumber', $data)) { - $object->setShipmentIdentificationNumber($data['ShipmentIdentificationNumber']); - unset($data['ShipmentIdentificationNumber']); - } - if (\array_key_exists('LabelResults', $data)) { - $values = []; - foreach ($data['LabelResults'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\LabelRecoveryResponseLabelResults::class, 'json', $context); - } - $object->setLabelResults($values); - unset($data['LabelResults']); - } - if (\array_key_exists('CODTurnInPage', $data)) { - $object->setCODTurnInPage($this->denormalizer->denormalize($data['CODTurnInPage'], \ShipStream\Ups\Api\Model\LabelRecoveryResponseCODTurnInPage::class, 'json', $context)); - unset($data['CODTurnInPage']); - } - if (\array_key_exists('Form', $data)) { - $object->setForm($this->denormalizer->denormalize($data['Form'], \ShipStream\Ups\Api\Model\LabelRecoveryResponseForm::class, 'json', $context)); - unset($data['Form']); - } - if (\array_key_exists('HighValueReport', $data)) { - $object->setHighValueReport($this->denormalizer->denormalize($data['HighValueReport'], \ShipStream\Ups\Api\Model\LabelRecoveryResponseHighValueReport::class, 'json', $context)); - unset($data['HighValueReport']); - } - if (\array_key_exists('TrackingCandidate', $data)) { - $values_1 = []; - foreach ($data['TrackingCandidate'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class, 'json', $context); - } - $object->setTrackingCandidate($values_1); - unset($data['TrackingCandidate']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + if ($data->isInitialized('shipmentIdentificationNumber') && null !== $data->getShipmentIdentificationNumber()) { + $dataArray['ShipmentIdentificationNumber'] = $data->getShipmentIdentificationNumber(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('shipmentIdentificationNumber') && null !== $object->getShipmentIdentificationNumber()) { - $data['ShipmentIdentificationNumber'] = $object->getShipmentIdentificationNumber(); - } - $values = []; - foreach ($object->getLabelResults() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['LabelResults'] = $values; - if ($object->isInitialized('cODTurnInPage') && null !== $object->getCODTurnInPage()) { - $data['CODTurnInPage'] = $this->normalizer->normalize($object->getCODTurnInPage(), 'json', $context); - } - if ($object->isInitialized('form') && null !== $object->getForm()) { - $data['Form'] = $this->normalizer->normalize($object->getForm(), 'json', $context); - } - if ($object->isInitialized('highValueReport') && null !== $object->getHighValueReport()) { - $data['HighValueReport'] = $this->normalizer->normalize($object->getHighValueReport(), 'json', $context); - } - if ($object->isInitialized('trackingCandidate') && null !== $object->getTrackingCandidate()) { - $values_1 = []; - foreach ($object->getTrackingCandidate() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['TrackingCandidate'] = $values_1; - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $values = []; + foreach ($data->getLabelResults() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['LabelResults'] = $values; + if ($data->isInitialized('cODTurnInPage') && null !== $data->getCODTurnInPage()) { + $dataArray['CODTurnInPage'] = $this->normalizer->normalize($data->getCODTurnInPage(), 'json', $context); + } + if ($data->isInitialized('form') && null !== $data->getForm()) { + $dataArray['Form'] = $this->normalizer->normalize($data->getForm(), 'json', $context); + } + if ($data->isInitialized('highValueReport') && null !== $data->getHighValueReport()) { + $dataArray['HighValueReport'] = $this->normalizer->normalize($data->getHighValueReport(), 'json', $context); + } + if ($data->isInitialized('trackingCandidate') && null !== $data->getTrackingCandidate()) { + $values_1 = []; + foreach ($data->getTrackingCandidate() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['TrackingCandidate'] = $values_1; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponse::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryResponseResponseNormalizer.php b/src/Api/Normalizer/LabelRecoveryResponseResponseNormalizer.php index 680dc4ae..93400fb6 100644 --- a/src/Api/Normalizer/LabelRecoveryResponseResponseNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryResponseResponseNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class => false]; + if (\array_key_exists('Alert', $data)) { + $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); + unset($data['Alert']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LabelRecoveryResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $dataArray['Alert'] = $this->normalizer->normalize($data->getAlert(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\LRResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\LRResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelRecoveryResponseTrackingCandidateNormalizer.php b/src/Api/Normalizer/LabelRecoveryResponseTrackingCandidateNormalizer.php index df6397ef..ae6c0f4f 100644 --- a/src/Api/Normalizer/LabelRecoveryResponseTrackingCandidateNormalizer.php +++ b/src/Api/Normalizer/LabelRecoveryResponseTrackingCandidateNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryResponseTrackingCandidateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelRecoveryResponseTrackingCandidateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class; + return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('DestinationPostalCode', $data)) { - $object->setDestinationPostalCode($data['DestinationPostalCode']); - unset($data['DestinationPostalCode']); - } - if (\array_key_exists('DestinationCountryCode', $data)) { - $object->setDestinationCountryCode($data['DestinationCountryCode']); - unset($data['DestinationCountryCode']); - } - if (\array_key_exists('PickupDateRange', $data)) { - $object->setPickupDateRange($this->denormalizer->denormalize($data['PickupDateRange'], \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class, 'json', $context)); - unset($data['PickupDateRange']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['TrackingNumber'] = $object->getTrackingNumber(); - if ($object->isInitialized('destinationPostalCode') && null !== $object->getDestinationPostalCode()) { - $data['DestinationPostalCode'] = $object->getDestinationPostalCode(); - } - if ($object->isInitialized('destinationCountryCode') && null !== $object->getDestinationCountryCode()) { - $data['DestinationCountryCode'] = $object->getDestinationCountryCode(); - } - if ($object->isInitialized('pickupDateRange') && null !== $object->getPickupDateRange()) { - $data['PickupDateRange'] = $this->normalizer->normalize($object->getPickupDateRange(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('TrackingNumber', $data)) { + $object->setTrackingNumber($data['TrackingNumber']); + unset($data['TrackingNumber']); + } + if (\array_key_exists('DestinationPostalCode', $data)) { + $object->setDestinationPostalCode($data['DestinationPostalCode']); + unset($data['DestinationPostalCode']); + } + if (\array_key_exists('DestinationCountryCode', $data)) { + $object->setDestinationCountryCode($data['DestinationCountryCode']); + unset($data['DestinationCountryCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class => false]; + if (\array_key_exists('PickupDateRange', $data)) { + $object->setPickupDateRange($this->denormalizer->denormalize($data['PickupDateRange'], \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class, 'json', $context)); + unset($data['PickupDateRange']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LabelRecoveryResponseTrackingCandidateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class; + $dataArray = []; + $dataArray['TrackingNumber'] = $data->getTrackingNumber(); + if ($data->isInitialized('destinationPostalCode') && null !== $data->getDestinationPostalCode()) { + $dataArray['DestinationPostalCode'] = $data->getDestinationPostalCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class; + if ($data->isInitialized('destinationCountryCode') && null !== $data->getDestinationCountryCode()) { + $dataArray['DestinationCountryCode'] = $data->getDestinationCountryCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('DestinationPostalCode', $data)) { - $object->setDestinationPostalCode($data['DestinationPostalCode']); - unset($data['DestinationPostalCode']); - } - if (\array_key_exists('DestinationCountryCode', $data)) { - $object->setDestinationCountryCode($data['DestinationCountryCode']); - unset($data['DestinationCountryCode']); - } - if (\array_key_exists('PickupDateRange', $data)) { - $object->setPickupDateRange($this->denormalizer->denormalize($data['PickupDateRange'], \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class, 'json', $context)); - unset($data['PickupDateRange']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('pickupDateRange') && null !== $data->getPickupDateRange()) { + $dataArray['PickupDateRange'] = $this->normalizer->normalize($data->getPickupDateRange(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['TrackingNumber'] = $object->getTrackingNumber(); - if ($object->isInitialized('destinationPostalCode') && null !== $object->getDestinationPostalCode()) { - $data['DestinationPostalCode'] = $object->getDestinationPostalCode(); - } - if ($object->isInitialized('destinationCountryCode') && null !== $object->getDestinationCountryCode()) { - $data['DestinationCountryCode'] = $object->getDestinationCountryCode(); - } - if ($object->isInitialized('pickupDateRange') && null !== $object->getPickupDateRange()) { - $data['PickupDateRange'] = $this->normalizer->normalize($object->getPickupDateRange(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelRecoveryResponseTrackingCandidate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelResultsFormNormalizer.php b/src/Api/Normalizer/LabelResultsFormNormalizer.php index da2a0db3..322eafe3 100644 --- a/src/Api/Normalizer/LabelResultsFormNormalizer.php +++ b/src/Api/Normalizer/LabelResultsFormNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelResultsFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelResultsFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelResultsForm::class; + return $type === \ShipStream\Ups\Api\Model\LabelResultsForm::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelResultsForm::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelResultsForm::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelResultsForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\LRFormImage::class, 'json', $context)); - unset($data['Image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelResultsForm(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Image', $data)) { + $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\LRFormImage::class, 'json', $context)); + unset($data['Image']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelResultsForm::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LabelResultsFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelResultsForm::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelResultsForm::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelResultsForm(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Image'] = $this->normalizer->normalize($data->getImage(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\LRFormImage::class, 'json', $context)); - unset($data['Image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelResultsForm::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelResultsForm::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelResultsLabelImageNormalizer.php b/src/Api/Normalizer/LabelResultsLabelImageNormalizer.php index a97527a4..7b077c71 100644 --- a/src/Api/Normalizer/LabelResultsLabelImageNormalizer.php +++ b/src/Api/Normalizer/LabelResultsLabelImageNormalizer.php @@ -5,192 +5,95 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelResultsLabelImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelResultsLabelImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class; + return $type === \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelResultsLabelImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LabelImageFormat', $data)) { - $object->setLabelImageFormat($this->denormalizer->denormalize($data['LabelImageFormat'], \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class, 'json', $context)); - unset($data['LabelImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - if (\array_key_exists('HTMLImage', $data)) { - $object->setHTMLImage($data['HTMLImage']); - unset($data['HTMLImage']); - } - if (\array_key_exists('PDF417', $data)) { - $object->setPDF417($data['PDF417']); - unset($data['PDF417']); - } - if (\array_key_exists('InternationalSignatureGraphicImage', $data)) { - $object->setInternationalSignatureGraphicImage($data['InternationalSignatureGraphicImage']); - unset($data['InternationalSignatureGraphicImage']); - } - if (\array_key_exists('URL', $data)) { - $object->setURL($data['URL']); - unset($data['URL']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelResultsLabelImage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['LabelImageFormat'] = $this->normalizer->normalize($object->getLabelImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - if ($object->isInitialized('hTMLImage') && null !== $object->getHTMLImage()) { - $data['HTMLImage'] = $object->getHTMLImage(); - } - if ($object->isInitialized('pDF417') && null !== $object->getPDF417()) { - $data['PDF417'] = $object->getPDF417(); - } - if ($object->isInitialized('internationalSignatureGraphicImage') && null !== $object->getInternationalSignatureGraphicImage()) { - $data['InternationalSignatureGraphicImage'] = $object->getInternationalSignatureGraphicImage(); - } - if ($object->isInitialized('uRL') && null !== $object->getURL()) { - $data['URL'] = $object->getURL(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('LabelImageFormat', $data)) { + $object->setLabelImageFormat($this->denormalizer->denormalize($data['LabelImageFormat'], \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class, 'json', $context)); + unset($data['LabelImageFormat']); + } + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); + } + if (\array_key_exists('HTMLImage', $data)) { + $object->setHTMLImage($data['HTMLImage']); + unset($data['HTMLImage']); + } + if (\array_key_exists('PDF417', $data)) { + $object->setPDF417($data['PDF417']); + unset($data['PDF417']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelResultsLabelImage::class => false]; + if (\array_key_exists('InternationalSignatureGraphicImage', $data)) { + $object->setInternationalSignatureGraphicImage($data['InternationalSignatureGraphicImage']); + unset($data['InternationalSignatureGraphicImage']); } + if (\array_key_exists('URL', $data)) { + $object->setURL($data['URL']); + unset($data['URL']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LabelResultsLabelImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class; + $dataArray = []; + $dataArray['LabelImageFormat'] = $this->normalizer->normalize($data->getLabelImageFormat(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + if ($data->isInitialized('hTMLImage') && null !== $data->getHTMLImage()) { + $dataArray['HTMLImage'] = $data->getHTMLImage(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelResultsLabelImage::class; + if ($data->isInitialized('pDF417') && null !== $data->getPDF417()) { + $dataArray['PDF417'] = $data->getPDF417(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelResultsLabelImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LabelImageFormat', $data)) { - $object->setLabelImageFormat($this->denormalizer->denormalize($data['LabelImageFormat'], \ShipStream\Ups\Api\Model\LabelImageLabelImageFormat::class, 'json', $context)); - unset($data['LabelImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - if (\array_key_exists('HTMLImage', $data)) { - $object->setHTMLImage($data['HTMLImage']); - unset($data['HTMLImage']); - } - if (\array_key_exists('PDF417', $data)) { - $object->setPDF417($data['PDF417']); - unset($data['PDF417']); - } - if (\array_key_exists('InternationalSignatureGraphicImage', $data)) { - $object->setInternationalSignatureGraphicImage($data['InternationalSignatureGraphicImage']); - unset($data['InternationalSignatureGraphicImage']); - } - if (\array_key_exists('URL', $data)) { - $object->setURL($data['URL']); - unset($data['URL']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('internationalSignatureGraphicImage') && null !== $data->getInternationalSignatureGraphicImage()) { + $dataArray['InternationalSignatureGraphicImage'] = $data->getInternationalSignatureGraphicImage(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['LabelImageFormat'] = $this->normalizer->normalize($object->getLabelImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - if ($object->isInitialized('hTMLImage') && null !== $object->getHTMLImage()) { - $data['HTMLImage'] = $object->getHTMLImage(); - } - if ($object->isInitialized('pDF417') && null !== $object->getPDF417()) { - $data['PDF417'] = $object->getPDF417(); - } - if ($object->isInitialized('internationalSignatureGraphicImage') && null !== $object->getInternationalSignatureGraphicImage()) { - $data['InternationalSignatureGraphicImage'] = $object->getInternationalSignatureGraphicImage(); - } - if ($object->isInitialized('uRL') && null !== $object->getURL()) { - $data['URL'] = $object->getURL(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('uRL') && null !== $data->getURL()) { + $dataArray['URL'] = $data->getURL(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelResultsLabelImage::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelResultsLabelImage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelResultsMailInnovationsLabelImageNormalizer.php b/src/Api/Normalizer/LabelResultsMailInnovationsLabelImageNormalizer.php index 274729e8..79423a45 100644 --- a/src/Api/Normalizer/LabelResultsMailInnovationsLabelImageNormalizer.php +++ b/src/Api/Normalizer/LabelResultsMailInnovationsLabelImageNormalizer.php @@ -5,192 +5,95 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelResultsMailInnovationsLabelImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelResultsMailInnovationsLabelImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class; + return $type === \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LabelImageFormat', $data)) { - $object->setLabelImageFormat($this->denormalizer->denormalize($data['LabelImageFormat'], \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class, 'json', $context)); - unset($data['LabelImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - if (\array_key_exists('HTMLImage', $data)) { - $object->setHTMLImage($data['HTMLImage']); - unset($data['HTMLImage']); - } - if (\array_key_exists('PDF417', $data)) { - $object->setPDF417($data['PDF417']); - unset($data['PDF417']); - } - if (\array_key_exists('InternationalSignatureGraphicImage', $data)) { - $object->setInternationalSignatureGraphicImage($data['InternationalSignatureGraphicImage']); - unset($data['InternationalSignatureGraphicImage']); - } - if (\array_key_exists('URL', $data)) { - $object->setURL($data['URL']); - unset($data['URL']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['LabelImageFormat'] = $this->normalizer->normalize($object->getLabelImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - if ($object->isInitialized('hTMLImage') && null !== $object->getHTMLImage()) { - $data['HTMLImage'] = $object->getHTMLImage(); - } - if ($object->isInitialized('pDF417') && null !== $object->getPDF417()) { - $data['PDF417'] = $object->getPDF417(); - } - if ($object->isInitialized('internationalSignatureGraphicImage') && null !== $object->getInternationalSignatureGraphicImage()) { - $data['InternationalSignatureGraphicImage'] = $object->getInternationalSignatureGraphicImage(); - } - if ($object->isInitialized('uRL') && null !== $object->getURL()) { - $data['URL'] = $object->getURL(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('LabelImageFormat', $data)) { + $object->setLabelImageFormat($this->denormalizer->denormalize($data['LabelImageFormat'], \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class, 'json', $context)); + unset($data['LabelImageFormat']); + } + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); + } + if (\array_key_exists('HTMLImage', $data)) { + $object->setHTMLImage($data['HTMLImage']); + unset($data['HTMLImage']); + } + if (\array_key_exists('PDF417', $data)) { + $object->setPDF417($data['PDF417']); + unset($data['PDF417']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class => false]; + if (\array_key_exists('InternationalSignatureGraphicImage', $data)) { + $object->setInternationalSignatureGraphicImage($data['InternationalSignatureGraphicImage']); + unset($data['InternationalSignatureGraphicImage']); } + if (\array_key_exists('URL', $data)) { + $object->setURL($data['URL']); + unset($data['URL']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LabelResultsMailInnovationsLabelImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class; + $dataArray = []; + $dataArray['LabelImageFormat'] = $this->normalizer->normalize($data->getLabelImageFormat(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + if ($data->isInitialized('hTMLImage') && null !== $data->getHTMLImage()) { + $dataArray['HTMLImage'] = $data->getHTMLImage(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class; + if ($data->isInitialized('pDF417') && null !== $data->getPDF417()) { + $dataArray['PDF417'] = $data->getPDF417(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LabelImageFormat', $data)) { - $object->setLabelImageFormat($this->denormalizer->denormalize($data['LabelImageFormat'], \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class, 'json', $context)); - unset($data['LabelImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - if (\array_key_exists('HTMLImage', $data)) { - $object->setHTMLImage($data['HTMLImage']); - unset($data['HTMLImage']); - } - if (\array_key_exists('PDF417', $data)) { - $object->setPDF417($data['PDF417']); - unset($data['PDF417']); - } - if (\array_key_exists('InternationalSignatureGraphicImage', $data)) { - $object->setInternationalSignatureGraphicImage($data['InternationalSignatureGraphicImage']); - unset($data['InternationalSignatureGraphicImage']); - } - if (\array_key_exists('URL', $data)) { - $object->setURL($data['URL']); - unset($data['URL']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('internationalSignatureGraphicImage') && null !== $data->getInternationalSignatureGraphicImage()) { + $dataArray['InternationalSignatureGraphicImage'] = $data->getInternationalSignatureGraphicImage(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['LabelImageFormat'] = $this->normalizer->normalize($object->getLabelImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - if ($object->isInitialized('hTMLImage') && null !== $object->getHTMLImage()) { - $data['HTMLImage'] = $object->getHTMLImage(); - } - if ($object->isInitialized('pDF417') && null !== $object->getPDF417()) { - $data['PDF417'] = $object->getPDF417(); - } - if ($object->isInitialized('internationalSignatureGraphicImage') && null !== $object->getInternationalSignatureGraphicImage()) { - $data['InternationalSignatureGraphicImage'] = $object->getInternationalSignatureGraphicImage(); - } - if ($object->isInitialized('uRL') && null !== $object->getURL()) { - $data['URL'] = $object->getURL(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('uRL') && null !== $data->getURL()) { + $dataArray['URL'] = $data->getURL(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelResultsMailInnovationsLabelImage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelResultsReceiptNormalizer.php b/src/Api/Normalizer/LabelResultsReceiptNormalizer.php index 9e072eb5..4ca98992 100644 --- a/src/Api/Normalizer/LabelResultsReceiptNormalizer.php +++ b/src/Api/Normalizer/LabelResultsReceiptNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelResultsReceiptNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelResultsReceiptNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelResultsReceipt::class; + return $type === \ShipStream\Ups\Api\Model\LabelResultsReceipt::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelResultsReceipt::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelResultsReceipt::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelResultsReceipt(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HTMLImage', $data)) { - $object->setHTMLImage($data['HTMLImage']); - unset($data['HTMLImage']); - } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\ReceiptImage::class, 'json', $context)); - unset($data['Image']); - } - if (\array_key_exists('URL', $data)) { - $object->setURL($data['URL']); - unset($data['URL']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelResultsReceipt(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('hTMLImage') && null !== $object->getHTMLImage()) { - $data['HTMLImage'] = $object->getHTMLImage(); - } - if ($object->isInitialized('image') && null !== $object->getImage()) { - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - } - if ($object->isInitialized('uRL') && null !== $object->getURL()) { - $data['URL'] = $object->getURL(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('HTMLImage', $data)) { + $object->setHTMLImage($data['HTMLImage']); + unset($data['HTMLImage']); + } + if (\array_key_exists('Image', $data)) { + $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\ReceiptImage::class, 'json', $context)); + unset($data['Image']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelResultsReceipt::class => false]; + if (\array_key_exists('URL', $data)) { + $object->setURL($data['URL']); + unset($data['URL']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LabelResultsReceiptNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelResultsReceipt::class; + $dataArray = []; + if ($data->isInitialized('hTMLImage') && null !== $data->getHTMLImage()) { + $dataArray['HTMLImage'] = $data->getHTMLImage(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelResultsReceipt::class; + if ($data->isInitialized('image') && null !== $data->getImage()) { + $dataArray['Image'] = $this->normalizer->normalize($data->getImage(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelResultsReceipt(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HTMLImage', $data)) { - $object->setHTMLImage($data['HTMLImage']); - unset($data['HTMLImage']); - } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\ReceiptImage::class, 'json', $context)); - unset($data['Image']); - } - if (\array_key_exists('URL', $data)) { - $object->setURL($data['URL']); - unset($data['URL']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('uRL') && null !== $data->getURL()) { + $dataArray['URL'] = $data->getURL(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('hTMLImage') && null !== $object->getHTMLImage()) { - $data['HTMLImage'] = $object->getHTMLImage(); - } - if ($object->isInitialized('image') && null !== $object->getImage()) { - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - } - if ($object->isInitialized('uRL') && null !== $object->getURL()) { - $data['URL'] = $object->getURL(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelResultsReceipt::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelResultsReceipt::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelSpecificationInstructionNormalizer.php b/src/Api/Normalizer/LabelSpecificationInstructionNormalizer.php index 5c8a4804..589bfd7a 100644 --- a/src/Api/Normalizer/LabelSpecificationInstructionNormalizer.php +++ b/src/Api/Normalizer/LabelSpecificationInstructionNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelSpecificationInstructionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelSpecificationInstructionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class; + return $type === \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelSpecificationInstruction(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelSpecificationInstruction(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LabelSpecificationInstructionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelSpecificationInstruction(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelSpecificationLabelImageFormatNormalizer.php b/src/Api/Normalizer/LabelSpecificationLabelImageFormatNormalizer.php index acaef436..7bbcee99 100644 --- a/src/Api/Normalizer/LabelSpecificationLabelImageFormatNormalizer.php +++ b/src/Api/Normalizer/LabelSpecificationLabelImageFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelSpecificationLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelSpecificationLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LabelSpecificationLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LabelSpecificationLabelStockSizeNormalizer.php b/src/Api/Normalizer/LabelSpecificationLabelStockSizeNormalizer.php index d96ae4c2..6e5b9d4a 100644 --- a/src/Api/Normalizer/LabelSpecificationLabelStockSizeNormalizer.php +++ b/src/Api/Normalizer/LabelSpecificationLabelStockSizeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelSpecificationLabelStockSizeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LabelSpecificationLabelStockSizeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class; + return $type === \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Height'] = $object->getHeight(); - $data['Width'] = $object->getWidth(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class => false]; - } - } -} else { - class LabelSpecificationLabelStockSizeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class; + if (\array_key_exists('Height', $data)) { + $object->setHeight($data['Height']); + unset($data['Height']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class; + if (\array_key_exists('Width', $data)) { + $object->setWidth($data['Width']); + unset($data['Width']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Height'] = $object->getHeight(); - $data['Width'] = $object->getWidth(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Height'] = $data->getHeight(); + $dataArray['Width'] = $data->getWidth(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LandedCostRequestNormalizer.php b/src/Api/Normalizer/LandedCostRequestNormalizer.php index 52f18640..9504a0cf 100644 --- a/src/Api/Normalizer/LandedCostRequestNormalizer.php +++ b/src/Api/Normalizer/LandedCostRequestNormalizer.php @@ -5,170 +5,87 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LandedCostRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LandedCostRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LandedCostRequest::class; + return $type === \ShipStream\Ups\Api\Model\LandedCostRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LandedCostRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('currencyCode', $data)) { - $object->setCurrencyCode($data['currencyCode']); - unset($data['currencyCode']); - } - if (\array_key_exists('transID', $data)) { - $object->setTransID($data['transID']); - unset($data['transID']); - } - if (\array_key_exists('allowPartialLandedCostResult', $data)) { - $object->setAllowPartialLandedCostResult($data['allowPartialLandedCostResult']); - unset($data['allowPartialLandedCostResult']); - } - if (\array_key_exists('alversion', $data)) { - $object->setAlversion($data['alversion']); - unset($data['alversion']); - } - if (\array_key_exists('shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['shipment'], \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class, 'json', $context)); - unset($data['shipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LandedCostRequest(); + if (\array_key_exists('allowPartialLandedCostResult', $data) && \is_int($data['allowPartialLandedCostResult'])) { + $data['allowPartialLandedCostResult'] = (bool) $data['allowPartialLandedCostResult']; + } + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['currencyCode'] = $object->getCurrencyCode(); - $data['transID'] = $object->getTransID(); - if ($object->isInitialized('allowPartialLandedCostResult') && null !== $object->getAllowPartialLandedCostResult()) { - $data['allowPartialLandedCostResult'] = $object->getAllowPartialLandedCostResult(); - } - $data['alversion'] = $object->getAlversion(); - $data['shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('currencyCode', $data)) { + $object->setCurrencyCode($data['currencyCode']); + unset($data['currencyCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LandedCostRequest::class => false]; + if (\array_key_exists('transID', $data)) { + $object->setTransID($data['transID']); + unset($data['transID']); } - } -} else { - class LandedCostRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LandedCostRequest::class; + if (\array_key_exists('allowPartialLandedCostResult', $data)) { + $object->setAllowPartialLandedCostResult($data['allowPartialLandedCostResult']); + unset($data['allowPartialLandedCostResult']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostRequest::class; + if (\array_key_exists('alversion', $data)) { + $object->setAlversion($data['alversion']); + unset($data['alversion']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LandedCostRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('currencyCode', $data)) { - $object->setCurrencyCode($data['currencyCode']); - unset($data['currencyCode']); - } - if (\array_key_exists('transID', $data)) { - $object->setTransID($data['transID']); - unset($data['transID']); - } - if (\array_key_exists('allowPartialLandedCostResult', $data)) { - $object->setAllowPartialLandedCostResult($data['allowPartialLandedCostResult']); - unset($data['allowPartialLandedCostResult']); - } - if (\array_key_exists('alversion', $data)) { - $object->setAlversion($data['alversion']); - unset($data['alversion']); - } - if (\array_key_exists('shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['shipment'], \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class, 'json', $context)); - unset($data['shipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('shipment', $data)) { + $object->setShipment($this->denormalizer->denormalize($data['shipment'], \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class, 'json', $context)); + unset($data['shipment']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['currencyCode'] = $object->getCurrencyCode(); - $data['transID'] = $object->getTransID(); - if ($object->isInitialized('allowPartialLandedCostResult') && null !== $object->getAllowPartialLandedCostResult()) { - $data['allowPartialLandedCostResult'] = $object->getAllowPartialLandedCostResult(); - } - $data['alversion'] = $object->getAlversion(); - $data['shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LandedCostRequest::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['currencyCode'] = $data->getCurrencyCode(); + $dataArray['transID'] = $data->getTransID(); + if ($data->isInitialized('allowPartialLandedCostResult') && null !== $data->getAllowPartialLandedCostResult()) { + $dataArray['allowPartialLandedCostResult'] = $data->getAllowPartialLandedCostResult(); + } + $dataArray['alversion'] = $data->getAlversion(); + $dataArray['shipment'] = $this->normalizer->normalize($data->getShipment(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LandedCostRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LandedCostRequestShipmentNormalizer.php b/src/Api/Normalizer/LandedCostRequestShipmentNormalizer.php index d564ebad..04276e18 100644 --- a/src/Api/Normalizer/LandedCostRequestShipmentNormalizer.php +++ b/src/Api/Normalizer/LandedCostRequestShipmentNormalizer.php @@ -5,262 +5,130 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LandedCostRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LandedCostRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class; + return $type === \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LandedCostRequestShipment(); - if (\array_key_exists('transportCost', $data) && \is_int($data['transportCost'])) { - $data['transportCost'] = (double) $data['transportCost']; - } - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('id', $data)) { - $object->setId($data['id']); - unset($data['id']); - } - if (\array_key_exists('importCountryCode', $data)) { - $object->setImportCountryCode($data['importCountryCode']); - unset($data['importCountryCode']); - } - if (\array_key_exists('importProvince', $data)) { - $object->setImportProvince($data['importProvince']); - unset($data['importProvince']); - } - if (\array_key_exists('shipDate', $data)) { - $object->setShipDate($data['shipDate']); - unset($data['shipDate']); - } - if (\array_key_exists('incoterms', $data)) { - $object->setIncoterms($data['incoterms']); - unset($data['incoterms']); - } - if (\array_key_exists('exportCountryCode', $data)) { - $object->setExportCountryCode($data['exportCountryCode']); - unset($data['exportCountryCode']); - } - if (\array_key_exists('transModes', $data)) { - $object->setTransModes($data['transModes']); - unset($data['transModes']); - } - if (\array_key_exists('transportCost', $data)) { - $object->setTransportCost($data['transportCost']); - unset($data['transportCost']); - } - if (\array_key_exists('shipmentType', $data)) { - $object->setShipmentType($data['shipmentType']); - unset($data['shipmentType']); - } - if (\array_key_exists('shipmentItems', $data)) { - $values = []; - foreach ($data['shipmentItems'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RequestShipmentItems::class, 'json', $context); - } - $object->setShipmentItems($values); - unset($data['shipmentItems']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\LandedCostRequestShipment(); + if (\array_key_exists('transportCost', $data) && \is_int($data['transportCost'])) { + $data['transportCost'] = (double) $data['transportCost']; + } + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['id'] = $object->getId(); - $data['importCountryCode'] = $object->getImportCountryCode(); - if ($object->isInitialized('importProvince') && null !== $object->getImportProvince()) { - $data['importProvince'] = $object->getImportProvince(); - } - if ($object->isInitialized('shipDate') && null !== $object->getShipDate()) { - $data['shipDate'] = $object->getShipDate(); - } - if ($object->isInitialized('incoterms') && null !== $object->getIncoterms()) { - $data['incoterms'] = $object->getIncoterms(); - } - $data['exportCountryCode'] = $object->getExportCountryCode(); - if ($object->isInitialized('transModes') && null !== $object->getTransModes()) { - $data['transModes'] = $object->getTransModes(); - } - if ($object->isInitialized('transportCost') && null !== $object->getTransportCost()) { - $data['transportCost'] = $object->getTransportCost(); - } - if ($object->isInitialized('shipmentType') && null !== $object->getShipmentType()) { - $data['shipmentType'] = $object->getShipmentType(); - } + if (\array_key_exists('id', $data)) { + $object->setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('importCountryCode', $data)) { + $object->setImportCountryCode($data['importCountryCode']); + unset($data['importCountryCode']); + } + if (\array_key_exists('importProvince', $data)) { + $object->setImportProvince($data['importProvince']); + unset($data['importProvince']); + } + if (\array_key_exists('shipDate', $data)) { + $object->setShipDate($data['shipDate']); + unset($data['shipDate']); + } + if (\array_key_exists('incoterms', $data)) { + $object->setIncoterms($data['incoterms']); + unset($data['incoterms']); + } + if (\array_key_exists('exportCountryCode', $data)) { + $object->setExportCountryCode($data['exportCountryCode']); + unset($data['exportCountryCode']); + } + if (\array_key_exists('transModes', $data)) { + $object->setTransModes($data['transModes']); + unset($data['transModes']); + } + if (\array_key_exists('transportCost', $data)) { + $object->setTransportCost($data['transportCost']); + unset($data['transportCost']); + } + if (\array_key_exists('shipmentType', $data)) { + $object->setShipmentType($data['shipmentType']); + unset($data['shipmentType']); + } + if (\array_key_exists('shipmentItems', $data)) { $values = []; - foreach ($object->getShipmentItems() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['shipmentItems'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data['shipmentItems'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RequestShipmentItems::class, 'json', $context); } - return $data; + $object->setShipmentItems($values); + unset($data['shipmentItems']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LandedCostRequestShipment::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class LandedCostRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class; + $dataArray = []; + $dataArray['id'] = $data->getId(); + $dataArray['importCountryCode'] = $data->getImportCountryCode(); + if ($data->isInitialized('importProvince') && null !== $data->getImportProvince()) { + $dataArray['importProvince'] = $data->getImportProvince(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostRequestShipment::class; + if ($data->isInitialized('shipDate') && null !== $data->getShipDate()) { + $dataArray['shipDate'] = $data->getShipDate(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LandedCostRequestShipment(); - if (\array_key_exists('transportCost', $data) && \is_int($data['transportCost'])) { - $data['transportCost'] = (double) $data['transportCost']; - } - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('id', $data)) { - $object->setId($data['id']); - unset($data['id']); - } - if (\array_key_exists('importCountryCode', $data)) { - $object->setImportCountryCode($data['importCountryCode']); - unset($data['importCountryCode']); - } - if (\array_key_exists('importProvince', $data)) { - $object->setImportProvince($data['importProvince']); - unset($data['importProvince']); - } - if (\array_key_exists('shipDate', $data)) { - $object->setShipDate($data['shipDate']); - unset($data['shipDate']); - } - if (\array_key_exists('incoterms', $data)) { - $object->setIncoterms($data['incoterms']); - unset($data['incoterms']); - } - if (\array_key_exists('exportCountryCode', $data)) { - $object->setExportCountryCode($data['exportCountryCode']); - unset($data['exportCountryCode']); - } - if (\array_key_exists('transModes', $data)) { - $object->setTransModes($data['transModes']); - unset($data['transModes']); - } - if (\array_key_exists('transportCost', $data)) { - $object->setTransportCost($data['transportCost']); - unset($data['transportCost']); - } - if (\array_key_exists('shipmentType', $data)) { - $object->setShipmentType($data['shipmentType']); - unset($data['shipmentType']); - } - if (\array_key_exists('shipmentItems', $data)) { - $values = []; - foreach ($data['shipmentItems'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RequestShipmentItems::class, 'json', $context); - } - $object->setShipmentItems($values); - unset($data['shipmentItems']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('incoterms') && null !== $data->getIncoterms()) { + $dataArray['incoterms'] = $data->getIncoterms(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['id'] = $object->getId(); - $data['importCountryCode'] = $object->getImportCountryCode(); - if ($object->isInitialized('importProvince') && null !== $object->getImportProvince()) { - $data['importProvince'] = $object->getImportProvince(); - } - if ($object->isInitialized('shipDate') && null !== $object->getShipDate()) { - $data['shipDate'] = $object->getShipDate(); - } - if ($object->isInitialized('incoterms') && null !== $object->getIncoterms()) { - $data['incoterms'] = $object->getIncoterms(); - } - $data['exportCountryCode'] = $object->getExportCountryCode(); - if ($object->isInitialized('transModes') && null !== $object->getTransModes()) { - $data['transModes'] = $object->getTransModes(); - } - if ($object->isInitialized('transportCost') && null !== $object->getTransportCost()) { - $data['transportCost'] = $object->getTransportCost(); - } - if ($object->isInitialized('shipmentType') && null !== $object->getShipmentType()) { - $data['shipmentType'] = $object->getShipmentType(); - } - $values = []; - foreach ($object->getShipmentItems() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['shipmentItems'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $dataArray['exportCountryCode'] = $data->getExportCountryCode(); + if ($data->isInitialized('transModes') && null !== $data->getTransModes()) { + $dataArray['transModes'] = $data->getTransModes(); + } + if ($data->isInitialized('transportCost') && null !== $data->getTransportCost()) { + $dataArray['transportCost'] = $data->getTransportCost(); + } + if ($data->isInitialized('shipmentType') && null !== $data->getShipmentType()) { + $dataArray['shipmentType'] = $data->getShipmentType(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LandedCostRequestShipment::class => false]; + $values = []; + foreach ($data->getShipmentItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } + $dataArray['shipmentItems'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LandedCostRequestShipment::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LandedCostResponseNormalizer.php b/src/Api/Normalizer/LandedCostResponseNormalizer.php index b0a10c70..a35a3402 100644 --- a/src/Api/Normalizer/LandedCostResponseNormalizer.php +++ b/src/Api/Normalizer/LandedCostResponseNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LandedCostResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LandedCostResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LandedCostResponse::class; + return $type === \ShipStream\Ups\Api\Model\LandedCostResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LandedCostResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['shipment'], \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class, 'json', $context)); - unset($data['shipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LandedCostResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('shipment', $data)) { + $object->setShipment($this->denormalizer->denormalize($data['shipment'], \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class, 'json', $context)); + unset($data['shipment']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LandedCostResponse::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LandedCostResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LandedCostResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LandedCostResponse(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['shipment'] = $this->normalizer->normalize($data->getShipment(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['shipment'], \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class, 'json', $context)); - unset($data['shipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LandedCostResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LandedCostResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LandedCostResponseShipmentNormalizer.php b/src/Api/Normalizer/LandedCostResponseShipmentNormalizer.php index 283c60aa..78b1b44e 100644 --- a/src/Api/Normalizer/LandedCostResponseShipmentNormalizer.php +++ b/src/Api/Normalizer/LandedCostResponseShipmentNormalizer.php @@ -5,366 +5,182 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LandedCostResponseShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LandedCostResponseShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LandedCostResponseShipment(); - if (\array_key_exists('totalBrokerageFees', $data) && \is_int($data['totalBrokerageFees'])) { - $data['totalBrokerageFees'] = (double) $data['totalBrokerageFees']; - } - if (\array_key_exists('totalDuties', $data) && \is_int($data['totalDuties'])) { - $data['totalDuties'] = (double) $data['totalDuties']; - } - if (\array_key_exists('totalCommodityLevelTaxesAndFees', $data) && \is_int($data['totalCommodityLevelTaxesAndFees'])) { - $data['totalCommodityLevelTaxesAndFees'] = (double) $data['totalCommodityLevelTaxesAndFees']; - } - if (\array_key_exists('totalShipmentLevelTaxesAndFees', $data) && \is_int($data['totalShipmentLevelTaxesAndFees'])) { - $data['totalShipmentLevelTaxesAndFees'] = (double) $data['totalShipmentLevelTaxesAndFees']; - } - if (\array_key_exists('totalVAT', $data) && \is_int($data['totalVAT'])) { - $data['totalVAT'] = (double) $data['totalVAT']; - } - if (\array_key_exists('totalDutyAndTax', $data) && \is_int($data['totalDutyAndTax'])) { - $data['totalDutyAndTax'] = (double) $data['totalDutyAndTax']; - } - if (\array_key_exists('grandTotal', $data) && \is_int($data['grandTotal'])) { - $data['grandTotal'] = (double) $data['grandTotal']; - } - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('currencyCode', $data)) { - $object->setCurrencyCode($data['currencyCode']); - unset($data['currencyCode']); - } - if (\array_key_exists('importCountryCode', $data)) { - $object->setImportCountryCode($data['importCountryCode']); - unset($data['importCountryCode']); - } - if (\array_key_exists('id', $data)) { - $object->setId($data['id']); - unset($data['id']); - } - if (\array_key_exists('brokerageFeeItems', $data)) { - $values = []; - foreach ($data['brokerageFeeItems'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\BrokerageFeeItems::class, 'json', $context); - } - $object->setBrokerageFeeItems($values); - unset($data['brokerageFeeItems']); - } - if (\array_key_exists('totalBrokerageFees', $data)) { - $object->setTotalBrokerageFees($data['totalBrokerageFees']); - unset($data['totalBrokerageFees']); - } - if (\array_key_exists('totalDuties', $data)) { - $object->setTotalDuties($data['totalDuties']); - unset($data['totalDuties']); - } - if (\array_key_exists('totalCommodityLevelTaxesAndFees', $data)) { - $object->setTotalCommodityLevelTaxesAndFees($data['totalCommodityLevelTaxesAndFees']); - unset($data['totalCommodityLevelTaxesAndFees']); - } - if (\array_key_exists('totalShipmentLevelTaxesAndFees', $data)) { - $object->setTotalShipmentLevelTaxesAndFees($data['totalShipmentLevelTaxesAndFees']); - unset($data['totalShipmentLevelTaxesAndFees']); - } - if (\array_key_exists('totalVAT', $data)) { - $object->setTotalVAT($data['totalVAT']); - unset($data['totalVAT']); - } - if (\array_key_exists('totalDutyAndTax', $data)) { - $object->setTotalDutyAndTax($data['totalDutyAndTax']); - unset($data['totalDutyAndTax']); - } - if (\array_key_exists('grandTotal', $data)) { - $object->setGrandTotal($data['grandTotal']); - unset($data['grandTotal']); - } - if (\array_key_exists('shipmentItems', $data)) { - $values_1 = []; - foreach ($data['shipmentItems'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ResponseShipmentItems::class, 'json', $context); - } - $object->setShipmentItems($values_1); - unset($data['shipmentItems']); - } - if (\array_key_exists('transID', $data)) { - $object->setTransID($data['transID']); - unset($data['transID']); - } - if (\array_key_exists('perfStats', $data)) { - $object->setPerfStats($this->denormalizer->denormalize($data['perfStats'], \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class, 'json', $context)); - unset($data['perfStats']); - } - if (\array_key_exists('alVersion', $data)) { - $object->setAlVersion($data['alVersion']); - unset($data['alVersion']); - } - if (\array_key_exists('errors', $data)) { - $object->setErrors($this->denormalizer->denormalize($data['errors'], \ShipStream\Ups\Api\Model\Errors::class, 'json', $context)); - unset($data['errors']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + return $type === \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\LandedCostResponseShipment(); + if (\array_key_exists('totalBrokerageFees', $data) && \is_int($data['totalBrokerageFees'])) { + $data['totalBrokerageFees'] = (double) $data['totalBrokerageFees']; + } + if (\array_key_exists('totalDuties', $data) && \is_int($data['totalDuties'])) { + $data['totalDuties'] = (double) $data['totalDuties']; + } + if (\array_key_exists('totalCommodityLevelTaxesAndFees', $data) && \is_int($data['totalCommodityLevelTaxesAndFees'])) { + $data['totalCommodityLevelTaxesAndFees'] = (double) $data['totalCommodityLevelTaxesAndFees']; + } + if (\array_key_exists('totalShipmentLevelTaxesAndFees', $data) && \is_int($data['totalShipmentLevelTaxesAndFees'])) { + $data['totalShipmentLevelTaxesAndFees'] = (double) $data['totalShipmentLevelTaxesAndFees']; + } + if (\array_key_exists('totalVAT', $data) && \is_int($data['totalVAT'])) { + $data['totalVAT'] = (double) $data['totalVAT']; + } + if (\array_key_exists('totalDutyAndTax', $data) && \is_int($data['totalDutyAndTax'])) { + $data['totalDutyAndTax'] = (double) $data['totalDutyAndTax']; + } + if (\array_key_exists('grandTotal', $data) && \is_int($data['grandTotal'])) { + $data['grandTotal'] = (double) $data['grandTotal']; + } + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['currencyCode'] = $object->getCurrencyCode(); - $data['importCountryCode'] = $object->getImportCountryCode(); - $data['id'] = $object->getId(); + if (\array_key_exists('currencyCode', $data)) { + $object->setCurrencyCode($data['currencyCode']); + unset($data['currencyCode']); + } + if (\array_key_exists('importCountryCode', $data)) { + $object->setImportCountryCode($data['importCountryCode']); + unset($data['importCountryCode']); + } + if (\array_key_exists('id', $data)) { + $object->setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('brokerageFeeItems', $data)) { $values = []; - foreach ($object->getBrokerageFeeItems() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['brokerageFeeItems'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\BrokerageFeeItems::class, 'json', $context); } - $data['brokerageFeeItems'] = $values; - $data['totalBrokerageFees'] = $object->getTotalBrokerageFees(); - $data['totalDuties'] = $object->getTotalDuties(); - $data['totalCommodityLevelTaxesAndFees'] = $object->getTotalCommodityLevelTaxesAndFees(); - $data['totalShipmentLevelTaxesAndFees'] = $object->getTotalShipmentLevelTaxesAndFees(); - $data['totalVAT'] = $object->getTotalVAT(); - $data['totalDutyAndTax'] = $object->getTotalDutyAndTax(); - $data['grandTotal'] = $object->getGrandTotal(); + $object->setBrokerageFeeItems($values); + unset($data['brokerageFeeItems']); + } + if (\array_key_exists('totalBrokerageFees', $data)) { + $object->setTotalBrokerageFees($data['totalBrokerageFees']); + unset($data['totalBrokerageFees']); + } + if (\array_key_exists('totalDuties', $data)) { + $object->setTotalDuties($data['totalDuties']); + unset($data['totalDuties']); + } + if (\array_key_exists('totalCommodityLevelTaxesAndFees', $data)) { + $object->setTotalCommodityLevelTaxesAndFees($data['totalCommodityLevelTaxesAndFees']); + unset($data['totalCommodityLevelTaxesAndFees']); + } + if (\array_key_exists('totalShipmentLevelTaxesAndFees', $data)) { + $object->setTotalShipmentLevelTaxesAndFees($data['totalShipmentLevelTaxesAndFees']); + unset($data['totalShipmentLevelTaxesAndFees']); + } + if (\array_key_exists('totalVAT', $data)) { + $object->setTotalVAT($data['totalVAT']); + unset($data['totalVAT']); + } + if (\array_key_exists('totalDutyAndTax', $data)) { + $object->setTotalDutyAndTax($data['totalDutyAndTax']); + unset($data['totalDutyAndTax']); + } + if (\array_key_exists('grandTotal', $data)) { + $object->setGrandTotal($data['grandTotal']); + unset($data['grandTotal']); + } + if (\array_key_exists('shipmentItems', $data)) { $values_1 = []; - foreach ($object->getShipmentItems() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['shipmentItems'] = $values_1; - if ($object->isInitialized('transID') && null !== $object->getTransID()) { - $data['transID'] = $object->getTransID(); - } - if ($object->isInitialized('perfStats') && null !== $object->getPerfStats()) { - $data['perfStats'] = $this->normalizer->normalize($object->getPerfStats(), 'json', $context); + foreach ($data['shipmentItems'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ResponseShipmentItems::class, 'json', $context); } - if ($object->isInitialized('alVersion') && null !== $object->getAlVersion()) { - $data['alVersion'] = $object->getAlVersion(); - } - if ($object->isInitialized('errors') && null !== $object->getErrors()) { - $data['errors'] = $this->normalizer->normalize($object->getErrors(), 'json', $context); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; + $object->setShipmentItems($values_1); + unset($data['shipmentItems']); + } + if (\array_key_exists('transID', $data)) { + $object->setTransID($data['transID']); + unset($data['transID']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LandedCostResponseShipment::class => false]; + if (\array_key_exists('perfStats', $data)) { + $object->setPerfStats($this->denormalizer->denormalize($data['perfStats'], \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class, 'json', $context)); + unset($data['perfStats']); } + if (\array_key_exists('alVersion', $data)) { + $object->setAlVersion($data['alVersion']); + unset($data['alVersion']); + } + if (\array_key_exists('errors', $data)) { + $object->setErrors($this->denormalizer->denormalize($data['errors'], \ShipStream\Ups\Api\Model\Errors::class, 'json', $context)); + unset($data['errors']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } -} else { - class LandedCostResponseShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostResponseShipment::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LandedCostResponseShipment(); - if (\array_key_exists('totalBrokerageFees', $data) && \is_int($data['totalBrokerageFees'])) { - $data['totalBrokerageFees'] = (double) $data['totalBrokerageFees']; - } - if (\array_key_exists('totalDuties', $data) && \is_int($data['totalDuties'])) { - $data['totalDuties'] = (double) $data['totalDuties']; - } - if (\array_key_exists('totalCommodityLevelTaxesAndFees', $data) && \is_int($data['totalCommodityLevelTaxesAndFees'])) { - $data['totalCommodityLevelTaxesAndFees'] = (double) $data['totalCommodityLevelTaxesAndFees']; - } - if (\array_key_exists('totalShipmentLevelTaxesAndFees', $data) && \is_int($data['totalShipmentLevelTaxesAndFees'])) { - $data['totalShipmentLevelTaxesAndFees'] = (double) $data['totalShipmentLevelTaxesAndFees']; - } - if (\array_key_exists('totalVAT', $data) && \is_int($data['totalVAT'])) { - $data['totalVAT'] = (double) $data['totalVAT']; - } - if (\array_key_exists('totalDutyAndTax', $data) && \is_int($data['totalDutyAndTax'])) { - $data['totalDutyAndTax'] = (double) $data['totalDutyAndTax']; - } - if (\array_key_exists('grandTotal', $data) && \is_int($data['grandTotal'])) { - $data['grandTotal'] = (double) $data['grandTotal']; - } - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('currencyCode', $data)) { - $object->setCurrencyCode($data['currencyCode']); - unset($data['currencyCode']); - } - if (\array_key_exists('importCountryCode', $data)) { - $object->setImportCountryCode($data['importCountryCode']); - unset($data['importCountryCode']); - } - if (\array_key_exists('id', $data)) { - $object->setId($data['id']); - unset($data['id']); - } - if (\array_key_exists('brokerageFeeItems', $data)) { - $values = []; - foreach ($data['brokerageFeeItems'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\BrokerageFeeItems::class, 'json', $context); - } - $object->setBrokerageFeeItems($values); - unset($data['brokerageFeeItems']); - } - if (\array_key_exists('totalBrokerageFees', $data)) { - $object->setTotalBrokerageFees($data['totalBrokerageFees']); - unset($data['totalBrokerageFees']); - } - if (\array_key_exists('totalDuties', $data)) { - $object->setTotalDuties($data['totalDuties']); - unset($data['totalDuties']); - } - if (\array_key_exists('totalCommodityLevelTaxesAndFees', $data)) { - $object->setTotalCommodityLevelTaxesAndFees($data['totalCommodityLevelTaxesAndFees']); - unset($data['totalCommodityLevelTaxesAndFees']); - } - if (\array_key_exists('totalShipmentLevelTaxesAndFees', $data)) { - $object->setTotalShipmentLevelTaxesAndFees($data['totalShipmentLevelTaxesAndFees']); - unset($data['totalShipmentLevelTaxesAndFees']); - } - if (\array_key_exists('totalVAT', $data)) { - $object->setTotalVAT($data['totalVAT']); - unset($data['totalVAT']); - } - if (\array_key_exists('totalDutyAndTax', $data)) { - $object->setTotalDutyAndTax($data['totalDutyAndTax']); - unset($data['totalDutyAndTax']); - } - if (\array_key_exists('grandTotal', $data)) { - $object->setGrandTotal($data['grandTotal']); - unset($data['grandTotal']); - } - if (\array_key_exists('shipmentItems', $data)) { - $values_1 = []; - foreach ($data['shipmentItems'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ResponseShipmentItems::class, 'json', $context); - } - $object->setShipmentItems($values_1); - unset($data['shipmentItems']); - } - if (\array_key_exists('transID', $data)) { - $object->setTransID($data['transID']); - unset($data['transID']); - } - if (\array_key_exists('perfStats', $data)) { - $object->setPerfStats($this->denormalizer->denormalize($data['perfStats'], \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class, 'json', $context)); - unset($data['perfStats']); - } - if (\array_key_exists('alVersion', $data)) { - $object->setAlVersion($data['alVersion']); - unset($data['alVersion']); - } - if (\array_key_exists('errors', $data)) { - $object->setErrors($this->denormalizer->denormalize($data['errors'], \ShipStream\Ups\Api\Model\Errors::class, 'json', $context)); - unset($data['errors']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray = []; + $dataArray['currencyCode'] = $data->getCurrencyCode(); + $dataArray['importCountryCode'] = $data->getImportCountryCode(); + $dataArray['id'] = $data->getId(); + $values = []; + foreach ($data->getBrokerageFeeItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['currencyCode'] = $object->getCurrencyCode(); - $data['importCountryCode'] = $object->getImportCountryCode(); - $data['id'] = $object->getId(); - $values = []; - foreach ($object->getBrokerageFeeItems() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['brokerageFeeItems'] = $values; - $data['totalBrokerageFees'] = $object->getTotalBrokerageFees(); - $data['totalDuties'] = $object->getTotalDuties(); - $data['totalCommodityLevelTaxesAndFees'] = $object->getTotalCommodityLevelTaxesAndFees(); - $data['totalShipmentLevelTaxesAndFees'] = $object->getTotalShipmentLevelTaxesAndFees(); - $data['totalVAT'] = $object->getTotalVAT(); - $data['totalDutyAndTax'] = $object->getTotalDutyAndTax(); - $data['grandTotal'] = $object->getGrandTotal(); - $values_1 = []; - foreach ($object->getShipmentItems() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['shipmentItems'] = $values_1; - if ($object->isInitialized('transID') && null !== $object->getTransID()) { - $data['transID'] = $object->getTransID(); - } - if ($object->isInitialized('perfStats') && null !== $object->getPerfStats()) { - $data['perfStats'] = $this->normalizer->normalize($object->getPerfStats(), 'json', $context); - } - if ($object->isInitialized('alVersion') && null !== $object->getAlVersion()) { - $data['alVersion'] = $object->getAlVersion(); - } - if ($object->isInitialized('errors') && null !== $object->getErrors()) { - $data['errors'] = $this->normalizer->normalize($object->getErrors(), 'json', $context); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; + $dataArray['brokerageFeeItems'] = $values; + $dataArray['totalBrokerageFees'] = $data->getTotalBrokerageFees(); + $dataArray['totalDuties'] = $data->getTotalDuties(); + $dataArray['totalCommodityLevelTaxesAndFees'] = $data->getTotalCommodityLevelTaxesAndFees(); + $dataArray['totalShipmentLevelTaxesAndFees'] = $data->getTotalShipmentLevelTaxesAndFees(); + $dataArray['totalVAT'] = $data->getTotalVAT(); + $dataArray['totalDutyAndTax'] = $data->getTotalDutyAndTax(); + $dataArray['grandTotal'] = $data->getGrandTotal(); + $values_1 = []; + foreach ($data->getShipmentItems() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + } + $dataArray['shipmentItems'] = $values_1; + if ($data->isInitialized('transID') && null !== $data->getTransID()) { + $dataArray['transID'] = $data->getTransID(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LandedCostResponseShipment::class => false]; + if ($data->isInitialized('perfStats') && null !== $data->getPerfStats()) { + $dataArray['perfStats'] = $this->normalizer->normalize($data->getPerfStats(), 'json', $context); } + if ($data->isInitialized('alVersion') && null !== $data->getAlVersion()) { + $dataArray['alVersion'] = $data->getAlVersion(); + } + if ($data->isInitialized('errors') && null !== $data->getErrors()) { + $dataArray['errors'] = $this->normalizer->normalize($data->getErrors(), 'json', $context); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LandedCostResponseShipment::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LandedCostResponseShipmentPerfStatsNormalizer.php b/src/Api/Normalizer/LandedCostResponseShipmentPerfStatsNormalizer.php index 57253127..80b8ae13 100644 --- a/src/Api/Normalizer/LandedCostResponseShipmentPerfStatsNormalizer.php +++ b/src/Api/Normalizer/LandedCostResponseShipmentPerfStatsNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LandedCostResponseShipmentPerfStatsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LandedCostResponseShipmentPerfStatsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class; + return $type === \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('absLayerTime', $data)) { - $object->setAbsLayerTime($data['absLayerTime']); - unset($data['absLayerTime']); - } - if (\array_key_exists('fulfillTime', $data)) { - $object->setFulfillTime($data['fulfillTime']); - unset($data['fulfillTime']); - } - if (\array_key_exists('receiptTime', $data)) { - $object->setReceiptTime($data['receiptTime']); - unset($data['receiptTime']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['absLayerTime'] = $object->getAbsLayerTime(); - $data['fulfillTime'] = $object->getFulfillTime(); - $data['receiptTime'] = $object->getReceiptTime(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('absLayerTime', $data)) { + $object->setAbsLayerTime($data['absLayerTime']); + unset($data['absLayerTime']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class => false]; + if (\array_key_exists('fulfillTime', $data)) { + $object->setFulfillTime($data['fulfillTime']); + unset($data['fulfillTime']); } - } -} else { - class LandedCostResponseShipmentPerfStatsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class; + if (\array_key_exists('receiptTime', $data)) { + $object->setReceiptTime($data['receiptTime']); + unset($data['receiptTime']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('absLayerTime', $data)) { - $object->setAbsLayerTime($data['absLayerTime']); - unset($data['absLayerTime']); - } - if (\array_key_exists('fulfillTime', $data)) { - $object->setFulfillTime($data['fulfillTime']); - unset($data['fulfillTime']); - } - if (\array_key_exists('receiptTime', $data)) { - $object->setReceiptTime($data['receiptTime']); - unset($data['receiptTime']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['absLayerTime'] = $object->getAbsLayerTime(); - $data['fulfillTime'] = $object->getFulfillTime(); - $data['receiptTime'] = $object->getReceiptTime(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['absLayerTime'] = $data->getAbsLayerTime(); + $dataArray['fulfillTime'] = $data->getFulfillTime(); + $dataArray['receiptTime'] = $data->getReceiptTime(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LandedCostResponseShipmentPerfStats::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocationAttributeOptionCodeNormalizer.php b/src/Api/Normalizer/LocationAttributeOptionCodeNormalizer.php index 497dbf31..a4f67500 100644 --- a/src/Api/Normalizer/LocationAttributeOptionCodeNormalizer.php +++ b/src/Api/Normalizer/LocationAttributeOptionCodeNormalizer.php @@ -5,178 +5,88 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocationAttributeOptionCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocationAttributeOptionCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class; + return $type === \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocationAttributeOptionCode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Category', $data)) { - $object->setCategory($data['Category']); - unset($data['Category']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('TransportationPickUpSchedule', $data)) { - $object->setTransportationPickUpSchedule($this->denormalizer->denormalize($data['TransportationPickUpSchedule'], \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class, 'json', $context)); - unset($data['TransportationPickUpSchedule']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LocationAttributeOptionCode(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('category') && null !== $object->getCategory()) { - $data['Category'] = $object->getCategory(); - } - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('transportationPickUpSchedule') && null !== $object->getTransportationPickUpSchedule()) { - $data['TransportationPickUpSchedule'] = $this->normalizer->normalize($object->getTransportationPickUpSchedule(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Category', $data)) { + $object->setCategory($data['Category']); + unset($data['Category']); + } + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class => false]; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } + if (\array_key_exists('TransportationPickUpSchedule', $data)) { + $object->setTransportationPickUpSchedule($this->denormalizer->denormalize($data['TransportationPickUpSchedule'], \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class, 'json', $context)); + unset($data['TransportationPickUpSchedule']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LocationAttributeOptionCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class; + $dataArray = []; + if ($data->isInitialized('category') && null !== $data->getCategory()) { + $dataArray['Category'] = $data->getCategory(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + if ($data->isInitialized('name') && null !== $data->getName()) { + $dataArray['Name'] = $data->getName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocationAttributeOptionCode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Category', $data)) { - $object->setCategory($data['Category']); - unset($data['Category']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('TransportationPickUpSchedule', $data)) { - $object->setTransportationPickUpSchedule($this->denormalizer->denormalize($data['TransportationPickUpSchedule'], \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class, 'json', $context)); - unset($data['TransportationPickUpSchedule']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('transportationPickUpSchedule') && null !== $data->getTransportationPickUpSchedule()) { + $dataArray['TransportationPickUpSchedule'] = $this->normalizer->normalize($data->getTransportationPickUpSchedule(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('category') && null !== $object->getCategory()) { - $data['Category'] = $object->getCategory(); - } - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('transportationPickUpSchedule') && null !== $object->getTransportationPickUpSchedule()) { - $data['TransportationPickUpSchedule'] = $this->normalizer->normalize($object->getTransportationPickUpSchedule(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocationAttributeOptionCode::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocationAttributeOptionTypeNormalizer.php b/src/Api/Normalizer/LocationAttributeOptionTypeNormalizer.php index 68222baa..cd0f586a 100644 --- a/src/Api/Normalizer/LocationAttributeOptionTypeNormalizer.php +++ b/src/Api/Normalizer/LocationAttributeOptionTypeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocationAttributeOptionTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocationAttributeOptionTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class; + return $type === \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocationAttributeOptionType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LocationAttributeOptionType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationAttributeOptionType::class => false]; - } - } -} else { - class LocationAttributeOptionTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationAttributeOptionType::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocationAttributeOptionType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationAttributeOptionType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocationAttributeOptionType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocationNormalizer.php b/src/Api/Normalizer/LocationNormalizer.php index 5ecfd54a..05ae90a6 100644 --- a/src/Api/Normalizer/LocationNormalizer.php +++ b/src/Api/Normalizer/LocationNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Location::class; + return $type === \ShipStream\Ups\Api\Model\Location::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Location::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Location::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Location(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('address', $data) && $data['address'] !== null) { - $object->setAddress($this->denormalizer->denormalize($data['address'], \ShipStream\Ups\Api\Model\Address::class, 'json', $context)); - unset($data['address']); - } - elseif (\array_key_exists('address', $data) && $data['address'] === null) { - $object->setAddress(null); - } - if (\array_key_exists('slic', $data)) { - $object->setSlic($data['slic']); - unset($data['slic']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\Location(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('slic') && null !== $object->getSlic()) { - $data['slic'] = $object->getSlic(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('address', $data) && $data['address'] !== null) { + $object->setAddress($this->denormalizer->denormalize($data['address'], \ShipStream\Ups\Api\Model\Address::class, 'json', $context)); + unset($data['address']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Location::class => false]; + elseif (\array_key_exists('address', $data) && $data['address'] === null) { + $object->setAddress(null); } + if (\array_key_exists('slic', $data)) { + $object->setSlic($data['slic']); + unset($data['slic']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Location::class; + $dataArray = []; + if ($data->isInitialized('address')) { + $dataArray['address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Location::class; + if ($data->isInitialized('slic') && null !== $data->getSlic()) { + $dataArray['slic'] = $data->getSlic(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Location(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('address', $data) && $data['address'] !== null) { - $object->setAddress($this->denormalizer->denormalize($data['address'], \ShipStream\Ups\Api\Model\Address::class, 'json', $context)); - unset($data['address']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - elseif (\array_key_exists('address', $data) && $data['address'] === null) { - $object->setAddress(null); - } - if (\array_key_exists('slic', $data)) { - $object->setSlic($data['slic']); - unset($data['slic']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('slic') && null !== $object->getSlic()) { - $data['slic'] = $object->getSlic(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Location::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Location::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocationSearchCriteriaAccessPointSearchNormalizer.php b/src/Api/Normalizer/LocationSearchCriteriaAccessPointSearchNormalizer.php index 753acefc..5403d34b 100644 --- a/src/Api/Normalizer/LocationSearchCriteriaAccessPointSearchNormalizer.php +++ b/src/Api/Normalizer/LocationSearchCriteriaAccessPointSearchNormalizer.php @@ -5,214 +5,106 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocationSearchCriteriaAccessPointSearchNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocationSearchCriteriaAccessPointSearchNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PublicAccessPointID', $data)) { - $object->setPublicAccessPointID($data['PublicAccessPointID']); - unset($data['PublicAccessPointID']); - } - if (\array_key_exists('AccessPointStatus', $data)) { - $object->setAccessPointStatus($data['AccessPointStatus']); - unset($data['AccessPointStatus']); - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('IncludeCriteria', $data)) { - $object->setIncludeCriteria($this->denormalizer->denormalize($data['IncludeCriteria'], \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class, 'json', $context)); - unset($data['IncludeCriteria']); - } - if (\array_key_exists('ExcludeFromResult', $data)) { - $object->setExcludeFromResult($this->denormalizer->denormalize($data['ExcludeFromResult'], \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class, 'json', $context)); - unset($data['ExcludeFromResult']); - } - if (\array_key_exists('ExactMatchIndicator', $data)) { - $object->setExactMatchIndicator($data['ExactMatchIndicator']); - unset($data['ExactMatchIndicator']); - } - if (\array_key_exists('ExistIndicator', $data)) { - $object->setExistIndicator($data['ExistIndicator']); - unset($data['ExistIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('publicAccessPointID') && null !== $object->getPublicAccessPointID()) { - $data['PublicAccessPointID'] = $object->getPublicAccessPointID(); - } - if ($object->isInitialized('accessPointStatus') && null !== $object->getAccessPointStatus()) { - $data['AccessPointStatus'] = $object->getAccessPointStatus(); - } - if ($object->isInitialized('accountNumber') && null !== $object->getAccountNumber()) { - $data['AccountNumber'] = $object->getAccountNumber(); - } - if ($object->isInitialized('includeCriteria') && null !== $object->getIncludeCriteria()) { - $data['IncludeCriteria'] = $this->normalizer->normalize($object->getIncludeCriteria(), 'json', $context); - } - if ($object->isInitialized('excludeFromResult') && null !== $object->getExcludeFromResult()) { - $data['ExcludeFromResult'] = $this->normalizer->normalize($object->getExcludeFromResult(), 'json', $context); - } - if ($object->isInitialized('exactMatchIndicator') && null !== $object->getExactMatchIndicator()) { - $data['ExactMatchIndicator'] = $object->getExactMatchIndicator(); - } - if ($object->isInitialized('existIndicator') && null !== $object->getExistIndicator()) { - $data['ExistIndicator'] = $object->getExistIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PublicAccessPointID', $data)) { + $object->setPublicAccessPointID($data['PublicAccessPointID']); + unset($data['PublicAccessPointID']); + } + if (\array_key_exists('AccessPointStatus', $data)) { + $object->setAccessPointStatus($data['AccessPointStatus']); + unset($data['AccessPointStatus']); + } + if (\array_key_exists('AccountNumber', $data)) { + $object->setAccountNumber($data['AccountNumber']); + unset($data['AccountNumber']); + } + if (\array_key_exists('IncludeCriteria', $data)) { + $object->setIncludeCriteria($this->denormalizer->denormalize($data['IncludeCriteria'], \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class, 'json', $context)); + unset($data['IncludeCriteria']); + } + if (\array_key_exists('ExcludeFromResult', $data)) { + $object->setExcludeFromResult($this->denormalizer->denormalize($data['ExcludeFromResult'], \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class, 'json', $context)); + unset($data['ExcludeFromResult']); + } + if (\array_key_exists('ExactMatchIndicator', $data)) { + $object->setExactMatchIndicator($data['ExactMatchIndicator']); + unset($data['ExactMatchIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class => false]; + if (\array_key_exists('ExistIndicator', $data)) { + $object->setExistIndicator($data['ExistIndicator']); + unset($data['ExistIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LocationSearchCriteriaAccessPointSearchNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PublicAccessPointID', $data)) { - $object->setPublicAccessPointID($data['PublicAccessPointID']); - unset($data['PublicAccessPointID']); - } - if (\array_key_exists('AccessPointStatus', $data)) { - $object->setAccessPointStatus($data['AccessPointStatus']); - unset($data['AccessPointStatus']); - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('IncludeCriteria', $data)) { - $object->setIncludeCriteria($this->denormalizer->denormalize($data['IncludeCriteria'], \ShipStream\Ups\Api\Model\AccessPointSearchIncludeCriteria::class, 'json', $context)); - unset($data['IncludeCriteria']); - } - if (\array_key_exists('ExcludeFromResult', $data)) { - $object->setExcludeFromResult($this->denormalizer->denormalize($data['ExcludeFromResult'], \ShipStream\Ups\Api\Model\AccessPointSearchExcludeFromResult::class, 'json', $context)); - unset($data['ExcludeFromResult']); - } - if (\array_key_exists('ExactMatchIndicator', $data)) { - $object->setExactMatchIndicator($data['ExactMatchIndicator']); - unset($data['ExactMatchIndicator']); - } - if (\array_key_exists('ExistIndicator', $data)) { - $object->setExistIndicator($data['ExistIndicator']); - unset($data['ExistIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('publicAccessPointID') && null !== $data->getPublicAccessPointID()) { + $dataArray['PublicAccessPointID'] = $data->getPublicAccessPointID(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('publicAccessPointID') && null !== $object->getPublicAccessPointID()) { - $data['PublicAccessPointID'] = $object->getPublicAccessPointID(); - } - if ($object->isInitialized('accessPointStatus') && null !== $object->getAccessPointStatus()) { - $data['AccessPointStatus'] = $object->getAccessPointStatus(); - } - if ($object->isInitialized('accountNumber') && null !== $object->getAccountNumber()) { - $data['AccountNumber'] = $object->getAccountNumber(); - } - if ($object->isInitialized('includeCriteria') && null !== $object->getIncludeCriteria()) { - $data['IncludeCriteria'] = $this->normalizer->normalize($object->getIncludeCriteria(), 'json', $context); - } - if ($object->isInitialized('excludeFromResult') && null !== $object->getExcludeFromResult()) { - $data['ExcludeFromResult'] = $this->normalizer->normalize($object->getExcludeFromResult(), 'json', $context); - } - if ($object->isInitialized('exactMatchIndicator') && null !== $object->getExactMatchIndicator()) { - $data['ExactMatchIndicator'] = $object->getExactMatchIndicator(); - } - if ($object->isInitialized('existIndicator') && null !== $object->getExistIndicator()) { - $data['ExistIndicator'] = $object->getExistIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('accessPointStatus') && null !== $data->getAccessPointStatus()) { + $dataArray['AccessPointStatus'] = $data->getAccessPointStatus(); + } + if ($data->isInitialized('accountNumber') && null !== $data->getAccountNumber()) { + $dataArray['AccountNumber'] = $data->getAccountNumber(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class => false]; + if ($data->isInitialized('includeCriteria') && null !== $data->getIncludeCriteria()) { + $dataArray['IncludeCriteria'] = $this->normalizer->normalize($data->getIncludeCriteria(), 'json', $context); } + if ($data->isInitialized('excludeFromResult') && null !== $data->getExcludeFromResult()) { + $dataArray['ExcludeFromResult'] = $this->normalizer->normalize($data->getExcludeFromResult(), 'json', $context); + } + if ($data->isInitialized('exactMatchIndicator') && null !== $data->getExactMatchIndicator()) { + $dataArray['ExactMatchIndicator'] = $data->getExactMatchIndicator(); + } + if ($data->isInitialized('existIndicator') && null !== $data->getExistIndicator()) { + $dataArray['ExistIndicator'] = $data->getExistIndicator(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocationSearchCriteriaFreightWillCallSearchNormalizer.php b/src/Api/Normalizer/LocationSearchCriteriaFreightWillCallSearchNormalizer.php index ad913ef1..2a1484e4 100644 --- a/src/Api/Normalizer/LocationSearchCriteriaFreightWillCallSearchNormalizer.php +++ b/src/Api/Normalizer/LocationSearchCriteriaFreightWillCallSearchNormalizer.php @@ -5,186 +5,92 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocationSearchCriteriaFreightWillCallSearchNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocationSearchCriteriaFreightWillCallSearchNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class; + return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightWillCallRequestType', $data)) { - $object->setFreightWillCallRequestType($data['FreightWillCallRequestType']); - unset($data['FreightWillCallRequestType']); - } - if (\array_key_exists('FacilityAddress', $data)) { - $values = []; - foreach ($data['FacilityAddress'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class, 'json', $context); - } - $object->setFacilityAddress($values); - unset($data['FacilityAddress']); - } - if (\array_key_exists('OriginOrDestination', $data)) { - $object->setOriginOrDestination($data['OriginOrDestination']); - unset($data['OriginOrDestination']); - } - if (\array_key_exists('FormatPostalCode', $data)) { - $object->setFormatPostalCode($data['FormatPostalCode']); - unset($data['FormatPostalCode']); - } - if (\array_key_exists('DayOfWeekCode', $data)) { - $object->setDayOfWeekCode($data['DayOfWeekCode']); - unset($data['DayOfWeekCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['FreightWillCallRequestType'] = $object->getFreightWillCallRequestType(); + if (\array_key_exists('FreightWillCallRequestType', $data)) { + $object->setFreightWillCallRequestType($data['FreightWillCallRequestType']); + unset($data['FreightWillCallRequestType']); + } + if (\array_key_exists('FacilityAddress', $data)) { $values = []; - foreach ($object->getFacilityAddress() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['FacilityAddress'] = $values; - $data['OriginOrDestination'] = $object->getOriginOrDestination(); - $data['FormatPostalCode'] = $object->getFormatPostalCode(); - if ($object->isInitialized('dayOfWeekCode') && null !== $object->getDayOfWeekCode()) { - $data['DayOfWeekCode'] = $object->getDayOfWeekCode(); + foreach ($data['FacilityAddress'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class, 'json', $context); } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setFacilityAddress($values); + unset($data['FacilityAddress']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class => false]; + if (\array_key_exists('OriginOrDestination', $data)) { + $object->setOriginOrDestination($data['OriginOrDestination']); + unset($data['OriginOrDestination']); } - } -} else { - class LocationSearchCriteriaFreightWillCallSearchNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class; + if (\array_key_exists('FormatPostalCode', $data)) { + $object->setFormatPostalCode($data['FormatPostalCode']); + unset($data['FormatPostalCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class; + if (\array_key_exists('DayOfWeekCode', $data)) { + $object->setDayOfWeekCode($data['DayOfWeekCode']); + unset($data['DayOfWeekCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; } - $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightWillCallRequestType', $data)) { - $object->setFreightWillCallRequestType($data['FreightWillCallRequestType']); - unset($data['FreightWillCallRequestType']); - } - if (\array_key_exists('FacilityAddress', $data)) { - $values = []; - foreach ($data['FacilityAddress'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FreightWillCallSearchFacilityAddress::class, 'json', $context); - } - $object->setFacilityAddress($values); - unset($data['FacilityAddress']); - } - if (\array_key_exists('OriginOrDestination', $data)) { - $object->setOriginOrDestination($data['OriginOrDestination']); - unset($data['OriginOrDestination']); - } - if (\array_key_exists('FormatPostalCode', $data)) { - $object->setFormatPostalCode($data['FormatPostalCode']); - unset($data['FormatPostalCode']); - } - if (\array_key_exists('DayOfWeekCode', $data)) { - $object->setDayOfWeekCode($data['DayOfWeekCode']); - unset($data['DayOfWeekCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['FreightWillCallRequestType'] = $object->getFreightWillCallRequestType(); - $values = []; - foreach ($object->getFacilityAddress() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['FacilityAddress'] = $values; - $data['OriginOrDestination'] = $object->getOriginOrDestination(); - $data['FormatPostalCode'] = $object->getFormatPostalCode(); - if ($object->isInitialized('dayOfWeekCode') && null !== $object->getDayOfWeekCode()) { - $data['DayOfWeekCode'] = $object->getDayOfWeekCode(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['FreightWillCallRequestType'] = $data->getFreightWillCallRequestType(); + $values = []; + foreach ($data->getFacilityAddress() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class => false]; + $dataArray['FacilityAddress'] = $values; + $dataArray['OriginOrDestination'] = $data->getOriginOrDestination(); + $dataArray['FormatPostalCode'] = $data->getFormatPostalCode(); + if ($data->isInitialized('dayOfWeekCode') && null !== $data->getDayOfWeekCode()) { + $dataArray['DayOfWeekCode'] = $data->getDayOfWeekCode(); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocationSearchCriteriaOpenTimeCriteriaNormalizer.php b/src/Api/Normalizer/LocationSearchCriteriaOpenTimeCriteriaNormalizer.php index 9b052902..bd05bf2a 100644 --- a/src/Api/Normalizer/LocationSearchCriteriaOpenTimeCriteriaNormalizer.php +++ b/src/Api/Normalizer/LocationSearchCriteriaOpenTimeCriteriaNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocationSearchCriteriaOpenTimeCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocationSearchCriteriaOpenTimeCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class; + return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DayOfWeekCode', $data)) { - $object->setDayOfWeekCode($data['DayOfWeekCode']); - unset($data['DayOfWeekCode']); - } - if (\array_key_exists('FromTime', $data)) { - $object->setFromTime($data['FromTime']); - unset($data['FromTime']); - } - if (\array_key_exists('ToTime', $data)) { - $object->setToTime($data['ToTime']); - unset($data['ToTime']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('dayOfWeekCode') && null !== $object->getDayOfWeekCode()) { - $data['DayOfWeekCode'] = $object->getDayOfWeekCode(); - } - if ($object->isInitialized('fromTime') && null !== $object->getFromTime()) { - $data['FromTime'] = $object->getFromTime(); - } - if ($object->isInitialized('toTime') && null !== $object->getToTime()) { - $data['ToTime'] = $object->getToTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DayOfWeekCode', $data)) { + $object->setDayOfWeekCode($data['DayOfWeekCode']); + unset($data['DayOfWeekCode']); + } + if (\array_key_exists('FromTime', $data)) { + $object->setFromTime($data['FromTime']); + unset($data['FromTime']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class => false]; + if (\array_key_exists('ToTime', $data)) { + $object->setToTime($data['ToTime']); + unset($data['ToTime']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LocationSearchCriteriaOpenTimeCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class; + $dataArray = []; + if ($data->isInitialized('dayOfWeekCode') && null !== $data->getDayOfWeekCode()) { + $dataArray['DayOfWeekCode'] = $data->getDayOfWeekCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class; + if ($data->isInitialized('fromTime') && null !== $data->getFromTime()) { + $dataArray['FromTime'] = $data->getFromTime(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DayOfWeekCode', $data)) { - $object->setDayOfWeekCode($data['DayOfWeekCode']); - unset($data['DayOfWeekCode']); - } - if (\array_key_exists('FromTime', $data)) { - $object->setFromTime($data['FromTime']); - unset($data['FromTime']); - } - if (\array_key_exists('ToTime', $data)) { - $object->setToTime($data['ToTime']); - unset($data['ToTime']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('toTime') && null !== $data->getToTime()) { + $dataArray['ToTime'] = $data->getToTime(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('dayOfWeekCode') && null !== $object->getDayOfWeekCode()) { - $data['DayOfWeekCode'] = $object->getDayOfWeekCode(); - } - if ($object->isInitialized('fromTime') && null !== $object->getFromTime()) { - $data['FromTime'] = $object->getFromTime(); - } - if ($object->isInitialized('toTime') && null !== $object->getToTime()) { - $data['ToTime'] = $object->getToTime(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocationSearchCriteriaSearchOptionNormalizer.php b/src/Api/Normalizer/LocationSearchCriteriaSearchOptionNormalizer.php index 5fe90d02..67dba82f 100644 --- a/src/Api/Normalizer/LocationSearchCriteriaSearchOptionNormalizer.php +++ b/src/Api/Normalizer/LocationSearchCriteriaSearchOptionNormalizer.php @@ -5,166 +5,82 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocationSearchCriteriaSearchOptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocationSearchCriteriaSearchOptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class; + return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('OptionType', $data)) { - $object->setOptionType($this->denormalizer->denormalize($data['OptionType'], \ShipStream\Ups\Api\Model\SearchOptionOptionType::class, 'json', $context)); - unset($data['OptionType']); - } - if (\array_key_exists('OptionCode', $data)) { - $values = []; - foreach ($data['OptionCode'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class, 'json', $context); - } - $object->setOptionCode($values); - unset($data['OptionCode']); - } - if (\array_key_exists('Relation', $data)) { - $object->setRelation($this->denormalizer->denormalize($data['Relation'], \ShipStream\Ups\Api\Model\SearchOptionRelation::class, 'json', $context)); - unset($data['Relation']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['OptionType'] = $this->normalizer->normalize($object->getOptionType(), 'json', $context); + if (\array_key_exists('OptionType', $data)) { + $object->setOptionType($this->denormalizer->denormalize($data['OptionType'], \ShipStream\Ups\Api\Model\SearchOptionOptionType::class, 'json', $context)); + unset($data['OptionType']); + } + if (\array_key_exists('OptionCode', $data)) { $values = []; - foreach ($object->getOptionCode() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['OptionCode'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class, 'json', $context); } - $data['OptionCode'] = $values; - if ($object->isInitialized('relation') && null !== $object->getRelation()) { - $data['Relation'] = $this->normalizer->normalize($object->getRelation(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setOptionCode($values); + unset($data['OptionCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class => false]; + if (\array_key_exists('Relation', $data)) { + $object->setRelation($this->denormalizer->denormalize($data['Relation'], \ShipStream\Ups\Api\Model\SearchOptionRelation::class, 'json', $context)); + unset($data['Relation']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class LocationSearchCriteriaSearchOptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class; + $dataArray = []; + $dataArray['OptionType'] = $this->normalizer->normalize($data->getOptionType(), 'json', $context); + $values = []; + foreach ($data->getOptionCode() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class; + $dataArray['OptionCode'] = $values; + if ($data->isInitialized('relation') && null !== $data->getRelation()) { + $dataArray['Relation'] = $this->normalizer->normalize($data->getRelation(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('OptionType', $data)) { - $object->setOptionType($this->denormalizer->denormalize($data['OptionType'], \ShipStream\Ups\Api\Model\SearchOptionOptionType::class, 'json', $context)); - unset($data['OptionType']); - } - if (\array_key_exists('OptionCode', $data)) { - $values = []; - foreach ($data['OptionCode'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class, 'json', $context); - } - $object->setOptionCode($values); - unset($data['OptionCode']); - } - if (\array_key_exists('Relation', $data)) { - $object->setRelation($this->denormalizer->denormalize($data['Relation'], \ShipStream\Ups\Api\Model\SearchOptionRelation::class, 'json', $context)); - unset($data['Relation']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['OptionType'] = $this->normalizer->normalize($object->getOptionType(), 'json', $context); - $values = []; - foreach ($object->getOptionCode() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['OptionCode'] = $values; - if ($object->isInitialized('relation') && null !== $object->getRelation()) { - $data['Relation'] = $this->normalizer->normalize($object->getRelation(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocationSearchCriteriaServiceSearchNormalizer.php b/src/Api/Normalizer/LocationSearchCriteriaServiceSearchNormalizer.php index b0f8d7f5..376db032 100644 --- a/src/Api/Normalizer/LocationSearchCriteriaServiceSearchNormalizer.php +++ b/src/Api/Normalizer/LocationSearchCriteriaServiceSearchNormalizer.php @@ -5,190 +5,94 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocationSearchCriteriaServiceSearchNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocationSearchCriteriaServiceSearchNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class; + return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - if (\array_key_exists('ServiceCode', $data)) { - $values = []; - foreach ($data['ServiceCode'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class, 'json', $context); - } - $object->setServiceCode($values); - unset($data['ServiceCode']); - } - if (\array_key_exists('ServiceOptionCode', $data)) { - $values_1 = []; - foreach ($data['ServiceOptionCode'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class, 'json', $context); - } - $object->setServiceOptionCode($values_1); - unset($data['ServiceOptionCode']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['Time'] = $object->getTime(); - } - if ($object->isInitialized('serviceCode') && null !== $object->getServiceCode()) { - $values = []; - foreach ($object->getServiceCode() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ServiceCode'] = $values; - } - if ($object->isInitialized('serviceOptionCode') && null !== $object->getServiceOptionCode()) { - $values_1 = []; - foreach ($object->getServiceOptionCode() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ServiceOptionCode'] = $values_1; + if (\array_key_exists('Time', $data)) { + $object->setTime($data['Time']); + unset($data['Time']); + } + if (\array_key_exists('ServiceCode', $data)) { + $values = []; + foreach ($data['ServiceCode'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setServiceCode($values); + unset($data['ServiceCode']); + } + if (\array_key_exists('ServiceOptionCode', $data)) { + $values_1 = []; + foreach ($data['ServiceOptionCode'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class, 'json', $context); } - return $data; + $object->setServiceOptionCode($values_1); + unset($data['ServiceOptionCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } } + return $object; } -} else { - class LocationSearchCriteriaServiceSearchNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class; + $dataArray = []; + if ($data->isInitialized('time') && null !== $data->getTime()) { + $dataArray['Time'] = $data->getTime(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - if (\array_key_exists('ServiceCode', $data)) { - $values = []; - foreach ($data['ServiceCode'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class, 'json', $context); - } - $object->setServiceCode($values); - unset($data['ServiceCode']); - } - if (\array_key_exists('ServiceOptionCode', $data)) { - $values_1 = []; - foreach ($data['ServiceOptionCode'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class, 'json', $context); - } - $object->setServiceOptionCode($values_1); - unset($data['ServiceOptionCode']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } + if ($data->isInitialized('serviceCode') && null !== $data->getServiceCode()) { + $values = []; + foreach ($data->getServiceCode() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['ServiceCode'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['Time'] = $object->getTime(); - } - if ($object->isInitialized('serviceCode') && null !== $object->getServiceCode()) { - $values = []; - foreach ($object->getServiceCode() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ServiceCode'] = $values; - } - if ($object->isInitialized('serviceOptionCode') && null !== $object->getServiceOptionCode()) { - $values_1 = []; - foreach ($object->getServiceOptionCode() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ServiceOptionCode'] = $values_1; - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + if ($data->isInitialized('serviceOptionCode') && null !== $data->getServiceOptionCode()) { + $values_1 = []; + foreach ($data->getServiceOptionCode() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['ServiceOptionCode'] = $values_1; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocatorRequestLocationSearchCriteriaNormalizer.php b/src/Api/Normalizer/LocatorRequestLocationSearchCriteriaNormalizer.php index 2eca2fc1..f1ce0d3a 100644 --- a/src/Api/Normalizer/LocatorRequestLocationSearchCriteriaNormalizer.php +++ b/src/Api/Normalizer/LocatorRequestLocationSearchCriteriaNormalizer.php @@ -5,244 +5,121 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocatorRequestLocationSearchCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocatorRequestLocationSearchCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SearchOption', $data)) { - $values = []; - foreach ($data['SearchOption'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class, 'json', $context); - } - $object->setSearchOption($values); - unset($data['SearchOption']); - } - if (\array_key_exists('MaximumListSize', $data)) { - $object->setMaximumListSize($data['MaximumListSize']); - unset($data['MaximumListSize']); - } - if (\array_key_exists('SearchRadius', $data)) { - $object->setSearchRadius($data['SearchRadius']); - unset($data['SearchRadius']); - } - if (\array_key_exists('ServiceSearch', $data)) { - $object->setServiceSearch($this->denormalizer->denormalize($data['ServiceSearch'], \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class, 'json', $context)); - unset($data['ServiceSearch']); - } - if (\array_key_exists('FreightWillCallSearch', $data)) { - $object->setFreightWillCallSearch($this->denormalizer->denormalize($data['FreightWillCallSearch'], \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class, 'json', $context)); - unset($data['FreightWillCallSearch']); - } - if (\array_key_exists('AccessPointSearch', $data)) { - $object->setAccessPointSearch($this->denormalizer->denormalize($data['AccessPointSearch'], \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class, 'json', $context)); - unset($data['AccessPointSearch']); - } - if (\array_key_exists('OpenTimeCriteria', $data)) { - $object->setOpenTimeCriteria($this->denormalizer->denormalize($data['OpenTimeCriteria'], \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class, 'json', $context)); - unset($data['OpenTimeCriteria']); - } - if (\array_key_exists('BrexitFilter', $data)) { - $object->setBrexitFilter($data['BrexitFilter']); - unset($data['BrexitFilter']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('searchOption') && null !== $object->getSearchOption()) { - $values = []; - foreach ($object->getSearchOption() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['SearchOption'] = $values; - } - if ($object->isInitialized('maximumListSize') && null !== $object->getMaximumListSize()) { - $data['MaximumListSize'] = $object->getMaximumListSize(); - } - if ($object->isInitialized('searchRadius') && null !== $object->getSearchRadius()) { - $data['SearchRadius'] = $object->getSearchRadius(); - } - if ($object->isInitialized('serviceSearch') && null !== $object->getServiceSearch()) { - $data['ServiceSearch'] = $this->normalizer->normalize($object->getServiceSearch(), 'json', $context); - } - if ($object->isInitialized('freightWillCallSearch') && null !== $object->getFreightWillCallSearch()) { - $data['FreightWillCallSearch'] = $this->normalizer->normalize($object->getFreightWillCallSearch(), 'json', $context); - } - if ($object->isInitialized('accessPointSearch') && null !== $object->getAccessPointSearch()) { - $data['AccessPointSearch'] = $this->normalizer->normalize($object->getAccessPointSearch(), 'json', $context); - } - if ($object->isInitialized('openTimeCriteria') && null !== $object->getOpenTimeCriteria()) { - $data['OpenTimeCriteria'] = $this->normalizer->normalize($object->getOpenTimeCriteria(), 'json', $context); + if (\array_key_exists('SearchOption', $data)) { + $values = []; + foreach ($data['SearchOption'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class, 'json', $context); } - if ($object->isInitialized('brexitFilter') && null !== $object->getBrexitFilter()) { - $data['BrexitFilter'] = $object->getBrexitFilter(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setSearchOption($values); + unset($data['SearchOption']); + } + if (\array_key_exists('MaximumListSize', $data)) { + $object->setMaximumListSize($data['MaximumListSize']); + unset($data['MaximumListSize']); + } + if (\array_key_exists('SearchRadius', $data)) { + $object->setSearchRadius($data['SearchRadius']); + unset($data['SearchRadius']); + } + if (\array_key_exists('ServiceSearch', $data)) { + $object->setServiceSearch($this->denormalizer->denormalize($data['ServiceSearch'], \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class, 'json', $context)); + unset($data['ServiceSearch']); + } + if (\array_key_exists('FreightWillCallSearch', $data)) { + $object->setFreightWillCallSearch($this->denormalizer->denormalize($data['FreightWillCallSearch'], \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class, 'json', $context)); + unset($data['FreightWillCallSearch']); + } + if (\array_key_exists('AccessPointSearch', $data)) { + $object->setAccessPointSearch($this->denormalizer->denormalize($data['AccessPointSearch'], \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class, 'json', $context)); + unset($data['AccessPointSearch']); + } + if (\array_key_exists('OpenTimeCriteria', $data)) { + $object->setOpenTimeCriteria($this->denormalizer->denormalize($data['OpenTimeCriteria'], \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class, 'json', $context)); + unset($data['OpenTimeCriteria']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class => false]; + if (\array_key_exists('BrexitFilter', $data)) { + $object->setBrexitFilter($data['BrexitFilter']); + unset($data['BrexitFilter']); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class LocatorRequestLocationSearchCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SearchOption', $data)) { - $values = []; - foreach ($data['SearchOption'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\LocationSearchCriteriaSearchOption::class, 'json', $context); - } - $object->setSearchOption($values); - unset($data['SearchOption']); - } - if (\array_key_exists('MaximumListSize', $data)) { - $object->setMaximumListSize($data['MaximumListSize']); - unset($data['MaximumListSize']); - } - if (\array_key_exists('SearchRadius', $data)) { - $object->setSearchRadius($data['SearchRadius']); - unset($data['SearchRadius']); - } - if (\array_key_exists('ServiceSearch', $data)) { - $object->setServiceSearch($this->denormalizer->denormalize($data['ServiceSearch'], \ShipStream\Ups\Api\Model\LocationSearchCriteriaServiceSearch::class, 'json', $context)); - unset($data['ServiceSearch']); + $dataArray = []; + if ($data->isInitialized('searchOption') && null !== $data->getSearchOption()) { + $values = []; + foreach ($data->getSearchOption() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - if (\array_key_exists('FreightWillCallSearch', $data)) { - $object->setFreightWillCallSearch($this->denormalizer->denormalize($data['FreightWillCallSearch'], \ShipStream\Ups\Api\Model\LocationSearchCriteriaFreightWillCallSearch::class, 'json', $context)); - unset($data['FreightWillCallSearch']); - } - if (\array_key_exists('AccessPointSearch', $data)) { - $object->setAccessPointSearch($this->denormalizer->denormalize($data['AccessPointSearch'], \ShipStream\Ups\Api\Model\LocationSearchCriteriaAccessPointSearch::class, 'json', $context)); - unset($data['AccessPointSearch']); - } - if (\array_key_exists('OpenTimeCriteria', $data)) { - $object->setOpenTimeCriteria($this->denormalizer->denormalize($data['OpenTimeCriteria'], \ShipStream\Ups\Api\Model\LocationSearchCriteriaOpenTimeCriteria::class, 'json', $context)); - unset($data['OpenTimeCriteria']); - } - if (\array_key_exists('BrexitFilter', $data)) { - $object->setBrexitFilter($data['BrexitFilter']); - unset($data['BrexitFilter']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray['SearchOption'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('searchOption') && null !== $object->getSearchOption()) { - $values = []; - foreach ($object->getSearchOption() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['SearchOption'] = $values; - } - if ($object->isInitialized('maximumListSize') && null !== $object->getMaximumListSize()) { - $data['MaximumListSize'] = $object->getMaximumListSize(); - } - if ($object->isInitialized('searchRadius') && null !== $object->getSearchRadius()) { - $data['SearchRadius'] = $object->getSearchRadius(); - } - if ($object->isInitialized('serviceSearch') && null !== $object->getServiceSearch()) { - $data['ServiceSearch'] = $this->normalizer->normalize($object->getServiceSearch(), 'json', $context); - } - if ($object->isInitialized('freightWillCallSearch') && null !== $object->getFreightWillCallSearch()) { - $data['FreightWillCallSearch'] = $this->normalizer->normalize($object->getFreightWillCallSearch(), 'json', $context); - } - if ($object->isInitialized('accessPointSearch') && null !== $object->getAccessPointSearch()) { - $data['AccessPointSearch'] = $this->normalizer->normalize($object->getAccessPointSearch(), 'json', $context); - } - if ($object->isInitialized('openTimeCriteria') && null !== $object->getOpenTimeCriteria()) { - $data['OpenTimeCriteria'] = $this->normalizer->normalize($object->getOpenTimeCriteria(), 'json', $context); - } - if ($object->isInitialized('brexitFilter') && null !== $object->getBrexitFilter()) { - $data['BrexitFilter'] = $object->getBrexitFilter(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('maximumListSize') && null !== $data->getMaximumListSize()) { + $dataArray['MaximumListSize'] = $data->getMaximumListSize(); + } + if ($data->isInitialized('searchRadius') && null !== $data->getSearchRadius()) { + $dataArray['SearchRadius'] = $data->getSearchRadius(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class => false]; + if ($data->isInitialized('serviceSearch') && null !== $data->getServiceSearch()) { + $dataArray['ServiceSearch'] = $this->normalizer->normalize($data->getServiceSearch(), 'json', $context); } + if ($data->isInitialized('freightWillCallSearch') && null !== $data->getFreightWillCallSearch()) { + $dataArray['FreightWillCallSearch'] = $this->normalizer->normalize($data->getFreightWillCallSearch(), 'json', $context); + } + if ($data->isInitialized('accessPointSearch') && null !== $data->getAccessPointSearch()) { + $dataArray['AccessPointSearch'] = $this->normalizer->normalize($data->getAccessPointSearch(), 'json', $context); + } + if ($data->isInitialized('openTimeCriteria') && null !== $data->getOpenTimeCriteria()) { + $dataArray['OpenTimeCriteria'] = $this->normalizer->normalize($data->getOpenTimeCriteria(), 'json', $context); + } + if ($data->isInitialized('brexitFilter') && null !== $data->getBrexitFilter()) { + $dataArray['BrexitFilter'] = $data->getBrexitFilter(); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocatorRequestNormalizer.php b/src/Api/Normalizer/LocatorRequestNormalizer.php index 7ba3120f..1bb8a037 100644 --- a/src/Api/Normalizer/LocatorRequestNormalizer.php +++ b/src/Api/Normalizer/LocatorRequestNormalizer.php @@ -5,274 +5,136 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocatorRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocatorRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequest::class; + return $type === \ShipStream\Ups\Api\Model\LocatorRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\LocatorRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('OriginAddress', $data)) { - $object->setOriginAddress($this->denormalizer->denormalize($data['OriginAddress'], \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class, 'json', $context)); - unset($data['OriginAddress']); - } - if (\array_key_exists('Translate', $data)) { - $object->setTranslate($this->denormalizer->denormalize($data['Translate'], \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class, 'json', $context)); - unset($data['Translate']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('LocationID', $data)) { - $values = []; - foreach ($data['LocationID'] as $value) { - $values[] = $value; - } - $object->setLocationID($values); - unset($data['LocationID']); - } - if (\array_key_exists('LocationSearchCriteria', $data)) { - $object->setLocationSearchCriteria($this->denormalizer->denormalize($data['LocationSearchCriteria'], \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class, 'json', $context)); - unset($data['LocationSearchCriteria']); - } - if (\array_key_exists('SortCriteria', $data)) { - $object->setSortCriteria($this->denormalizer->denormalize($data['SortCriteria'], \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class, 'json', $context)); - unset($data['SortCriteria']); - } - if (\array_key_exists('AllowAllConfidenceLevels', $data)) { - $object->setAllowAllConfidenceLevels($data['AllowAllConfidenceLevels']); - unset($data['AllowAllConfidenceLevels']); - } - if (\array_key_exists('SearchOptionCode', $data)) { - $object->setSearchOptionCode($data['SearchOptionCode']); - unset($data['SearchOptionCode']); - } - if (\array_key_exists('ServiceGeoUnit', $data)) { - $object->setServiceGeoUnit($this->denormalizer->denormalize($data['ServiceGeoUnit'], \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class, 'json', $context)); - unset($data['ServiceGeoUnit']); - } - if (\array_key_exists('FreightIndicator', $data)) { - $object->setFreightIndicator($data['FreightIndicator']); - unset($data['FreightIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\LocatorRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['OriginAddress'] = $this->normalizer->normalize($object->getOriginAddress(), 'json', $context); - $data['Translate'] = $this->normalizer->normalize($object->getTranslate(), 'json', $context); - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - } - if ($object->isInitialized('locationID') && null !== $object->getLocationID()) { - $values = []; - foreach ($object->getLocationID() as $value) { - $values[] = $value; - } - $data['LocationID'] = $values; - } - if ($object->isInitialized('locationSearchCriteria') && null !== $object->getLocationSearchCriteria()) { - $data['LocationSearchCriteria'] = $this->normalizer->normalize($object->getLocationSearchCriteria(), 'json', $context); - } - if ($object->isInitialized('sortCriteria') && null !== $object->getSortCriteria()) { - $data['SortCriteria'] = $this->normalizer->normalize($object->getSortCriteria(), 'json', $context); - } - if ($object->isInitialized('allowAllConfidenceLevels') && null !== $object->getAllowAllConfidenceLevels()) { - $data['AllowAllConfidenceLevels'] = $object->getAllowAllConfidenceLevels(); - } - if ($object->isInitialized('searchOptionCode') && null !== $object->getSearchOptionCode()) { - $data['SearchOptionCode'] = $object->getSearchOptionCode(); - } - if ($object->isInitialized('serviceGeoUnit') && null !== $object->getServiceGeoUnit()) { - $data['ServiceGeoUnit'] = $this->normalizer->normalize($object->getServiceGeoUnit(), 'json', $context); - } - if ($object->isInitialized('freightIndicator') && null !== $object->getFreightIndicator()) { - $data['FreightIndicator'] = $object->getFreightIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\LocatorRequestRequest::class, 'json', $context)); + unset($data['Request']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequest::class => false]; + if (\array_key_exists('OriginAddress', $data)) { + $object->setOriginAddress($this->denormalizer->denormalize($data['OriginAddress'], \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class, 'json', $context)); + unset($data['OriginAddress']); } - } -} else { - class LocatorRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequest::class; + if (\array_key_exists('Translate', $data)) { + $object->setTranslate($this->denormalizer->denormalize($data['Translate'], \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class, 'json', $context)); + unset($data['Translate']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequest::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\LocatorRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('OriginAddress', $data)) { - $object->setOriginAddress($this->denormalizer->denormalize($data['OriginAddress'], \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class, 'json', $context)); - unset($data['OriginAddress']); - } - if (\array_key_exists('Translate', $data)) { - $object->setTranslate($this->denormalizer->denormalize($data['Translate'], \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class, 'json', $context)); - unset($data['Translate']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); + if (\array_key_exists('LocationID', $data)) { + $values = []; + foreach ($data['LocationID'] as $value) { + $values[] = $value; } - if (\array_key_exists('LocationID', $data)) { - $values = []; - foreach ($data['LocationID'] as $value) { - $values[] = $value; - } - $object->setLocationID($values); - unset($data['LocationID']); - } - if (\array_key_exists('LocationSearchCriteria', $data)) { - $object->setLocationSearchCriteria($this->denormalizer->denormalize($data['LocationSearchCriteria'], \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class, 'json', $context)); - unset($data['LocationSearchCriteria']); - } - if (\array_key_exists('SortCriteria', $data)) { - $object->setSortCriteria($this->denormalizer->denormalize($data['SortCriteria'], \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class, 'json', $context)); - unset($data['SortCriteria']); - } - if (\array_key_exists('AllowAllConfidenceLevels', $data)) { - $object->setAllowAllConfidenceLevels($data['AllowAllConfidenceLevels']); - unset($data['AllowAllConfidenceLevels']); - } - if (\array_key_exists('SearchOptionCode', $data)) { - $object->setSearchOptionCode($data['SearchOptionCode']); - unset($data['SearchOptionCode']); - } - if (\array_key_exists('ServiceGeoUnit', $data)) { - $object->setServiceGeoUnit($this->denormalizer->denormalize($data['ServiceGeoUnit'], \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class, 'json', $context)); - unset($data['ServiceGeoUnit']); - } - if (\array_key_exists('FreightIndicator', $data)) { - $object->setFreightIndicator($data['FreightIndicator']); - unset($data['FreightIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $object->setLocationID($values); + unset($data['LocationID']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['OriginAddress'] = $this->normalizer->normalize($object->getOriginAddress(), 'json', $context); - $data['Translate'] = $this->normalizer->normalize($object->getTranslate(), 'json', $context); - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - } - if ($object->isInitialized('locationID') && null !== $object->getLocationID()) { - $values = []; - foreach ($object->getLocationID() as $value) { - $values[] = $value; - } - $data['LocationID'] = $values; - } - if ($object->isInitialized('locationSearchCriteria') && null !== $object->getLocationSearchCriteria()) { - $data['LocationSearchCriteria'] = $this->normalizer->normalize($object->getLocationSearchCriteria(), 'json', $context); - } - if ($object->isInitialized('sortCriteria') && null !== $object->getSortCriteria()) { - $data['SortCriteria'] = $this->normalizer->normalize($object->getSortCriteria(), 'json', $context); - } - if ($object->isInitialized('allowAllConfidenceLevels') && null !== $object->getAllowAllConfidenceLevels()) { - $data['AllowAllConfidenceLevels'] = $object->getAllowAllConfidenceLevels(); - } - if ($object->isInitialized('searchOptionCode') && null !== $object->getSearchOptionCode()) { - $data['SearchOptionCode'] = $object->getSearchOptionCode(); - } - if ($object->isInitialized('serviceGeoUnit') && null !== $object->getServiceGeoUnit()) { - $data['ServiceGeoUnit'] = $this->normalizer->normalize($object->getServiceGeoUnit(), 'json', $context); - } - if ($object->isInitialized('freightIndicator') && null !== $object->getFreightIndicator()) { - $data['FreightIndicator'] = $object->getFreightIndicator(); + if (\array_key_exists('LocationSearchCriteria', $data)) { + $object->setLocationSearchCriteria($this->denormalizer->denormalize($data['LocationSearchCriteria'], \ShipStream\Ups\Api\Model\LocatorRequestLocationSearchCriteria::class, 'json', $context)); + unset($data['LocationSearchCriteria']); + } + if (\array_key_exists('SortCriteria', $data)) { + $object->setSortCriteria($this->denormalizer->denormalize($data['SortCriteria'], \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class, 'json', $context)); + unset($data['SortCriteria']); + } + if (\array_key_exists('AllowAllConfidenceLevels', $data)) { + $object->setAllowAllConfidenceLevels($data['AllowAllConfidenceLevels']); + unset($data['AllowAllConfidenceLevels']); + } + if (\array_key_exists('SearchOptionCode', $data)) { + $object->setSearchOptionCode($data['SearchOptionCode']); + unset($data['SearchOptionCode']); + } + if (\array_key_exists('ServiceGeoUnit', $data)) { + $object->setServiceGeoUnit($this->denormalizer->denormalize($data['ServiceGeoUnit'], \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class, 'json', $context)); + unset($data['ServiceGeoUnit']); + } + if (\array_key_exists('FreightIndicator', $data)) { + $object->setFreightIndicator($data['FreightIndicator']); + unset($data['FreightIndicator']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['OriginAddress'] = $this->normalizer->normalize($data->getOriginAddress(), 'json', $context); + $dataArray['Translate'] = $this->normalizer->normalize($data->getTranslate(), 'json', $context); + if ($data->isInitialized('unitOfMeasurement') && null !== $data->getUnitOfMeasurement()) { + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + } + if ($data->isInitialized('locationID') && null !== $data->getLocationID()) { + $values = []; + foreach ($data->getLocationID() as $value) { + $values[] = $value; } - return $data; + $dataArray['LocationID'] = $values; + } + if ($data->isInitialized('locationSearchCriteria') && null !== $data->getLocationSearchCriteria()) { + $dataArray['LocationSearchCriteria'] = $this->normalizer->normalize($data->getLocationSearchCriteria(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequest::class => false]; + if ($data->isInitialized('sortCriteria') && null !== $data->getSortCriteria()) { + $dataArray['SortCriteria'] = $this->normalizer->normalize($data->getSortCriteria(), 'json', $context); } + if ($data->isInitialized('allowAllConfidenceLevels') && null !== $data->getAllowAllConfidenceLevels()) { + $dataArray['AllowAllConfidenceLevels'] = $data->getAllowAllConfidenceLevels(); + } + if ($data->isInitialized('searchOptionCode') && null !== $data->getSearchOptionCode()) { + $dataArray['SearchOptionCode'] = $data->getSearchOptionCode(); + } + if ($data->isInitialized('serviceGeoUnit') && null !== $data->getServiceGeoUnit()) { + $dataArray['ServiceGeoUnit'] = $this->normalizer->normalize($data->getServiceGeoUnit(), 'json', $context); + } + if ($data->isInitialized('freightIndicator') && null !== $data->getFreightIndicator()) { + $dataArray['FreightIndicator'] = $data->getFreightIndicator(); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocatorRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocatorRequestOriginAddressNormalizer.php b/src/Api/Normalizer/LocatorRequestOriginAddressNormalizer.php index 095a6ad8..4e6faed6 100644 --- a/src/Api/Normalizer/LocatorRequestOriginAddressNormalizer.php +++ b/src/Api/Normalizer/LocatorRequestOriginAddressNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocatorRequestOriginAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocatorRequestOriginAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class; + return $type === \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Geocode', $data)) { - $object->setGeocode($this->denormalizer->denormalize($data['Geocode'], \ShipStream\Ups\Api\Model\OriginAddressGeocode::class, 'json', $context)); - unset($data['Geocode']); - } - if (\array_key_exists('AddressKeyFormat', $data)) { - $object->setAddressKeyFormat($this->denormalizer->denormalize($data['AddressKeyFormat'], \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class, 'json', $context)); - unset($data['AddressKeyFormat']); - } - if (\array_key_exists('MaximumListSize', $data)) { - $object->setMaximumListSize($data['MaximumListSize']); - unset($data['MaximumListSize']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('geocode') && null !== $object->getGeocode()) { - $data['Geocode'] = $this->normalizer->normalize($object->getGeocode(), 'json', $context); - } - $data['AddressKeyFormat'] = $this->normalizer->normalize($object->getAddressKeyFormat(), 'json', $context); - if ($object->isInitialized('maximumListSize') && null !== $object->getMaximumListSize()) { - $data['MaximumListSize'] = $object->getMaximumListSize(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Geocode', $data)) { + $object->setGeocode($this->denormalizer->denormalize($data['Geocode'], \ShipStream\Ups\Api\Model\OriginAddressGeocode::class, 'json', $context)); + unset($data['Geocode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class => false]; + if (\array_key_exists('AddressKeyFormat', $data)) { + $object->setAddressKeyFormat($this->denormalizer->denormalize($data['AddressKeyFormat'], \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class, 'json', $context)); + unset($data['AddressKeyFormat']); } + if (\array_key_exists('MaximumListSize', $data)) { + $object->setMaximumListSize($data['MaximumListSize']); + unset($data['MaximumListSize']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LocatorRequestOriginAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class; + $dataArray = []; + if ($data->isInitialized('geocode') && null !== $data->getGeocode()) { + $dataArray['Geocode'] = $this->normalizer->normalize($data->getGeocode(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class; + $dataArray['AddressKeyFormat'] = $this->normalizer->normalize($data->getAddressKeyFormat(), 'json', $context); + if ($data->isInitialized('maximumListSize') && null !== $data->getMaximumListSize()) { + $dataArray['MaximumListSize'] = $data->getMaximumListSize(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestOriginAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Geocode', $data)) { - $object->setGeocode($this->denormalizer->denormalize($data['Geocode'], \ShipStream\Ups\Api\Model\OriginAddressGeocode::class, 'json', $context)); - unset($data['Geocode']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('AddressKeyFormat', $data)) { - $object->setAddressKeyFormat($this->denormalizer->denormalize($data['AddressKeyFormat'], \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class, 'json', $context)); - unset($data['AddressKeyFormat']); - } - if (\array_key_exists('MaximumListSize', $data)) { - $object->setMaximumListSize($data['MaximumListSize']); - unset($data['MaximumListSize']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('geocode') && null !== $object->getGeocode()) { - $data['Geocode'] = $this->normalizer->normalize($object->getGeocode(), 'json', $context); - } - $data['AddressKeyFormat'] = $this->normalizer->normalize($object->getAddressKeyFormat(), 'json', $context); - if ($object->isInitialized('maximumListSize') && null !== $object->getMaximumListSize()) { - $data['MaximumListSize'] = $object->getMaximumListSize(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocatorRequestOriginAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocatorRequestRequestNormalizer.php b/src/Api/Normalizer/LocatorRequestRequestNormalizer.php index 827533d8..6a6d9ee0 100644 --- a/src/Api/Normalizer/LocatorRequestRequestNormalizer.php +++ b/src/Api/Normalizer/LocatorRequestRequestNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocatorRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocatorRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\LocatorRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - if (\array_key_exists('RequestAction', $data)) { - $object->setRequestAction($data['RequestAction']); - unset($data['RequestAction']); - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LocatorRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - $data['RequestAction'] = $object->getRequestAction(); - $data['RequestOption'] = $object->getRequestOption(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestRequest::class => false]; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - } -} else { - class LocatorRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestRequest::class; + if (\array_key_exists('RequestAction', $data)) { + $object->setRequestAction($data['RequestAction']); + unset($data['RequestAction']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestRequest::class; + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('RequestAction', $data)) { - $object->setRequestAction($data['RequestAction']); - unset($data['RequestAction']); - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - $data['RequestAction'] = $object->getRequestAction(); - $data['RequestOption'] = $object->getRequestOption(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestRequest::class => false]; + $dataArray['RequestAction'] = $data->getRequestAction(); + $dataArray['RequestOption'] = $data->getRequestOption(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocatorRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocatorRequestServiceGeoUnitNormalizer.php b/src/Api/Normalizer/LocatorRequestServiceGeoUnitNormalizer.php index f8bac78a..a70d0d6a 100644 --- a/src/Api/Normalizer/LocatorRequestServiceGeoUnitNormalizer.php +++ b/src/Api/Normalizer/LocatorRequestServiceGeoUnitNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocatorRequestServiceGeoUnitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocatorRequestServiceGeoUnitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class; + return $type === \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ServiceCode', $data)) { - $object->setServiceCode($data['ServiceCode']); - unset($data['ServiceCode']); - } - if (\array_key_exists('GeoPoliticalUnit', $data)) { - $object->setGeoPoliticalUnit($data['GeoPoliticalUnit']); - unset($data['GeoPoliticalUnit']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ServiceCode'] = $object->getServiceCode(); - $data['GeoPoliticalUnit'] = $object->getGeoPoliticalUnit(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class => false]; - } - } -} else { - class LocatorRequestServiceGeoUnitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class; + if (\array_key_exists('ServiceCode', $data)) { + $object->setServiceCode($data['ServiceCode']); + unset($data['ServiceCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class; + if (\array_key_exists('GeoPoliticalUnit', $data)) { + $object->setGeoPoliticalUnit($data['GeoPoliticalUnit']); + unset($data['GeoPoliticalUnit']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ServiceCode', $data)) { - $object->setServiceCode($data['ServiceCode']); - unset($data['ServiceCode']); - } - if (\array_key_exists('GeoPoliticalUnit', $data)) { - $object->setGeoPoliticalUnit($data['GeoPoliticalUnit']); - unset($data['GeoPoliticalUnit']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ServiceCode'] = $object->getServiceCode(); - $data['GeoPoliticalUnit'] = $object->getGeoPoliticalUnit(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ServiceCode'] = $data->getServiceCode(); + $dataArray['GeoPoliticalUnit'] = $data->getGeoPoliticalUnit(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocatorRequestServiceGeoUnit::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocatorRequestSortCriteriaNormalizer.php b/src/Api/Normalizer/LocatorRequestSortCriteriaNormalizer.php index 6a99f165..1cc7d025 100644 --- a/src/Api/Normalizer/LocatorRequestSortCriteriaNormalizer.php +++ b/src/Api/Normalizer/LocatorRequestSortCriteriaNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocatorRequestSortCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocatorRequestSortCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class; + return $type === \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SortType', $data)) { - $object->setSortType($data['SortType']); - unset($data['SortType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('sortType') && null !== $object->getSortType()) { - $data['SortType'] = $object->getSortType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('SortType', $data)) { + $object->setSortType($data['SortType']); + unset($data['SortType']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LocatorRequestSortCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class; + $dataArray = []; + if ($data->isInitialized('sortType') && null !== $data->getSortType()) { + $dataArray['SortType'] = $data->getSortType(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestSortCriteria(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SortType', $data)) { - $object->setSortType($data['SortType']); - unset($data['SortType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('sortType') && null !== $object->getSortType()) { - $data['SortType'] = $object->getSortType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocatorRequestSortCriteria::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocatorRequestTranslateNormalizer.php b/src/Api/Normalizer/LocatorRequestTranslateNormalizer.php index 11a7c051..19c4d5c1 100644 --- a/src/Api/Normalizer/LocatorRequestTranslateNormalizer.php +++ b/src/Api/Normalizer/LocatorRequestTranslateNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocatorRequestTranslateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocatorRequestTranslateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class; + return $type === \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestTranslate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LocatorRequestTranslate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('locale') && null !== $object->getLocale()) { - $data['Locale'] = $object->getLocale(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Locale', $data)) { + $object->setLocale($data['Locale']); + unset($data['Locale']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestTranslate::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LocatorRequestTranslateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class; + $dataArray = []; + if ($data->isInitialized('locale') && null !== $data->getLocale()) { + $dataArray['Locale'] = $data->getLocale(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestTranslate::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestTranslate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('locale') && null !== $object->getLocale()) { - $data['Locale'] = $object->getLocale(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestTranslate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocatorRequestTranslate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocatorRequestUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/LocatorRequestUnitOfMeasurementNormalizer.php index f2437c10..c7c7a7a0 100644 --- a/src/Api/Normalizer/LocatorRequestUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/LocatorRequestUnitOfMeasurementNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocatorRequestUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocatorRequestUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class LocatorRequestUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocatorRequestUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocatorResponseGeocodeNormalizer.php b/src/Api/Normalizer/LocatorResponseGeocodeNormalizer.php index 6d517387..6e2e1878 100644 --- a/src/Api/Normalizer/LocatorResponseGeocodeNormalizer.php +++ b/src/Api/Normalizer/LocatorResponseGeocodeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocatorResponseGeocodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocatorResponseGeocodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class; + return $type === \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorResponseGeocode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Latitude', $data)) { - $object->setLatitude($data['Latitude']); - unset($data['Latitude']); - } - if (\array_key_exists('Longitude', $data)) { - $object->setLongitude($data['Longitude']); - unset($data['Longitude']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LocatorResponseGeocode(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Latitude'] = $object->getLatitude(); - $data['Longitude'] = $object->getLongitude(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorResponseGeocode::class => false]; - } - } -} else { - class LocatorResponseGeocodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class; + if (\array_key_exists('Latitude', $data)) { + $object->setLatitude($data['Latitude']); + unset($data['Latitude']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class; + if (\array_key_exists('Longitude', $data)) { + $object->setLongitude($data['Longitude']); + unset($data['Longitude']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorResponseGeocode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Latitude', $data)) { - $object->setLatitude($data['Latitude']); - unset($data['Latitude']); - } - if (\array_key_exists('Longitude', $data)) { - $object->setLongitude($data['Longitude']); - unset($data['Longitude']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Latitude'] = $object->getLatitude(); - $data['Longitude'] = $object->getLongitude(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Latitude'] = $data->getLatitude(); + $dataArray['Longitude'] = $data->getLongitude(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorResponseGeocode::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocatorResponseGeocode::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocatorResponseNormalizer.php b/src/Api/Normalizer/LocatorResponseNormalizer.php index 25d65226..1b771975 100644 --- a/src/Api/Normalizer/LocatorResponseNormalizer.php +++ b/src/Api/Normalizer/LocatorResponseNormalizer.php @@ -5,160 +5,79 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocatorResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocatorResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorResponse::class; + return $type === \ShipStream\Ups\Api\Model\LocatorResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\LocatorResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('Geocode', $data)) { - $object->setGeocode($this->denormalizer->denormalize($data['Geocode'], \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class, 'json', $context)); - unset($data['Geocode']); - } - if (\array_key_exists('SearchResults', $data)) { - $object->setSearchResults($this->denormalizer->denormalize($data['SearchResults'], \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class, 'json', $context)); - unset($data['SearchResults']); - } - if (\array_key_exists('AllowAllConfidenceLevels', $data)) { - $object->setAllowAllConfidenceLevels($data['AllowAllConfidenceLevels']); - unset($data['AllowAllConfidenceLevels']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LocatorResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('geocode') && null !== $object->getGeocode()) { - $data['Geocode'] = $this->normalizer->normalize($object->getGeocode(), 'json', $context); - } - $data['SearchResults'] = $this->normalizer->normalize($object->getSearchResults(), 'json', $context); - $data['AllowAllConfidenceLevels'] = $object->getAllowAllConfidenceLevels(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\LocatorResponseResponse::class, 'json', $context)); + unset($data['Response']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorResponse::class => false]; + if (\array_key_exists('Geocode', $data)) { + $object->setGeocode($this->denormalizer->denormalize($data['Geocode'], \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class, 'json', $context)); + unset($data['Geocode']); } - } -} else { - class LocatorResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorResponse::class; + if (\array_key_exists('SearchResults', $data)) { + $object->setSearchResults($this->denormalizer->denormalize($data['SearchResults'], \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class, 'json', $context)); + unset($data['SearchResults']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorResponse::class; + if (\array_key_exists('AllowAllConfidenceLevels', $data)) { + $object->setAllowAllConfidenceLevels($data['AllowAllConfidenceLevels']); + unset($data['AllowAllConfidenceLevels']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\LocatorResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('Geocode', $data)) { - $object->setGeocode($this->denormalizer->denormalize($data['Geocode'], \ShipStream\Ups\Api\Model\LocatorResponseGeocode::class, 'json', $context)); - unset($data['Geocode']); - } - if (\array_key_exists('SearchResults', $data)) { - $object->setSearchResults($this->denormalizer->denormalize($data['SearchResults'], \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class, 'json', $context)); - unset($data['SearchResults']); - } - if (\array_key_exists('AllowAllConfidenceLevels', $data)) { - $object->setAllowAllConfidenceLevels($data['AllowAllConfidenceLevels']); - unset($data['AllowAllConfidenceLevels']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('geocode') && null !== $object->getGeocode()) { - $data['Geocode'] = $this->normalizer->normalize($object->getGeocode(), 'json', $context); - } - $data['SearchResults'] = $this->normalizer->normalize($object->getSearchResults(), 'json', $context); - $data['AllowAllConfidenceLevels'] = $object->getAllowAllConfidenceLevels(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + if ($data->isInitialized('geocode') && null !== $data->getGeocode()) { + $dataArray['Geocode'] = $this->normalizer->normalize($data->getGeocode(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorResponse::class => false]; + $dataArray['SearchResults'] = $this->normalizer->normalize($data->getSearchResults(), 'json', $context); + $dataArray['AllowAllConfidenceLevels'] = $data->getAllowAllConfidenceLevels(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocatorResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocatorResponseResponseNormalizer.php b/src/Api/Normalizer/LocatorResponseResponseNormalizer.php index 8d8bec4e..ccdf33d0 100644 --- a/src/Api/Normalizer/LocatorResponseResponseNormalizer.php +++ b/src/Api/Normalizer/LocatorResponseResponseNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocatorResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocatorResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\LocatorResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - if (\array_key_exists('ResponseStatusCode', $data)) { - $object->setResponseStatusCode($data['ResponseStatusCode']); - unset($data['ResponseStatusCode']); - } - if (\array_key_exists('ResponseStatusDescription', $data)) { - $object->setResponseStatusDescription($data['ResponseStatusDescription']); - unset($data['ResponseStatusDescription']); - } - if (\array_key_exists('Error', $data)) { - $object->setError($this->denormalizer->denormalize($data['Error'], \ShipStream\Ups\Api\Model\ResponseError::class, 'json', $context)); - unset($data['Error']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\LocatorResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - $data['ResponseStatusCode'] = $object->getResponseStatusCode(); - if ($object->isInitialized('responseStatusDescription') && null !== $object->getResponseStatusDescription()) { - $data['ResponseStatusDescription'] = $object->getResponseStatusDescription(); - } - if ($object->isInitialized('error') && null !== $object->getError()) { - $data['Error'] = $this->normalizer->normalize($object->getError(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + if (\array_key_exists('ResponseStatusCode', $data)) { + $object->setResponseStatusCode($data['ResponseStatusCode']); + unset($data['ResponseStatusCode']); + } + if (\array_key_exists('ResponseStatusDescription', $data)) { + $object->setResponseStatusDescription($data['ResponseStatusDescription']); + unset($data['ResponseStatusDescription']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorResponseResponse::class => false]; + if (\array_key_exists('Error', $data)) { + $object->setError($this->denormalizer->denormalize($data['Error'], \ShipStream\Ups\Api\Model\ResponseError::class, 'json', $context)); + unset($data['Error']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class LocatorResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorResponseResponse::class; + $dataArray = []; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorResponseResponse::class; + $dataArray['ResponseStatusCode'] = $data->getResponseStatusCode(); + if ($data->isInitialized('responseStatusDescription') && null !== $data->getResponseStatusDescription()) { + $dataArray['ResponseStatusDescription'] = $data->getResponseStatusDescription(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - if (\array_key_exists('ResponseStatusCode', $data)) { - $object->setResponseStatusCode($data['ResponseStatusCode']); - unset($data['ResponseStatusCode']); - } - if (\array_key_exists('ResponseStatusDescription', $data)) { - $object->setResponseStatusDescription($data['ResponseStatusDescription']); - unset($data['ResponseStatusDescription']); - } - if (\array_key_exists('Error', $data)) { - $object->setError($this->denormalizer->denormalize($data['Error'], \ShipStream\Ups\Api\Model\ResponseError::class, 'json', $context)); - unset($data['Error']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('error') && null !== $data->getError()) { + $dataArray['Error'] = $this->normalizer->normalize($data->getError(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - $data['ResponseStatusCode'] = $object->getResponseStatusCode(); - if ($object->isInitialized('responseStatusDescription') && null !== $object->getResponseStatusDescription()) { - $data['ResponseStatusDescription'] = $object->getResponseStatusDescription(); - } - if ($object->isInitialized('error') && null !== $object->getError()) { - $data['Error'] = $this->normalizer->normalize($object->getError(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocatorResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/LocatorResponseSearchResultsNormalizer.php b/src/Api/Normalizer/LocatorResponseSearchResultsNormalizer.php index 9caf10aa..327c17a0 100644 --- a/src/Api/Normalizer/LocatorResponseSearchResultsNormalizer.php +++ b/src/Api/Normalizer/LocatorResponseSearchResultsNormalizer.php @@ -5,234 +5,116 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocatorResponseSearchResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class LocatorResponseSearchResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class; + return $type === \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorResponseSearchResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('GeocodeCandidate', $data)) { - $values = []; - foreach ($data['GeocodeCandidate'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class, 'json', $context); - } - $object->setGeocodeCandidate($values); - unset($data['GeocodeCandidate']); - } - if (\array_key_exists('Disclaimer', $data)) { - $object->setDisclaimer($data['Disclaimer']); - unset($data['Disclaimer']); - } - if (\array_key_exists('DropLocation', $data)) { - $values_1 = []; - foreach ($data['DropLocation'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class, 'json', $context); - } - $object->setDropLocation($values_1); - unset($data['DropLocation']); - } - if (\array_key_exists('AvailableLocationAttributes', $data)) { - $values_2 = []; - foreach ($data['AvailableLocationAttributes'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class, 'json', $context); - } - $object->setAvailableLocationAttributes($values_2); - unset($data['AvailableLocationAttributes']); - } - if (\array_key_exists('ActiveAvailableAccessPointIndicator', $data)) { - $object->setActiveAvailableAccessPointIndicator($data['ActiveAvailableAccessPointIndicator']); - unset($data['ActiveAvailableAccessPointIndicator']); - } - foreach ($data as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_3; - } - } + $object = new \ShipStream\Ups\Api\Model\LocatorResponseSearchResults(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('geocodeCandidate') && null !== $object->getGeocodeCandidate()) { - $values = []; - foreach ($object->getGeocodeCandidate() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['GeocodeCandidate'] = $values; - } - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $data['Disclaimer'] = $object->getDisclaimer(); - } - if ($object->isInitialized('dropLocation') && null !== $object->getDropLocation()) { - $values_1 = []; - foreach ($object->getDropLocation() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['DropLocation'] = $values_1; + if (\array_key_exists('GeocodeCandidate', $data)) { + $values = []; + foreach ($data['GeocodeCandidate'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class, 'json', $context); } - if ($object->isInitialized('availableLocationAttributes') && null !== $object->getAvailableLocationAttributes()) { - $values_2 = []; - foreach ($object->getAvailableLocationAttributes() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['AvailableLocationAttributes'] = $values_2; - } - if ($object->isInitialized('activeAvailableAccessPointIndicator') && null !== $object->getActiveAvailableAccessPointIndicator()) { - $data['ActiveAvailableAccessPointIndicator'] = $object->getActiveAvailableAccessPointIndicator(); + $object->setGeocodeCandidate($values); + unset($data['GeocodeCandidate']); + } + if (\array_key_exists('Disclaimer', $data)) { + $object->setDisclaimer($data['Disclaimer']); + unset($data['Disclaimer']); + } + if (\array_key_exists('DropLocation', $data)) { + $values_1 = []; + foreach ($data['DropLocation'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class, 'json', $context); } - foreach ($object as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_3; - } + $object->setDropLocation($values_1); + unset($data['DropLocation']); + } + if (\array_key_exists('AvailableLocationAttributes', $data)) { + $values_2 = []; + foreach ($data['AvailableLocationAttributes'] as $value_2) { + $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class, 'json', $context); } - return $data; + $object->setAvailableLocationAttributes($values_2); + unset($data['AvailableLocationAttributes']); + } + if (\array_key_exists('ActiveAvailableAccessPointIndicator', $data)) { + $object->setActiveAvailableAccessPointIndicator($data['ActiveAvailableAccessPointIndicator']); + unset($data['ActiveAvailableAccessPointIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class => false]; + foreach ($data as $key => $value_3) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_3; + } } + return $object; } -} else { - class LocatorResponseSearchResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class; + $dataArray = []; + if ($data->isInitialized('geocodeCandidate') && null !== $data->getGeocodeCandidate()) { + $values = []; + foreach ($data->getGeocodeCandidate() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['GeocodeCandidate'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class; + if ($data->isInitialized('disclaimer') && null !== $data->getDisclaimer()) { + $dataArray['Disclaimer'] = $data->getDisclaimer(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\LocatorResponseSearchResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('GeocodeCandidate', $data)) { - $values = []; - foreach ($data['GeocodeCandidate'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class, 'json', $context); - } - $object->setGeocodeCandidate($values); - unset($data['GeocodeCandidate']); - } - if (\array_key_exists('Disclaimer', $data)) { - $object->setDisclaimer($data['Disclaimer']); - unset($data['Disclaimer']); - } - if (\array_key_exists('DropLocation', $data)) { - $values_1 = []; - foreach ($data['DropLocation'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class, 'json', $context); - } - $object->setDropLocation($values_1); - unset($data['DropLocation']); - } - if (\array_key_exists('AvailableLocationAttributes', $data)) { - $values_2 = []; - foreach ($data['AvailableLocationAttributes'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class, 'json', $context); - } - $object->setAvailableLocationAttributes($values_2); - unset($data['AvailableLocationAttributes']); - } - if (\array_key_exists('ActiveAvailableAccessPointIndicator', $data)) { - $object->setActiveAvailableAccessPointIndicator($data['ActiveAvailableAccessPointIndicator']); - unset($data['ActiveAvailableAccessPointIndicator']); - } - foreach ($data as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_3; - } + if ($data->isInitialized('dropLocation') && null !== $data->getDropLocation()) { + $values_1 = []; + foreach ($data->getDropLocation() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $object; + $dataArray['DropLocation'] = $values_1; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('geocodeCandidate') && null !== $object->getGeocodeCandidate()) { - $values = []; - foreach ($object->getGeocodeCandidate() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['GeocodeCandidate'] = $values; - } - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $data['Disclaimer'] = $object->getDisclaimer(); - } - if ($object->isInitialized('dropLocation') && null !== $object->getDropLocation()) { - $values_1 = []; - foreach ($object->getDropLocation() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['DropLocation'] = $values_1; - } - if ($object->isInitialized('availableLocationAttributes') && null !== $object->getAvailableLocationAttributes()) { - $values_2 = []; - foreach ($object->getAvailableLocationAttributes() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['AvailableLocationAttributes'] = $values_2; - } - if ($object->isInitialized('activeAvailableAccessPointIndicator') && null !== $object->getActiveAvailableAccessPointIndicator()) { - $data['ActiveAvailableAccessPointIndicator'] = $object->getActiveAvailableAccessPointIndicator(); + if ($data->isInitialized('availableLocationAttributes') && null !== $data->getAvailableLocationAttributes()) { + $values_2 = []; + foreach ($data->getAvailableLocationAttributes() as $value_2) { + $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); } - foreach ($object as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_3; - } - } - return $data; + $dataArray['AvailableLocationAttributes'] = $values_2; + } + if ($data->isInitialized('activeAvailableAccessPointIndicator') && null !== $data->getActiveAvailableAccessPointIndicator()) { + $dataArray['ActiveAvailableAccessPointIndicator'] = $data->getActiveAvailableAccessPointIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class => false]; + foreach ($data as $key => $value_3) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_3; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\LocatorResponseSearchResults::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/MailInnovationsLabelImageLabelImageFormatNormalizer.php b/src/Api/Normalizer/MailInnovationsLabelImageLabelImageFormatNormalizer.php index ede2970a..144d4aff 100644 --- a/src/Api/Normalizer/MailInnovationsLabelImageLabelImageFormatNormalizer.php +++ b/src/Api/Normalizer/MailInnovationsLabelImageLabelImageFormatNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class MailInnovationsLabelImageLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class MailInnovationsLabelImageLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class MailInnovationsLabelImageLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\MailInnovationsLabelImageLabelImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestBillToAccountNormalizer.php b/src/Api/Normalizer/ManifestBillToAccountNormalizer.php index 0666d8b7..4463eebf 100644 --- a/src/Api/Normalizer/ManifestBillToAccountNormalizer.php +++ b/src/Api/Normalizer/ManifestBillToAccountNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestBillToAccount::class; + return $type === \ShipStream\Ups\Api\Model\ManifestBillToAccount::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestBillToAccount::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestBillToAccount::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestBillToAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ManifestBillToAccount(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Option'] = $object->getOption(); - $data['Number'] = $object->getNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestBillToAccount::class => false]; - } - } -} else { - class ManifestBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestBillToAccount::class; + if (\array_key_exists('Option', $data)) { + $object->setOption($data['Option']); + unset($data['Option']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestBillToAccount::class; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestBillToAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Option'] = $object->getOption(); - $data['Number'] = $object->getNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Option'] = $data->getOption(); + $dataArray['Number'] = $data->getNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestBillToAccount::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestBillToAccount::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestCustomsValueNormalizer.php b/src/Api/Normalizer/ManifestCustomsValueNormalizer.php index a53f0a64..56ec034f 100644 --- a/src/Api/Normalizer/ManifestCustomsValueNormalizer.php +++ b/src/Api/Normalizer/ManifestCustomsValueNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestCustomsValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestCustomsValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestCustomsValue::class; + return $type === \ShipStream\Ups\Api\Model\ManifestCustomsValue::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestCustomsValue::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestCustomsValue::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestCustomsValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ManifestCustomsValue(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestCustomsValue::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ManifestCustomsValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestCustomsValue::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestCustomsValue::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestCustomsValue(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestCustomsValue::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestCustomsValue::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestPackageDimensionsNormalizer.php b/src/Api/Normalizer/ManifestPackageDimensionsNormalizer.php index e48c87b4..3a7424f5 100644 --- a/src/Api/Normalizer/ManifestPackageDimensionsNormalizer.php +++ b/src/Api/Normalizer/ManifestPackageDimensionsNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestPackageDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestPackageDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class; + return $type === \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestPackageDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ManifestPackageDimensions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['Height'] = $object->getHeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Length', $data)) { + $object->setLength($data['Length']); + unset($data['Length']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestPackageDimensions::class => false]; + if (\array_key_exists('Width', $data)) { + $object->setWidth($data['Width']); + unset($data['Width']); } - } -} else { - class ManifestPackageDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class; + if (\array_key_exists('Height', $data)) { + $object->setHeight($data['Height']); + unset($data['Height']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestPackageDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['Height'] = $object->getHeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Length'] = $data->getLength(); + $dataArray['Width'] = $data->getWidth(); + $dataArray['Height'] = $data->getHeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestPackageDimensions::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestPackageDimensions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestPackageNormalizer.php b/src/Api/Normalizer/ManifestPackageNormalizer.php index b20b7b54..c925ace0 100644 --- a/src/Api/Normalizer/ManifestPackageNormalizer.php +++ b/src/Api/Normalizer/ManifestPackageNormalizer.php @@ -5,288 +5,143 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestPackage::class; + return $type === \ShipStream\Ups\Api\Model\ManifestPackage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestPackage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Activity', $data)) { - $values = []; - foreach ($data['Activity'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageActivity::class, 'json', $context); - } - $object->setActivity($values); - unset($data['Activity']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('DimensionalWeight', $data)) { - $object->setDimensionalWeight($this->denormalizer->denormalize($data['DimensionalWeight'], \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class, 'json', $context)); - unset($data['DimensionalWeight']); - } - if (\array_key_exists('PackageWeight', $data)) { - $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class, 'json', $context)); - unset($data['PackageWeight']); - } - if (\array_key_exists('LargePackage', $data)) { - $object->setLargePackage($data['LargePackage']); - unset($data['LargePackage']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $values_1 = []; - foreach ($data['ReferenceNumber'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class, 'json', $context); - } - $object->setReferenceNumber($values_1); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('PackageServiceOptions', $data)) { - $object->setPackageServiceOptions($this->denormalizer->denormalize($data['PackageServiceOptions'], \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class, 'json', $context)); - unset($data['PackageServiceOptions']); - } - if (\array_key_exists('UPSPremiumCareIndicator', $data)) { - $object->setUPSPremiumCareIndicator($data['UPSPremiumCareIndicator']); - unset($data['UPSPremiumCareIndicator']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\ManifestPackage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('activity') && null !== $object->getActivity()) { - $values = []; - foreach ($object->getActivity() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Activity'] = $values; + if (\array_key_exists('Activity', $data)) { + $values = []; + foreach ($data['Activity'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageActivity::class, 'json', $context); } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - if ($object->isInitialized('dimensionalWeight') && null !== $object->getDimensionalWeight()) { - $data['DimensionalWeight'] = $this->normalizer->normalize($object->getDimensionalWeight(), 'json', $context); - } - if ($object->isInitialized('packageWeight') && null !== $object->getPackageWeight()) { - $data['PackageWeight'] = $this->normalizer->normalize($object->getPackageWeight(), 'json', $context); - } - if ($object->isInitialized('largePackage') && null !== $object->getLargePackage()) { - $data['LargePackage'] = $object->getLargePackage(); - } - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $data['TrackingNumber'] = $object->getTrackingNumber(); - } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $values_1 = []; - foreach ($object->getReferenceNumber() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ReferenceNumber'] = $values_1; - } - if ($object->isInitialized('packageServiceOptions') && null !== $object->getPackageServiceOptions()) { - $data['PackageServiceOptions'] = $this->normalizer->normalize($object->getPackageServiceOptions(), 'json', $context); - } - if ($object->isInitialized('uPSPremiumCareIndicator') && null !== $object->getUPSPremiumCareIndicator()) { - $data['UPSPremiumCareIndicator'] = $object->getUPSPremiumCareIndicator(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; + $object->setActivity($values); + unset($data['Activity']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestPackage::class => false]; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - } -} else { - class ManifestPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestPackage::class; + if (\array_key_exists('Dimensions', $data)) { + $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class, 'json', $context)); + unset($data['Dimensions']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackage::class; + if (\array_key_exists('DimensionalWeight', $data)) { + $object->setDimensionalWeight($this->denormalizer->denormalize($data['DimensionalWeight'], \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class, 'json', $context)); + unset($data['DimensionalWeight']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestPackage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Activity', $data)) { - $values = []; - foreach ($data['Activity'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageActivity::class, 'json', $context); - } - $object->setActivity($values); - unset($data['Activity']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\ManifestPackageDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('DimensionalWeight', $data)) { - $object->setDimensionalWeight($this->denormalizer->denormalize($data['DimensionalWeight'], \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class, 'json', $context)); - unset($data['DimensionalWeight']); - } - if (\array_key_exists('PackageWeight', $data)) { - $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class, 'json', $context)); - unset($data['PackageWeight']); - } - if (\array_key_exists('LargePackage', $data)) { - $object->setLargePackage($data['LargePackage']); - unset($data['LargePackage']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $values_1 = []; - foreach ($data['ReferenceNumber'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class, 'json', $context); - } - $object->setReferenceNumber($values_1); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('PackageServiceOptions', $data)) { - $object->setPackageServiceOptions($this->denormalizer->denormalize($data['PackageServiceOptions'], \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class, 'json', $context)); - unset($data['PackageServiceOptions']); - } - if (\array_key_exists('UPSPremiumCareIndicator', $data)) { - $object->setUPSPremiumCareIndicator($data['UPSPremiumCareIndicator']); - unset($data['UPSPremiumCareIndicator']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + if (\array_key_exists('PackageWeight', $data)) { + $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class, 'json', $context)); + unset($data['PackageWeight']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('activity') && null !== $object->getActivity()) { - $values = []; - foreach ($object->getActivity() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Activity'] = $values; - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - if ($object->isInitialized('dimensionalWeight') && null !== $object->getDimensionalWeight()) { - $data['DimensionalWeight'] = $this->normalizer->normalize($object->getDimensionalWeight(), 'json', $context); - } - if ($object->isInitialized('packageWeight') && null !== $object->getPackageWeight()) { - $data['PackageWeight'] = $this->normalizer->normalize($object->getPackageWeight(), 'json', $context); - } - if ($object->isInitialized('largePackage') && null !== $object->getLargePackage()) { - $data['LargePackage'] = $object->getLargePackage(); - } - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $data['TrackingNumber'] = $object->getTrackingNumber(); - } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $values_1 = []; - foreach ($object->getReferenceNumber() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ReferenceNumber'] = $values_1; + if (\array_key_exists('LargePackage', $data)) { + $object->setLargePackage($data['LargePackage']); + unset($data['LargePackage']); + } + if (\array_key_exists('TrackingNumber', $data)) { + $object->setTrackingNumber($data['TrackingNumber']); + unset($data['TrackingNumber']); + } + if (\array_key_exists('ReferenceNumber', $data)) { + $values_1 = []; + foreach ($data['ReferenceNumber'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class, 'json', $context); } - if ($object->isInitialized('packageServiceOptions') && null !== $object->getPackageServiceOptions()) { - $data['PackageServiceOptions'] = $this->normalizer->normalize($object->getPackageServiceOptions(), 'json', $context); + $object->setReferenceNumber($values_1); + unset($data['ReferenceNumber']); + } + if (\array_key_exists('PackageServiceOptions', $data)) { + $object->setPackageServiceOptions($this->denormalizer->denormalize($data['PackageServiceOptions'], \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class, 'json', $context)); + unset($data['PackageServiceOptions']); + } + if (\array_key_exists('UPSPremiumCareIndicator', $data)) { + $object->setUPSPremiumCareIndicator($data['UPSPremiumCareIndicator']); + unset($data['UPSPremiumCareIndicator']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; } - if ($object->isInitialized('uPSPremiumCareIndicator') && null !== $object->getUPSPremiumCareIndicator()) { - $data['UPSPremiumCareIndicator'] = $object->getUPSPremiumCareIndicator(); + } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('activity') && null !== $data->getActivity()) { + $values = []; + foreach ($data->getActivity() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $dataArray['Activity'] = $values; + } + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); + } + if ($data->isInitialized('dimensions') && null !== $data->getDimensions()) { + $dataArray['Dimensions'] = $this->normalizer->normalize($data->getDimensions(), 'json', $context); + } + if ($data->isInitialized('dimensionalWeight') && null !== $data->getDimensionalWeight()) { + $dataArray['DimensionalWeight'] = $this->normalizer->normalize($data->getDimensionalWeight(), 'json', $context); + } + if ($data->isInitialized('packageWeight') && null !== $data->getPackageWeight()) { + $dataArray['PackageWeight'] = $this->normalizer->normalize($data->getPackageWeight(), 'json', $context); + } + if ($data->isInitialized('largePackage') && null !== $data->getLargePackage()) { + $dataArray['LargePackage'] = $data->getLargePackage(); + } + if ($data->isInitialized('trackingNumber') && null !== $data->getTrackingNumber()) { + $dataArray['TrackingNumber'] = $data->getTrackingNumber(); + } + if ($data->isInitialized('referenceNumber') && null !== $data->getReferenceNumber()) { + $values_1 = []; + foreach ($data->getReferenceNumber() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['ReferenceNumber'] = $values_1; + } + if ($data->isInitialized('packageServiceOptions') && null !== $data->getPackageServiceOptions()) { + $dataArray['PackageServiceOptions'] = $this->normalizer->normalize($data->getPackageServiceOptions(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestPackage::class => false]; + if ($data->isInitialized('uPSPremiumCareIndicator') && null !== $data->getUPSPremiumCareIndicator()) { + $dataArray['UPSPremiumCareIndicator'] = $data->getUPSPremiumCareIndicator(); } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestPackage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestPackagePackageServiceOptionsNormalizer.php b/src/Api/Normalizer/ManifestPackagePackageServiceOptionsNormalizer.php index 2fbc5687..77d9d475 100644 --- a/src/Api/Normalizer/ManifestPackagePackageServiceOptionsNormalizer.php +++ b/src/Api/Normalizer/ManifestPackagePackageServiceOptionsNormalizer.php @@ -5,196 +5,97 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestPackagePackageServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestPackagePackageServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('InsuredValue', $data)) { - $object->setInsuredValue($this->denormalizer->denormalize($data['InsuredValue'], \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class, 'json', $context)); - unset($data['InsuredValue']); - } - if (\array_key_exists('EarliestDeliveryTime', $data)) { - $object->setEarliestDeliveryTime($data['EarliestDeliveryTime']); - unset($data['EarliestDeliveryTime']); - } - if (\array_key_exists('HazardousMaterialsCode', $data)) { - $object->setHazardousMaterialsCode($data['HazardousMaterialsCode']); - unset($data['HazardousMaterialsCode']); - } - if (\array_key_exists('HoldForPickup', $data)) { - $object->setHoldForPickup($data['HoldForPickup']); - unset($data['HoldForPickup']); - } - if (\array_key_exists('AddShippingChargesToCODIndicator', $data)) { - $object->setAddShippingChargesToCODIndicator($data['AddShippingChargesToCODIndicator']); - unset($data['AddShippingChargesToCODIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('insuredValue') && null !== $object->getInsuredValue()) { - $data['InsuredValue'] = $this->normalizer->normalize($object->getInsuredValue(), 'json', $context); - } - if ($object->isInitialized('earliestDeliveryTime') && null !== $object->getEarliestDeliveryTime()) { - $data['EarliestDeliveryTime'] = $object->getEarliestDeliveryTime(); - } - if ($object->isInitialized('hazardousMaterialsCode') && null !== $object->getHazardousMaterialsCode()) { - $data['HazardousMaterialsCode'] = $object->getHazardousMaterialsCode(); - } - $data['HoldForPickup'] = $object->getHoldForPickup(); - if ($object->isInitialized('addShippingChargesToCODIndicator') && null !== $object->getAddShippingChargesToCODIndicator()) { - $data['AddShippingChargesToCODIndicator'] = $object->getAddShippingChargesToCODIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('COD', $data)) { + $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class, 'json', $context)); + unset($data['COD']); + } + if (\array_key_exists('InsuredValue', $data)) { + $object->setInsuredValue($this->denormalizer->denormalize($data['InsuredValue'], \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class, 'json', $context)); + unset($data['InsuredValue']); + } + if (\array_key_exists('EarliestDeliveryTime', $data)) { + $object->setEarliestDeliveryTime($data['EarliestDeliveryTime']); + unset($data['EarliestDeliveryTime']); + } + if (\array_key_exists('HazardousMaterialsCode', $data)) { + $object->setHazardousMaterialsCode($data['HazardousMaterialsCode']); + unset($data['HazardousMaterialsCode']); + } + if (\array_key_exists('HoldForPickup', $data)) { + $object->setHoldForPickup($data['HoldForPickup']); + unset($data['HoldForPickup']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class => false]; + if (\array_key_exists('AddShippingChargesToCODIndicator', $data)) { + $object->setAddShippingChargesToCODIndicator($data['AddShippingChargesToCODIndicator']); + unset($data['AddShippingChargesToCODIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ManifestPackagePackageServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('InsuredValue', $data)) { - $object->setInsuredValue($this->denormalizer->denormalize($data['InsuredValue'], \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class, 'json', $context)); - unset($data['InsuredValue']); - } - if (\array_key_exists('EarliestDeliveryTime', $data)) { - $object->setEarliestDeliveryTime($data['EarliestDeliveryTime']); - unset($data['EarliestDeliveryTime']); - } - if (\array_key_exists('HazardousMaterialsCode', $data)) { - $object->setHazardousMaterialsCode($data['HazardousMaterialsCode']); - unset($data['HazardousMaterialsCode']); - } - if (\array_key_exists('HoldForPickup', $data)) { - $object->setHoldForPickup($data['HoldForPickup']); - unset($data['HoldForPickup']); - } - if (\array_key_exists('AddShippingChargesToCODIndicator', $data)) { - $object->setAddShippingChargesToCODIndicator($data['AddShippingChargesToCODIndicator']); - unset($data['AddShippingChargesToCODIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('cOD') && null !== $data->getCOD()) { + $dataArray['COD'] = $this->normalizer->normalize($data->getCOD(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('insuredValue') && null !== $object->getInsuredValue()) { - $data['InsuredValue'] = $this->normalizer->normalize($object->getInsuredValue(), 'json', $context); - } - if ($object->isInitialized('earliestDeliveryTime') && null !== $object->getEarliestDeliveryTime()) { - $data['EarliestDeliveryTime'] = $object->getEarliestDeliveryTime(); - } - if ($object->isInitialized('hazardousMaterialsCode') && null !== $object->getHazardousMaterialsCode()) { - $data['HazardousMaterialsCode'] = $object->getHazardousMaterialsCode(); - } - $data['HoldForPickup'] = $object->getHoldForPickup(); - if ($object->isInitialized('addShippingChargesToCODIndicator') && null !== $object->getAddShippingChargesToCODIndicator()) { - $data['AddShippingChargesToCODIndicator'] = $object->getAddShippingChargesToCODIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('insuredValue') && null !== $data->getInsuredValue()) { + $dataArray['InsuredValue'] = $this->normalizer->normalize($data->getInsuredValue(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class => false]; + if ($data->isInitialized('earliestDeliveryTime') && null !== $data->getEarliestDeliveryTime()) { + $dataArray['EarliestDeliveryTime'] = $data->getEarliestDeliveryTime(); } + if ($data->isInitialized('hazardousMaterialsCode') && null !== $data->getHazardousMaterialsCode()) { + $dataArray['HazardousMaterialsCode'] = $data->getHazardousMaterialsCode(); + } + $dataArray['HoldForPickup'] = $data->getHoldForPickup(); + if ($data->isInitialized('addShippingChargesToCODIndicator') && null !== $data->getAddShippingChargesToCODIndicator()) { + $dataArray['AddShippingChargesToCODIndicator'] = $data->getAddShippingChargesToCODIndicator(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestPackagePackageServiceOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestPackagePackageWeightNormalizer.php b/src/Api/Normalizer/ManifestPackagePackageWeightNormalizer.php index 34d0a7f2..2f6506a9 100644 --- a/src/Api/Normalizer/ManifestPackagePackageWeightNormalizer.php +++ b/src/Api/Normalizer/ManifestPackagePackageWeightNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestPackagePackageWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestPackagePackageWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class; + return $type === \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ManifestPackagePackageWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestPackagePackageWeight(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Weight'] = $data->getWeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestPackagePackageWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestPackageReferenceNumberNormalizer.php b/src/Api/Normalizer/ManifestPackageReferenceNumberNormalizer.php index 6cb3984e..fd9d74ee 100644 --- a/src/Api/Normalizer/ManifestPackageReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/ManifestPackageReferenceNumberNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class => false]; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ManifestPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class; + $dataArray = []; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestPackageReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestPackageServiceOptionsCODNormalizer.php b/src/Api/Normalizer/ManifestPackageServiceOptionsCODNormalizer.php index bb32da82..49dbf33c 100644 --- a/src/Api/Normalizer/ManifestPackageServiceOptionsCODNormalizer.php +++ b/src/Api/Normalizer/ManifestPackageServiceOptionsCODNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestPackageServiceOptionsCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestPackageServiceOptionsCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class; + return $type === \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CODCode', $data)) { - $object->setCODCode($data['CODCode']); - unset($data['CODCode']); - } - if (\array_key_exists('CODAmount', $data)) { - $object->setCODAmount($this->denormalizer->denormalize($data['CODAmount'], \ShipStream\Ups\Api\Model\CODCODAmount::class, 'json', $context)); - unset($data['CODAmount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('cODCode') && null !== $object->getCODCode()) { - $data['CODCode'] = $object->getCODCode(); - } - if ($object->isInitialized('cODAmount') && null !== $object->getCODAmount()) { - $data['CODAmount'] = $this->normalizer->normalize($object->getCODAmount(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CODCode', $data)) { + $object->setCODCode($data['CODCode']); + unset($data['CODCode']); + } + if (\array_key_exists('CODAmount', $data)) { + $object->setCODAmount($this->denormalizer->denormalize($data['CODAmount'], \ShipStream\Ups\Api\Model\CODCODAmount::class, 'json', $context)); + unset($data['CODAmount']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ManifestPackageServiceOptionsCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class; + $dataArray = []; + if ($data->isInitialized('cODCode') && null !== $data->getCODCode()) { + $dataArray['CODCode'] = $data->getCODCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CODCode', $data)) { - $object->setCODCode($data['CODCode']); - unset($data['CODCode']); - } - if (\array_key_exists('CODAmount', $data)) { - $object->setCODAmount($this->denormalizer->denormalize($data['CODAmount'], \ShipStream\Ups\Api\Model\CODCODAmount::class, 'json', $context)); - unset($data['CODAmount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('cODAmount') && null !== $data->getCODAmount()) { + $dataArray['CODAmount'] = $this->normalizer->normalize($data->getCODAmount(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('cODCode') && null !== $object->getCODCode()) { - $data['CODCode'] = $object->getCODCode(); - } - if ($object->isInitialized('cODAmount') && null !== $object->getCODAmount()) { - $data['CODAmount'] = $this->normalizer->normalize($object->getCODAmount(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestPackageServiceOptionsCOD::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestReferenceNumberNormalizer.php b/src/Api/Normalizer/ManifestReferenceNumberNormalizer.php index 75c27419..5e33f959 100644 --- a/src/Api/Normalizer/ManifestReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/ManifestReferenceNumberNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ManifestReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestReferenceNumber::class => false]; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ManifestReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class; + $dataArray = []; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestServiceNormalizer.php b/src/Api/Normalizer/ManifestServiceNormalizer.php index 095ed1d9..dabc28e3 100644 --- a/src/Api/Normalizer/ManifestServiceNormalizer.php +++ b/src/Api/Normalizer/ManifestServiceNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestService::class; + return $type === \ShipStream\Ups\Api\Model\ManifestService::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestService::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestService::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ManifestService(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestService::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ManifestServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestService::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestService::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestService::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestService::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestShipToAddressNormalizer.php b/src/Api/Normalizer/ManifestShipToAddressNormalizer.php index 0f6fb65f..085a36ff 100644 --- a/src/Api/Normalizer/ManifestShipToAddressNormalizer.php +++ b/src/Api/Normalizer/ManifestShipToAddressNormalizer.php @@ -5,228 +5,113 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestShipToAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipToAddress::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('AddressLine1', $data)) { - $object->setAddressLine1($data['AddressLine1']); - unset($data['AddressLine1']); - } - if (\array_key_exists('AddressLine2', $data)) { - $object->setAddressLine2($data['AddressLine2']); - unset($data['AddressLine2']); - } - if (\array_key_exists('AddressLine3', $data)) { - $object->setAddressLine3($data['AddressLine3']); - unset($data['AddressLine3']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ManifestShipToAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipToAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ManifestShipToAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - if ($object->isInitialized('addressLine1') && null !== $object->getAddressLine1()) { - $data['AddressLine1'] = $object->getAddressLine1(); - } - if ($object->isInitialized('addressLine2') && null !== $object->getAddressLine2()) { - $data['AddressLine2'] = $object->getAddressLine2(); - } - if ($object->isInitialized('addressLine3') && null !== $object->getAddressLine3()) { - $data['AddressLine3'] = $object->getAddressLine3(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ConsigneeName', $data)) { + $object->setConsigneeName($data['ConsigneeName']); + unset($data['ConsigneeName']); + } + if (\array_key_exists('AddressLine1', $data)) { + $object->setAddressLine1($data['AddressLine1']); + unset($data['AddressLine1']); + } + if (\array_key_exists('AddressLine2', $data)) { + $object->setAddressLine2($data['AddressLine2']); + unset($data['AddressLine2']); + } + if (\array_key_exists('AddressLine3', $data)) { + $object->setAddressLine3($data['AddressLine3']); + unset($data['AddressLine3']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestShipToAddress::class => false]; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ManifestShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestShipToAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipToAddress::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('AddressLine1', $data)) { - $object->setAddressLine1($data['AddressLine1']); - unset($data['AddressLine1']); - } - if (\array_key_exists('AddressLine2', $data)) { - $object->setAddressLine2($data['AddressLine2']); - unset($data['AddressLine2']); - } - if (\array_key_exists('AddressLine3', $data)) { - $object->setAddressLine3($data['AddressLine3']); - unset($data['AddressLine3']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('consigneeName') && null !== $data->getConsigneeName()) { + $dataArray['ConsigneeName'] = $data->getConsigneeName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - if ($object->isInitialized('addressLine1') && null !== $object->getAddressLine1()) { - $data['AddressLine1'] = $object->getAddressLine1(); - } - if ($object->isInitialized('addressLine2') && null !== $object->getAddressLine2()) { - $data['AddressLine2'] = $object->getAddressLine2(); - } - if ($object->isInitialized('addressLine3') && null !== $object->getAddressLine3()) { - $data['AddressLine3'] = $object->getAddressLine3(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('addressLine1') && null !== $data->getAddressLine1()) { + $dataArray['AddressLine1'] = $data->getAddressLine1(); + } + if ($data->isInitialized('addressLine2') && null !== $data->getAddressLine2()) { + $dataArray['AddressLine2'] = $data->getAddressLine2(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestShipToAddress::class => false]; + if ($data->isInitialized('addressLine3') && null !== $data->getAddressLine3()) { + $dataArray['AddressLine3'] = $data->getAddressLine3(); } + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); + } + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); + } + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); + } + if ($data->isInitialized('countryCode') && null !== $data->getCountryCode()) { + $dataArray['CountryCode'] = $data->getCountryCode(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestShipToAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestShipToNormalizer.php b/src/Api/Normalizer/ManifestShipToNormalizer.php index fbf3102e..e1520e37 100644 --- a/src/Api/Normalizer/ManifestShipToNormalizer.php +++ b/src/Api/Normalizer/ManifestShipToNormalizer.php @@ -5,256 +5,127 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestShipTo::class; + return $type === \ShipStream\Ups\Api\Model\ManifestShipTo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipTo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipTo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipperAssignedIdentificationNumber', $data)) { - $object->setShipperAssignedIdentificationNumber($data['ShipperAssignedIdentificationNumber']); - unset($data['ShipperAssignedIdentificationNumber']); - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ManifestShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('LocationID', $data)) { - $object->setLocationID($data['LocationID']); - unset($data['LocationID']); - } - if (\array_key_exists('ReceivingAddressName', $data)) { - $object->setReceivingAddressName($data['ReceivingAddressName']); - unset($data['ReceivingAddressName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ManifestShipTo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('shipperAssignedIdentificationNumber') && null !== $object->getShipperAssignedIdentificationNumber()) { - $data['ShipperAssignedIdentificationNumber'] = $object->getShipperAssignedIdentificationNumber(); - } - if ($object->isInitialized('companyName') && null !== $object->getCompanyName()) { - $data['CompanyName'] = $object->getCompanyName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('phoneNumber') && null !== $object->getPhoneNumber()) { - $data['PhoneNumber'] = $object->getPhoneNumber(); - } - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('locationID') && null !== $object->getLocationID()) { - $data['LocationID'] = $object->getLocationID(); - } - if ($object->isInitialized('receivingAddressName') && null !== $object->getReceivingAddressName()) { - $data['ReceivingAddressName'] = $object->getReceivingAddressName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ShipperAssignedIdentificationNumber', $data)) { + $object->setShipperAssignedIdentificationNumber($data['ShipperAssignedIdentificationNumber']); + unset($data['ShipperAssignedIdentificationNumber']); + } + if (\array_key_exists('CompanyName', $data)) { + $object->setCompanyName($data['CompanyName']); + unset($data['CompanyName']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('PhoneNumber', $data)) { + $object->setPhoneNumber($data['PhoneNumber']); + unset($data['PhoneNumber']); + } + if (\array_key_exists('TaxIdentificationNumber', $data)) { + $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); + unset($data['TaxIdentificationNumber']); + } + if (\array_key_exists('FaxNumber', $data)) { + $object->setFaxNumber($data['FaxNumber']); + unset($data['FaxNumber']); + } + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ManifestShipToAddress::class, 'json', $context)); + unset($data['Address']); + } + if (\array_key_exists('LocationID', $data)) { + $object->setLocationID($data['LocationID']); + unset($data['LocationID']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestShipTo::class => false]; + if (\array_key_exists('ReceivingAddressName', $data)) { + $object->setReceivingAddressName($data['ReceivingAddressName']); + unset($data['ReceivingAddressName']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ManifestShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestShipTo::class; + $dataArray = []; + if ($data->isInitialized('shipperAssignedIdentificationNumber') && null !== $data->getShipperAssignedIdentificationNumber()) { + $dataArray['ShipperAssignedIdentificationNumber'] = $data->getShipperAssignedIdentificationNumber(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipTo::class; + if ($data->isInitialized('companyName') && null !== $data->getCompanyName()) { + $dataArray['CompanyName'] = $data->getCompanyName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipperAssignedIdentificationNumber', $data)) { - $object->setShipperAssignedIdentificationNumber($data['ShipperAssignedIdentificationNumber']); - unset($data['ShipperAssignedIdentificationNumber']); - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ManifestShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('LocationID', $data)) { - $object->setLocationID($data['LocationID']); - unset($data['LocationID']); - } - if (\array_key_exists('ReceivingAddressName', $data)) { - $object->setReceivingAddressName($data['ReceivingAddressName']); - unset($data['ReceivingAddressName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('shipperAssignedIdentificationNumber') && null !== $object->getShipperAssignedIdentificationNumber()) { - $data['ShipperAssignedIdentificationNumber'] = $object->getShipperAssignedIdentificationNumber(); - } - if ($object->isInitialized('companyName') && null !== $object->getCompanyName()) { - $data['CompanyName'] = $object->getCompanyName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('phoneNumber') && null !== $object->getPhoneNumber()) { - $data['PhoneNumber'] = $object->getPhoneNumber(); - } - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('locationID') && null !== $object->getLocationID()) { - $data['LocationID'] = $object->getLocationID(); - } - if ($object->isInitialized('receivingAddressName') && null !== $object->getReceivingAddressName()) { - $data['ReceivingAddressName'] = $object->getReceivingAddressName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('phoneNumber') && null !== $data->getPhoneNumber()) { + $dataArray['PhoneNumber'] = $data->getPhoneNumber(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestShipTo::class => false]; + if ($data->isInitialized('taxIdentificationNumber') && null !== $data->getTaxIdentificationNumber()) { + $dataArray['TaxIdentificationNumber'] = $data->getTaxIdentificationNumber(); } + if ($data->isInitialized('faxNumber') && null !== $data->getFaxNumber()) { + $dataArray['FaxNumber'] = $data->getFaxNumber(); + } + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); + } + if ($data->isInitialized('address') && null !== $data->getAddress()) { + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + } + if ($data->isInitialized('locationID') && null !== $data->getLocationID()) { + $dataArray['LocationID'] = $data->getLocationID(); + } + if ($data->isInitialized('receivingAddressName') && null !== $data->getReceivingAddressName()) { + $dataArray['ReceivingAddressName'] = $data->getReceivingAddressName(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestShipTo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestShipmentServiceOptionsNormalizer.php b/src/Api/Normalizer/ManifestShipmentServiceOptionsNormalizer.php index 561e87c0..226ae3fd 100644 --- a/src/Api/Normalizer/ManifestShipmentServiceOptionsNormalizer.php +++ b/src/Api/Normalizer/ManifestShipmentServiceOptionsNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class; + return $type === \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SaturdayPickup', $data)) { - $object->setSaturdayPickup($data['SaturdayPickup']); - unset($data['SaturdayPickup']); - } - if (\array_key_exists('SaturdayDelivery', $data)) { - $object->setSaturdayDelivery($data['SaturdayDelivery']); - unset($data['SaturdayDelivery']); - } - if (\array_key_exists('CallTagARS', $data)) { - $object->setCallTagARS($this->denormalizer->denormalize($data['CallTagARS'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class, 'json', $context)); - unset($data['CallTagARS']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['SaturdayPickup'] = $object->getSaturdayPickup(); - $data['SaturdayDelivery'] = $object->getSaturdayDelivery(); - if ($object->isInitialized('callTagARS') && null !== $object->getCallTagARS()) { - $data['CallTagARS'] = $this->normalizer->normalize($object->getCallTagARS(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class => false]; + if (\array_key_exists('SaturdayPickup', $data)) { + $object->setSaturdayPickup($data['SaturdayPickup']); + unset($data['SaturdayPickup']); } - } -} else { - class ManifestShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class; + if (\array_key_exists('SaturdayDelivery', $data)) { + $object->setSaturdayDelivery($data['SaturdayDelivery']); + unset($data['SaturdayDelivery']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class; + if (\array_key_exists('CallTagARS', $data)) { + $object->setCallTagARS($this->denormalizer->denormalize($data['CallTagARS'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class, 'json', $context)); + unset($data['CallTagARS']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SaturdayPickup', $data)) { - $object->setSaturdayPickup($data['SaturdayPickup']); - unset($data['SaturdayPickup']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('SaturdayDelivery', $data)) { - $object->setSaturdayDelivery($data['SaturdayDelivery']); - unset($data['SaturdayDelivery']); - } - if (\array_key_exists('CallTagARS', $data)) { - $object->setCallTagARS($this->denormalizer->denormalize($data['CallTagARS'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class, 'json', $context)); - unset($data['CallTagARS']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['SaturdayPickup'] = $object->getSaturdayPickup(); - $data['SaturdayDelivery'] = $object->getSaturdayDelivery(); - if ($object->isInitialized('callTagARS') && null !== $object->getCallTagARS()) { - $data['CallTagARS'] = $this->normalizer->normalize($object->getCallTagARS(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['SaturdayPickup'] = $data->getSaturdayPickup(); + $dataArray['SaturdayDelivery'] = $data->getSaturdayDelivery(); + if ($data->isInitialized('callTagARS') && null !== $data->getCallTagARS()) { + $dataArray['CallTagARS'] = $this->normalizer->normalize($data->getCallTagARS(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestShipperAddressNormalizer.php b/src/Api/Normalizer/ManifestShipperAddressNormalizer.php index 622e3fc2..9b0a6bfe 100644 --- a/src/Api/Normalizer/ManifestShipperAddressNormalizer.php +++ b/src/Api/Normalizer/ManifestShipperAddressNormalizer.php @@ -5,224 +5,111 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestShipperAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestShipperAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestShipperAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipperAddress::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestShipperAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine1', $data)) { - $object->setAddressLine1($data['AddressLine1']); - unset($data['AddressLine1']); - } - if (\array_key_exists('AddressLine2', $data)) { - $object->setAddressLine2($data['AddressLine2']); - unset($data['AddressLine2']); - } - if (\array_key_exists('AddressLine3', $data)) { - $object->setAddressLine3($data['AddressLine3']); - unset($data['AddressLine3']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialAddressIndicator', $data)) { - $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); - unset($data['ResidentialAddressIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ManifestShipperAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipperAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ManifestShipperAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('addressLine1') && null !== $object->getAddressLine1()) { - $data['AddressLine1'] = $object->getAddressLine1(); - } - if ($object->isInitialized('addressLine2') && null !== $object->getAddressLine2()) { - $data['AddressLine2'] = $object->getAddressLine2(); - } - if ($object->isInitialized('addressLine3') && null !== $object->getAddressLine3()) { - $data['AddressLine3'] = $object->getAddressLine3(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); - } - $data['ResidentialAddressIndicator'] = $object->getResidentialAddressIndicator(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressLine1', $data)) { + $object->setAddressLine1($data['AddressLine1']); + unset($data['AddressLine1']); + } + if (\array_key_exists('AddressLine2', $data)) { + $object->setAddressLine2($data['AddressLine2']); + unset($data['AddressLine2']); + } + if (\array_key_exists('AddressLine3', $data)) { + $object->setAddressLine3($data['AddressLine3']); + unset($data['AddressLine3']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestShipperAddress::class => false]; + if (\array_key_exists('ResidentialAddressIndicator', $data)) { + $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); + unset($data['ResidentialAddressIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ManifestShipperAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestShipperAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipperAddress::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestShipperAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine1', $data)) { - $object->setAddressLine1($data['AddressLine1']); - unset($data['AddressLine1']); - } - if (\array_key_exists('AddressLine2', $data)) { - $object->setAddressLine2($data['AddressLine2']); - unset($data['AddressLine2']); - } - if (\array_key_exists('AddressLine3', $data)) { - $object->setAddressLine3($data['AddressLine3']); - unset($data['AddressLine3']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialAddressIndicator', $data)) { - $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); - unset($data['ResidentialAddressIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('addressLine1') && null !== $data->getAddressLine1()) { + $dataArray['AddressLine1'] = $data->getAddressLine1(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('addressLine1') && null !== $object->getAddressLine1()) { - $data['AddressLine1'] = $object->getAddressLine1(); - } - if ($object->isInitialized('addressLine2') && null !== $object->getAddressLine2()) { - $data['AddressLine2'] = $object->getAddressLine2(); - } - if ($object->isInitialized('addressLine3') && null !== $object->getAddressLine3()) { - $data['AddressLine3'] = $object->getAddressLine3(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); - } - $data['ResidentialAddressIndicator'] = $object->getResidentialAddressIndicator(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('addressLine2') && null !== $data->getAddressLine2()) { + $dataArray['AddressLine2'] = $data->getAddressLine2(); + } + if ($data->isInitialized('addressLine3') && null !== $data->getAddressLine3()) { + $dataArray['AddressLine3'] = $data->getAddressLine3(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestShipperAddress::class => false]; + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); } + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); + } + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); + } + if ($data->isInitialized('countryCode') && null !== $data->getCountryCode()) { + $dataArray['CountryCode'] = $data->getCountryCode(); + } + $dataArray['ResidentialAddressIndicator'] = $data->getResidentialAddressIndicator(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestShipperAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestShipperNormalizer.php b/src/Api/Normalizer/ManifestShipperNormalizer.php index ce4a4b2c..7da343ab 100644 --- a/src/Api/Normalizer/ManifestShipperNormalizer.php +++ b/src/Api/Normalizer/ManifestShipperNormalizer.php @@ -5,224 +5,111 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestShipper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipper::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestShipper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ManifestShipperAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ManifestShipper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ManifestShipper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('phoneNumber') && null !== $object->getPhoneNumber()) { - $data['PhoneNumber'] = $object->getPhoneNumber(); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('shipperNumber') && null !== $object->getShipperNumber()) { - $data['ShipperNumber'] = $object->getShipperNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('TaxIdentificationNumber', $data)) { + $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); + unset($data['TaxIdentificationNumber']); + } + if (\array_key_exists('PhoneNumber', $data)) { + $object->setPhoneNumber($data['PhoneNumber']); + unset($data['PhoneNumber']); + } + if (\array_key_exists('FaxNumber', $data)) { + $object->setFaxNumber($data['FaxNumber']); + unset($data['FaxNumber']); + } + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); + } + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestShipper::class => false]; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ManifestShipperAddress::class, 'json', $context)); + unset($data['Address']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ManifestShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestShipper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestShipper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestShipper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ManifestShipperAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Name'] = $data->getName(); + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('phoneNumber') && null !== $object->getPhoneNumber()) { - $data['PhoneNumber'] = $object->getPhoneNumber(); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('shipperNumber') && null !== $object->getShipperNumber()) { - $data['ShipperNumber'] = $object->getShipperNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('taxIdentificationNumber') && null !== $data->getTaxIdentificationNumber()) { + $dataArray['TaxIdentificationNumber'] = $data->getTaxIdentificationNumber(); + } + if ($data->isInitialized('phoneNumber') && null !== $data->getPhoneNumber()) { + $dataArray['PhoneNumber'] = $data->getPhoneNumber(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestShipper::class => false]; + if ($data->isInitialized('faxNumber') && null !== $data->getFaxNumber()) { + $dataArray['FaxNumber'] = $data->getFaxNumber(); } + if ($data->isInitialized('shipperNumber') && null !== $data->getShipperNumber()) { + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + } + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); + } + if ($data->isInitialized('address') && null !== $data->getAddress()) { + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestShipper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ManifestUAPAddressNormalizer.php b/src/Api/Normalizer/ManifestUAPAddressNormalizer.php index 327b883c..27e512a1 100644 --- a/src/Api/Normalizer/ManifestUAPAddressNormalizer.php +++ b/src/Api/Normalizer/ManifestUAPAddressNormalizer.php @@ -5,172 +5,85 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestUAPAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ManifestUAPAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestUAPAddress::class; + return $type === \ShipStream\Ups\Api\Model\ManifestUAPAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestUAPAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestUAPAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestUAPAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\UAPAddressAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ManifestUAPAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('companyName') && null !== $object->getCompanyName()) { - $data['CompanyName'] = $object->getCompanyName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('phoneNumber') && null !== $object->getPhoneNumber()) { - $data['PhoneNumber'] = $object->getPhoneNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CompanyName', $data)) { + $object->setCompanyName($data['CompanyName']); + unset($data['CompanyName']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\UAPAddressAddress::class, 'json', $context)); + unset($data['Address']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestUAPAddress::class => false]; + if (\array_key_exists('PhoneNumber', $data)) { + $object->setPhoneNumber($data['PhoneNumber']); + unset($data['PhoneNumber']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ManifestUAPAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ManifestUAPAddress::class; + $dataArray = []; + if ($data->isInitialized('companyName') && null !== $data->getCompanyName()) { + $dataArray['CompanyName'] = $data->getCompanyName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ManifestUAPAddress::class; + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ManifestUAPAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\UAPAddressAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('address') && null !== $data->getAddress()) { + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('companyName') && null !== $object->getCompanyName()) { - $data['CompanyName'] = $object->getCompanyName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('phoneNumber') && null !== $object->getPhoneNumber()) { - $data['PhoneNumber'] = $object->getPhoneNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('phoneNumber') && null !== $data->getPhoneNumber()) { + $dataArray['PhoneNumber'] = $data->getPhoneNumber(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ManifestUAPAddress::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ManifestUAPAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/MilestonesNormalizer.php b/src/Api/Normalizer/MilestonesNormalizer.php index 8587f293..b8710fb1 100644 --- a/src/Api/Normalizer/MilestonesNormalizer.php +++ b/src/Api/Normalizer/MilestonesNormalizer.php @@ -5,214 +5,109 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class MilestonesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class MilestonesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Milestones::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Milestones::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Milestones(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('category', $data)) { - $object->setCategory($data['category']); - unset($data['category']); - } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('current', $data)) { - $object->setCurrent($data['current']); - unset($data['current']); - } - if (\array_key_exists('description', $data)) { - $object->setDescription($data['description']); - unset($data['description']); - } - if (\array_key_exists('linkedActivity', $data)) { - $object->setLinkedActivity($data['linkedActivity']); - unset($data['linkedActivity']); - } - if (\array_key_exists('state', $data)) { - $object->setState($data['state']); - unset($data['state']); - } - if (\array_key_exists('subMilestone', $data)) { - $object->setSubMilestone($this->denormalizer->denormalize($data['subMilestone'], \ShipStream\Ups\Api\Model\SubMilestone::class, 'json', $context)); - unset($data['subMilestone']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\Milestones::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Milestones::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\Milestones(); + if (\array_key_exists('current', $data) && \is_int($data['current'])) { + $data['current'] = (bool) $data['current']; + } + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('category') && null !== $object->getCategory()) { - $data['category'] = $object->getCategory(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('current') && null !== $object->getCurrent()) { - $data['current'] = $object->getCurrent(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('linkedActivity') && null !== $object->getLinkedActivity()) { - $data['linkedActivity'] = $object->getLinkedActivity(); - } - if ($object->isInitialized('state') && null !== $object->getState()) { - $data['state'] = $object->getState(); - } - if ($object->isInitialized('subMilestone') && null !== $object->getSubMilestone()) { - $data['subMilestone'] = $this->normalizer->normalize($object->getSubMilestone(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('category', $data)) { + $object->setCategory($data['category']); + unset($data['category']); + } + if (\array_key_exists('code', $data)) { + $object->setCode($data['code']); + unset($data['code']); + } + if (\array_key_exists('current', $data)) { + $object->setCurrent($data['current']); + unset($data['current']); + } + if (\array_key_exists('description', $data)) { + $object->setDescription($data['description']); + unset($data['description']); + } + if (\array_key_exists('linkedActivity', $data)) { + $object->setLinkedActivity($data['linkedActivity']); + unset($data['linkedActivity']); + } + if (\array_key_exists('state', $data)) { + $object->setState($data['state']); + unset($data['state']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Milestones::class => false]; + if (\array_key_exists('subMilestone', $data)) { + $object->setSubMilestone($this->denormalizer->denormalize($data['subMilestone'], \ShipStream\Ups\Api\Model\SubMilestone::class, 'json', $context)); + unset($data['subMilestone']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class MilestonesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Milestones::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Milestones::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Milestones(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('category', $data)) { - $object->setCategory($data['category']); - unset($data['category']); - } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('current', $data)) { - $object->setCurrent($data['current']); - unset($data['current']); - } - if (\array_key_exists('description', $data)) { - $object->setDescription($data['description']); - unset($data['description']); - } - if (\array_key_exists('linkedActivity', $data)) { - $object->setLinkedActivity($data['linkedActivity']); - unset($data['linkedActivity']); - } - if (\array_key_exists('state', $data)) { - $object->setState($data['state']); - unset($data['state']); - } - if (\array_key_exists('subMilestone', $data)) { - $object->setSubMilestone($this->denormalizer->denormalize($data['subMilestone'], \ShipStream\Ups\Api\Model\SubMilestone::class, 'json', $context)); - unset($data['subMilestone']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('category') && null !== $data->getCategory()) { + $dataArray['category'] = $data->getCategory(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('category') && null !== $object->getCategory()) { - $data['category'] = $object->getCategory(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('current') && null !== $object->getCurrent()) { - $data['current'] = $object->getCurrent(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('linkedActivity') && null !== $object->getLinkedActivity()) { - $data['linkedActivity'] = $object->getLinkedActivity(); - } - if ($object->isInitialized('state') && null !== $object->getState()) { - $data['state'] = $object->getState(); - } - if ($object->isInitialized('subMilestone') && null !== $object->getSubMilestone()) { - $data['subMilestone'] = $this->normalizer->normalize($object->getSubMilestone(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['code'] = $data->getCode(); + } + if ($data->isInitialized('current') && null !== $data->getCurrent()) { + $dataArray['current'] = $data->getCurrent(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Milestones::class => false]; + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['description'] = $data->getDescription(); } + if ($data->isInitialized('linkedActivity') && null !== $data->getLinkedActivity()) { + $dataArray['linkedActivity'] = $data->getLinkedActivity(); + } + if ($data->isInitialized('state') && null !== $data->getState()) { + $dataArray['state'] = $data->getState(); + } + if ($data->isInitialized('subMilestone') && null !== $data->getSubMilestone()) { + $dataArray['subMilestone'] = $this->normalizer->normalize($data->getSubMilestone(), 'json', $context); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Milestones::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/NegotiatedChargesItemizedChargesNormalizer.php b/src/Api/Normalizer/NegotiatedChargesItemizedChargesNormalizer.php index 9efe0380..32225fef 100644 --- a/src/Api/Normalizer/NegotiatedChargesItemizedChargesNormalizer.php +++ b/src/Api/Normalizer/NegotiatedChargesItemizedChargesNormalizer.php @@ -5,174 +5,86 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class NegotiatedChargesItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class NegotiatedChargesItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class; + return $type === \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('SubType', $data)) { - $object->setSubType($data['SubType']); - unset($data['SubType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - if ($object->isInitialized('subType') && null !== $object->getSubType()) { - $data['SubType'] = $object->getSubType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class => false]; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - } -} else { - class NegotiatedChargesItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('SubType', $data)) { - $object->setSubType($data['SubType']); - unset($data['SubType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('SubType', $data)) { + $object->setSubType($data['SubType']); + unset($data['SubType']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - if ($object->isInitialized('subType') && null !== $object->getSubType()) { - $data['SubType'] = $object->getSubType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); + } + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + if ($data->isInitialized('subType') && null !== $data->getSubType()) { + $dataArray['SubType'] = $data->getSubType(); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/NegotiatedRateChargesItemizedChargesNormalizer.php b/src/Api/Normalizer/NegotiatedRateChargesItemizedChargesNormalizer.php index 2ee5d4f8..8bf03292 100644 --- a/src/Api/Normalizer/NegotiatedRateChargesItemizedChargesNormalizer.php +++ b/src/Api/Normalizer/NegotiatedRateChargesItemizedChargesNormalizer.php @@ -5,174 +5,86 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class NegotiatedRateChargesItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class NegotiatedRateChargesItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class; + return $type === \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('SubType', $data)) { - $object->setSubType($data['SubType']); - unset($data['SubType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - if ($object->isInitialized('subType') && null !== $object->getSubType()) { - $data['SubType'] = $object->getSubType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class => false]; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - } -} else { - class NegotiatedRateChargesItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('SubType', $data)) { - $object->setSubType($data['SubType']); - unset($data['SubType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('SubType', $data)) { + $object->setSubType($data['SubType']); + unset($data['SubType']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - if ($object->isInitialized('subType') && null !== $object->getSubType()) { - $data['SubType'] = $object->getSubType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); + } + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + if ($data->isInitialized('subType') && null !== $data->getSubType()) { + $dataArray['SubType'] = $data->getSubType(); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/NegotiatedRateChargesTaxChargesNormalizer.php b/src/Api/Normalizer/NegotiatedRateChargesTaxChargesNormalizer.php index 8c482b8a..f760e265 100644 --- a/src/Api/Normalizer/NegotiatedRateChargesTaxChargesNormalizer.php +++ b/src/Api/Normalizer/NegotiatedRateChargesTaxChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class NegotiatedRateChargesTaxChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class NegotiatedRateChargesTaxChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class; + return $type === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $object->getType(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class => false]; - } - } -} else { - class NegotiatedRateChargesTaxChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class; + if (\array_key_exists('Type', $data)) { + $object->setType($data['Type']); + unset($data['Type']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $object->getType(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Type'] = $data->getType(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/NegotiatedRateChargesTotalChargeNormalizer.php b/src/Api/Normalizer/NegotiatedRateChargesTotalChargeNormalizer.php index 0006e796..f95fe96d 100644 --- a/src/Api/Normalizer/NegotiatedRateChargesTotalChargeNormalizer.php +++ b/src/Api/Normalizer/NegotiatedRateChargesTotalChargeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class NegotiatedRateChargesTotalChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class NegotiatedRateChargesTotalChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class; + return $type === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class => false]; - } - } -} else { - class NegotiatedRateChargesTotalChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/NegotiatedRateChargesTotalChargesWithTaxesNormalizer.php b/src/Api/Normalizer/NegotiatedRateChargesTotalChargesWithTaxesNormalizer.php index 8f5b93c4..6cf750cc 100644 --- a/src/Api/Normalizer/NegotiatedRateChargesTotalChargesWithTaxesNormalizer.php +++ b/src/Api/Normalizer/NegotiatedRateChargesTotalChargesWithTaxesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class NegotiatedRateChargesTotalChargesWithTaxesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class NegotiatedRateChargesTotalChargesWithTaxesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class; + return $type === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class => false]; - } - } -} else { - class NegotiatedRateChargesTotalChargesWithTaxesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/NotificationEMailNormalizer.php b/src/Api/Normalizer/NotificationEMailNormalizer.php index 6ed6d649..118b8243 100644 --- a/src/Api/Normalizer/NotificationEMailNormalizer.php +++ b/src/Api/Normalizer/NotificationEMailNormalizer.php @@ -5,198 +5,98 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class NotificationEMailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class NotificationEMailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NotificationEMail::class; + return $type === \ShipStream\Ups\Api\Model\NotificationEMail::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NotificationEMail::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NotificationEMail::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NotificationEMail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailAddress', $data)) { - $values = []; - foreach ($data['EMailAddress'] as $value) { - $values[] = $value; - } - $object->setEMailAddress($values); - unset($data['EMailAddress']); - } - if (\array_key_exists('UndeliverableEMailAddress', $data)) { - $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); - unset($data['UndeliverableEMailAddress']); - } - if (\array_key_exists('FromEMailAddress', $data)) { - $object->setFromEMailAddress($data['FromEMailAddress']); - unset($data['FromEMailAddress']); - } - if (\array_key_exists('FromName', $data)) { - $object->setFromName($data['FromName']); - unset($data['FromName']); - } - if (\array_key_exists('Memo', $data)) { - $object->setMemo($data['Memo']); - unset($data['Memo']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\NotificationEMail(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('EMailAddress', $data)) { $values = []; - foreach ($object->getEMailAddress() as $value) { + foreach ($data['EMailAddress'] as $value) { $values[] = $value; } - $data['EMailAddress'] = $values; - if ($object->isInitialized('undeliverableEMailAddress') && null !== $object->getUndeliverableEMailAddress()) { - $data['UndeliverableEMailAddress'] = $object->getUndeliverableEMailAddress(); - } - if ($object->isInitialized('fromEMailAddress') && null !== $object->getFromEMailAddress()) { - $data['FromEMailAddress'] = $object->getFromEMailAddress(); - } - if ($object->isInitialized('fromName') && null !== $object->getFromName()) { - $data['FromName'] = $object->getFromName(); - } - if ($object->isInitialized('memo') && null !== $object->getMemo()) { - $data['Memo'] = $object->getMemo(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setEMailAddress($values); + unset($data['EMailAddress']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NotificationEMail::class => false]; + if (\array_key_exists('UndeliverableEMailAddress', $data)) { + $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); + unset($data['UndeliverableEMailAddress']); + } + if (\array_key_exists('FromEMailAddress', $data)) { + $object->setFromEMailAddress($data['FromEMailAddress']); + unset($data['FromEMailAddress']); + } + if (\array_key_exists('FromName', $data)) { + $object->setFromName($data['FromName']); + unset($data['FromName']); + } + if (\array_key_exists('Memo', $data)) { + $object->setMemo($data['Memo']); + unset($data['Memo']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class NotificationEMailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NotificationEMail::class; + $dataArray = []; + $values = []; + foreach ($data->getEMailAddress() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NotificationEMail::class; + $dataArray['EMailAddress'] = $values; + if ($data->isInitialized('undeliverableEMailAddress') && null !== $data->getUndeliverableEMailAddress()) { + $dataArray['UndeliverableEMailAddress'] = $data->getUndeliverableEMailAddress(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NotificationEMail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailAddress', $data)) { - $values = []; - foreach ($data['EMailAddress'] as $value) { - $values[] = $value; - } - $object->setEMailAddress($values); - unset($data['EMailAddress']); - } - if (\array_key_exists('UndeliverableEMailAddress', $data)) { - $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); - unset($data['UndeliverableEMailAddress']); - } - if (\array_key_exists('FromEMailAddress', $data)) { - $object->setFromEMailAddress($data['FromEMailAddress']); - unset($data['FromEMailAddress']); - } - if (\array_key_exists('FromName', $data)) { - $object->setFromName($data['FromName']); - unset($data['FromName']); - } - if (\array_key_exists('Memo', $data)) { - $object->setMemo($data['Memo']); - unset($data['Memo']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('fromEMailAddress') && null !== $data->getFromEMailAddress()) { + $dataArray['FromEMailAddress'] = $data->getFromEMailAddress(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getEMailAddress() as $value) { - $values[] = $value; - } - $data['EMailAddress'] = $values; - if ($object->isInitialized('undeliverableEMailAddress') && null !== $object->getUndeliverableEMailAddress()) { - $data['UndeliverableEMailAddress'] = $object->getUndeliverableEMailAddress(); - } - if ($object->isInitialized('fromEMailAddress') && null !== $object->getFromEMailAddress()) { - $data['FromEMailAddress'] = $object->getFromEMailAddress(); - } - if ($object->isInitialized('fromName') && null !== $object->getFromName()) { - $data['FromName'] = $object->getFromName(); - } - if ($object->isInitialized('memo') && null !== $object->getMemo()) { - $data['Memo'] = $object->getMemo(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('fromName') && null !== $data->getFromName()) { + $dataArray['FromName'] = $data->getFromName(); + } + if ($data->isInitialized('memo') && null !== $data->getMemo()) { + $dataArray['Memo'] = $data->getMemo(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NotificationEMail::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\NotificationEMail::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/NotificationLocaleNormalizer.php b/src/Api/Normalizer/NotificationLocaleNormalizer.php index d5bb4594..a73bf431 100644 --- a/src/Api/Normalizer/NotificationLocaleNormalizer.php +++ b/src/Api/Normalizer/NotificationLocaleNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class NotificationLocaleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class NotificationLocaleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NotificationLocale::class; + return $type === \ShipStream\Ups\Api\Model\NotificationLocale::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NotificationLocale::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NotificationLocale::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NotificationLocale(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Language', $data)) { - $object->setLanguage($data['Language']); - unset($data['Language']); - } - if (\array_key_exists('Dialect', $data)) { - $object->setDialect($data['Dialect']); - unset($data['Dialect']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\NotificationLocale(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Language'] = $object->getLanguage(); - $data['Dialect'] = $object->getDialect(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NotificationLocale::class => false]; - } - } -} else { - class NotificationLocaleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NotificationLocale::class; + if (\array_key_exists('Language', $data)) { + $object->setLanguage($data['Language']); + unset($data['Language']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NotificationLocale::class; + if (\array_key_exists('Dialect', $data)) { + $object->setDialect($data['Dialect']); + unset($data['Dialect']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NotificationLocale(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Language', $data)) { - $object->setLanguage($data['Language']); - unset($data['Language']); - } - if (\array_key_exists('Dialect', $data)) { - $object->setDialect($data['Dialect']); - unset($data['Dialect']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Language'] = $object->getLanguage(); - $data['Dialect'] = $object->getDialect(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Language'] = $data->getLanguage(); + $dataArray['Dialect'] = $data->getDialect(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NotificationLocale::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\NotificationLocale::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/NotificationTextMessageNormalizer.php b/src/Api/Normalizer/NotificationTextMessageNormalizer.php index 31f88dc5..21183e1b 100644 --- a/src/Api/Normalizer/NotificationTextMessageNormalizer.php +++ b/src/Api/Normalizer/NotificationTextMessageNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class NotificationTextMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class NotificationTextMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NotificationTextMessage::class; + return $type === \ShipStream\Ups\Api\Model\NotificationTextMessage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NotificationTextMessage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NotificationTextMessage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NotificationTextMessage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\NotificationTextMessage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PhoneNumber'] = $object->getPhoneNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PhoneNumber', $data)) { + $object->setPhoneNumber($data['PhoneNumber']); + unset($data['PhoneNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NotificationTextMessage::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class NotificationTextMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NotificationTextMessage::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NotificationTextMessage::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NotificationTextMessage(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PhoneNumber'] = $data->getPhoneNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PhoneNumber'] = $object->getPhoneNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NotificationTextMessage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\NotificationTextMessage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/NotificationVoiceMessageNormalizer.php b/src/Api/Normalizer/NotificationVoiceMessageNormalizer.php index 89065553..01c7041b 100644 --- a/src/Api/Normalizer/NotificationVoiceMessageNormalizer.php +++ b/src/Api/Normalizer/NotificationVoiceMessageNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class NotificationVoiceMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class NotificationVoiceMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class; + return $type === \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NotificationVoiceMessage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\NotificationVoiceMessage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PhoneNumber'] = $object->getPhoneNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PhoneNumber', $data)) { + $object->setPhoneNumber($data['PhoneNumber']); + unset($data['PhoneNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NotificationVoiceMessage::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class NotificationVoiceMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\NotificationVoiceMessage(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PhoneNumber'] = $data->getPhoneNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PhoneNumber'] = $object->getPhoneNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\NotificationVoiceMessage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\NotificationVoiceMessage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/OperatingHoursStandardHoursNormalizer.php b/src/Api/Normalizer/OperatingHoursStandardHoursNormalizer.php index 765e67dd..12118843 100644 --- a/src/Api/Normalizer/OperatingHoursStandardHoursNormalizer.php +++ b/src/Api/Normalizer/OperatingHoursStandardHoursNormalizer.php @@ -5,152 +5,75 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class OperatingHoursStandardHoursNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class OperatingHoursStandardHoursNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class; + return $type === \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OperatingHoursStandardHours(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HoursType', $data)) { - $object->setHoursType($data['HoursType']); - unset($data['HoursType']); - } - if (\array_key_exists('DayOfWeek', $data)) { - $values = []; - foreach ($data['DayOfWeek'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class, 'json', $context); - } - $object->setDayOfWeek($values); - unset($data['DayOfWeek']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\OperatingHoursStandardHours(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['HoursType'] = $object->getHoursType(); + if (\array_key_exists('HoursType', $data)) { + $object->setHoursType($data['HoursType']); + unset($data['HoursType']); + } + if (\array_key_exists('DayOfWeek', $data)) { $values = []; - foreach ($object->getDayOfWeek() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['DayOfWeek'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class, 'json', $context); } - $data['DayOfWeek'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setDayOfWeek($values); + unset($data['DayOfWeek']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class OperatingHoursStandardHoursNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class; + $dataArray = []; + $dataArray['HoursType'] = $data->getHoursType(); + $values = []; + foreach ($data->getDayOfWeek() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['DayOfWeek'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OperatingHoursStandardHours(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('HoursType', $data)) { - $object->setHoursType($data['HoursType']); - unset($data['HoursType']); - } - if (\array_key_exists('DayOfWeek', $data)) { - $values = []; - foreach ($data['DayOfWeek'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class, 'json', $context); - } - $object->setDayOfWeek($values); - unset($data['DayOfWeek']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['HoursType'] = $object->getHoursType(); - $values = []; - foreach ($object->getDayOfWeek() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['DayOfWeek'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\OperatingHoursStandardHours::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/OptionCodeTransportationPickUpScheduleNormalizer.php b/src/Api/Normalizer/OptionCodeTransportationPickUpScheduleNormalizer.php index 2b4fd319..81d495cd 100644 --- a/src/Api/Normalizer/OptionCodeTransportationPickUpScheduleNormalizer.php +++ b/src/Api/Normalizer/OptionCodeTransportationPickUpScheduleNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class OptionCodeTransportationPickUpScheduleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class OptionCodeTransportationPickUpScheduleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class; + return $type === \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickUp', $data)) { - $values = []; - foreach ($data['PickUp'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class, 'json', $context); - } - $object->setPickUp($values); - unset($data['PickUp']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('PickUp', $data)) { $values = []; - foreach ($object->getPickUp() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['PickUp'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class, 'json', $context); } - $data['PickUp'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setPickUp($values); + unset($data['PickUp']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class OptionCodeTransportationPickUpScheduleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class; + $dataArray = []; + $values = []; + foreach ($data->getPickUp() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['PickUp'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickUp', $data)) { - $values = []; - foreach ($data['PickUp'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class, 'json', $context); - } - $object->setPickUp($values); - unset($data['PickUp']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getPickUp() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PickUp'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\OptionCodeTransportationPickUpSchedule::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/OriginActivityLocationNormalizer.php b/src/Api/Normalizer/OriginActivityLocationNormalizer.php index 148beb0b..1911994c 100644 --- a/src/Api/Normalizer/OriginActivityLocationNormalizer.php +++ b/src/Api/Normalizer/OriginActivityLocationNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class OriginActivityLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class OriginActivityLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginActivityLocation::class; + return $type === \ShipStream\Ups\Api\Model\OriginActivityLocation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginActivityLocation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginActivityLocation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginActivityLocation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressArtifactFormat', $data)) { - $object->setAddressArtifactFormat($this->denormalizer->denormalize($data['AddressArtifactFormat'], \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class, 'json', $context)); - unset($data['AddressArtifactFormat']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\OriginActivityLocation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AddressArtifactFormat'] = $this->normalizer->normalize($object->getAddressArtifactFormat(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressArtifactFormat', $data)) { + $object->setAddressArtifactFormat($this->denormalizer->denormalize($data['AddressArtifactFormat'], \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class, 'json', $context)); + unset($data['AddressArtifactFormat']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginActivityLocation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class OriginActivityLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginActivityLocation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginActivityLocation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginActivityLocation(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['AddressArtifactFormat'] = $this->normalizer->normalize($data->getAddressArtifactFormat(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('AddressArtifactFormat', $data)) { - $object->setAddressArtifactFormat($this->denormalizer->denormalize($data['AddressArtifactFormat'], \ShipStream\Ups\Api\Model\ActivityLocationAddressArtifactFormat::class, 'json', $context)); - unset($data['AddressArtifactFormat']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AddressArtifactFormat'] = $this->normalizer->normalize($object->getAddressArtifactFormat(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginActivityLocation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\OriginActivityLocation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/OriginAddressAddressKeyFormatNormalizer.php b/src/Api/Normalizer/OriginAddressAddressKeyFormatNormalizer.php index 7866b0b4..40ff5e27 100644 --- a/src/Api/Normalizer/OriginAddressAddressKeyFormatNormalizer.php +++ b/src/Api/Normalizer/OriginAddressAddressKeyFormatNormalizer.php @@ -5,250 +5,124 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class OriginAddressAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class OriginAddressAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('AddressLine2', $data)) { - $object->setAddressLine2($data['AddressLine2']); - unset($data['AddressLine2']); - } - if (\array_key_exists('AddressLine3', $data)) { - $object->setAddressLine3($data['AddressLine3']); - unset($data['AddressLine3']); - } - if (\array_key_exists('PoliticalDivision3', $data)) { - $object->setPoliticalDivision3($data['PoliticalDivision3']); - unset($data['PoliticalDivision3']); - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - if (\array_key_exists('PostcodeExtendedLow', $data)) { - $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); - unset($data['PostcodeExtendedLow']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('SingleLineAddress', $data)) { - $object->setSingleLineAddress($data['SingleLineAddress']); - unset($data['SingleLineAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - $data['AddressLine'] = $object->getAddressLine(); - if ($object->isInitialized('addressLine2') && null !== $object->getAddressLine2()) { - $data['AddressLine2'] = $object->getAddressLine2(); - } - if ($object->isInitialized('addressLine3') && null !== $object->getAddressLine3()) { - $data['AddressLine3'] = $object->getAddressLine3(); - } - if ($object->isInitialized('politicalDivision3') && null !== $object->getPoliticalDivision3()) { - $data['PoliticalDivision3'] = $object->getPoliticalDivision3(); - } - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - if ($object->isInitialized('postcodeExtendedLow') && null !== $object->getPostcodeExtendedLow()) { - $data['PostcodeExtendedLow'] = $object->getPostcodeExtendedLow(); - } - $data['CountryCode'] = $object->getCountryCode(); - if ($object->isInitialized('singleLineAddress') && null !== $object->getSingleLineAddress()) { - $data['SingleLineAddress'] = $object->getSingleLineAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ConsigneeName', $data)) { + $object->setConsigneeName($data['ConsigneeName']); + unset($data['ConsigneeName']); + } + if (\array_key_exists('AddressLine', $data)) { + $object->setAddressLine($data['AddressLine']); + unset($data['AddressLine']); + } + if (\array_key_exists('AddressLine2', $data)) { + $object->setAddressLine2($data['AddressLine2']); + unset($data['AddressLine2']); + } + if (\array_key_exists('AddressLine3', $data)) { + $object->setAddressLine3($data['AddressLine3']); + unset($data['AddressLine3']); + } + if (\array_key_exists('PoliticalDivision3', $data)) { + $object->setPoliticalDivision3($data['PoliticalDivision3']); + unset($data['PoliticalDivision3']); + } + if (\array_key_exists('PoliticalDivision2', $data)) { + $object->setPoliticalDivision2($data['PoliticalDivision2']); + unset($data['PoliticalDivision2']); + } + if (\array_key_exists('PoliticalDivision1', $data)) { + $object->setPoliticalDivision1($data['PoliticalDivision1']); + unset($data['PoliticalDivision1']); + } + if (\array_key_exists('PostcodePrimaryLow', $data)) { + $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); + unset($data['PostcodePrimaryLow']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class => false]; + if (\array_key_exists('PostcodeExtendedLow', $data)) { + $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); + unset($data['PostcodeExtendedLow']); } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + if (\array_key_exists('SingleLineAddress', $data)) { + $object->setSingleLineAddress($data['SingleLineAddress']); + unset($data['SingleLineAddress']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class OriginAddressAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('AddressLine2', $data)) { - $object->setAddressLine2($data['AddressLine2']); - unset($data['AddressLine2']); - } - if (\array_key_exists('AddressLine3', $data)) { - $object->setAddressLine3($data['AddressLine3']); - unset($data['AddressLine3']); - } - if (\array_key_exists('PoliticalDivision3', $data)) { - $object->setPoliticalDivision3($data['PoliticalDivision3']); - unset($data['PoliticalDivision3']); - } - if (\array_key_exists('PoliticalDivision2', $data)) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - if (\array_key_exists('PostcodeExtendedLow', $data)) { - $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); - unset($data['PostcodeExtendedLow']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('SingleLineAddress', $data)) { - $object->setSingleLineAddress($data['SingleLineAddress']); - unset($data['SingleLineAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('consigneeName') && null !== $data->getConsigneeName()) { + $dataArray['ConsigneeName'] = $data->getConsigneeName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - $data['AddressLine'] = $object->getAddressLine(); - if ($object->isInitialized('addressLine2') && null !== $object->getAddressLine2()) { - $data['AddressLine2'] = $object->getAddressLine2(); - } - if ($object->isInitialized('addressLine3') && null !== $object->getAddressLine3()) { - $data['AddressLine3'] = $object->getAddressLine3(); - } - if ($object->isInitialized('politicalDivision3') && null !== $object->getPoliticalDivision3()) { - $data['PoliticalDivision3'] = $object->getPoliticalDivision3(); - } - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - if ($object->isInitialized('postcodeExtendedLow') && null !== $object->getPostcodeExtendedLow()) { - $data['PostcodeExtendedLow'] = $object->getPostcodeExtendedLow(); - } - $data['CountryCode'] = $object->getCountryCode(); - if ($object->isInitialized('singleLineAddress') && null !== $object->getSingleLineAddress()) { - $data['SingleLineAddress'] = $object->getSingleLineAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + $dataArray['AddressLine'] = $data->getAddressLine(); + if ($data->isInitialized('addressLine2') && null !== $data->getAddressLine2()) { + $dataArray['AddressLine2'] = $data->getAddressLine2(); + } + if ($data->isInitialized('addressLine3') && null !== $data->getAddressLine3()) { + $dataArray['AddressLine3'] = $data->getAddressLine3(); + } + if ($data->isInitialized('politicalDivision3') && null !== $data->getPoliticalDivision3()) { + $dataArray['PoliticalDivision3'] = $data->getPoliticalDivision3(); + } + $dataArray['PoliticalDivision2'] = $data->getPoliticalDivision2(); + $dataArray['PoliticalDivision1'] = $data->getPoliticalDivision1(); + $dataArray['PostcodePrimaryLow'] = $data->getPostcodePrimaryLow(); + if ($data->isInitialized('postcodeExtendedLow') && null !== $data->getPostcodeExtendedLow()) { + $dataArray['PostcodeExtendedLow'] = $data->getPostcodeExtendedLow(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + if ($data->isInitialized('singleLineAddress') && null !== $data->getSingleLineAddress()) { + $dataArray['SingleLineAddress'] = $data->getSingleLineAddress(); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\OriginAddressAddressKeyFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/OriginAddressGeocodeNormalizer.php b/src/Api/Normalizer/OriginAddressGeocodeNormalizer.php index ebe570ba..451a3ee4 100644 --- a/src/Api/Normalizer/OriginAddressGeocodeNormalizer.php +++ b/src/Api/Normalizer/OriginAddressGeocodeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class OriginAddressGeocodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class OriginAddressGeocodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginAddressGeocode::class; + return $type === \ShipStream\Ups\Api\Model\OriginAddressGeocode::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginAddressGeocode::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginAddressGeocode::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginAddressGeocode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Latitude', $data)) { - $object->setLatitude($data['Latitude']); - unset($data['Latitude']); - } - if (\array_key_exists('Longitude', $data)) { - $object->setLongitude($data['Longitude']); - unset($data['Longitude']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\OriginAddressGeocode(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Latitude'] = $object->getLatitude(); - $data['Longitude'] = $object->getLongitude(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginAddressGeocode::class => false]; - } - } -} else { - class OriginAddressGeocodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginAddressGeocode::class; + if (\array_key_exists('Latitude', $data)) { + $object->setLatitude($data['Latitude']); + unset($data['Latitude']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginAddressGeocode::class; + if (\array_key_exists('Longitude', $data)) { + $object->setLongitude($data['Longitude']); + unset($data['Longitude']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginAddressGeocode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Latitude', $data)) { - $object->setLatitude($data['Latitude']); - unset($data['Latitude']); - } - if (\array_key_exists('Longitude', $data)) { - $object->setLongitude($data['Longitude']); - unset($data['Longitude']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Latitude'] = $object->getLatitude(); - $data['Longitude'] = $object->getLongitude(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Latitude'] = $data->getLatitude(); + $dataArray['Longitude'] = $data->getLongitude(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginAddressGeocode::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\OriginAddressGeocode::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/OriginAddressOriginSearchCriteriaNormalizer.php b/src/Api/Normalizer/OriginAddressOriginSearchCriteriaNormalizer.php index 704295ee..65aa379e 100644 --- a/src/Api/Normalizer/OriginAddressOriginSearchCriteriaNormalizer.php +++ b/src/Api/Normalizer/OriginAddressOriginSearchCriteriaNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class OriginAddressOriginSearchCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class OriginAddressOriginSearchCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class; + return $type === \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SearchRadius', $data)) { - $object->setSearchRadius($data['SearchRadius']); - unset($data['SearchRadius']); - } - if (\array_key_exists('DistanceUnitOfMeasure', $data)) { - $object->setDistanceUnitOfMeasure($data['DistanceUnitOfMeasure']); - unset($data['DistanceUnitOfMeasure']); - } - if (\array_key_exists('MaximumLocation', $data)) { - $object->setMaximumLocation($data['MaximumLocation']); - unset($data['MaximumLocation']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('searchRadius') && null !== $object->getSearchRadius()) { - $data['SearchRadius'] = $object->getSearchRadius(); - } - $data['DistanceUnitOfMeasure'] = $object->getDistanceUnitOfMeasure(); - if ($object->isInitialized('maximumLocation') && null !== $object->getMaximumLocation()) { - $data['MaximumLocation'] = $object->getMaximumLocation(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('SearchRadius', $data)) { + $object->setSearchRadius($data['SearchRadius']); + unset($data['SearchRadius']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class => false]; + if (\array_key_exists('DistanceUnitOfMeasure', $data)) { + $object->setDistanceUnitOfMeasure($data['DistanceUnitOfMeasure']); + unset($data['DistanceUnitOfMeasure']); } + if (\array_key_exists('MaximumLocation', $data)) { + $object->setMaximumLocation($data['MaximumLocation']); + unset($data['MaximumLocation']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class OriginAddressOriginSearchCriteriaNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class; + $dataArray = []; + if ($data->isInitialized('searchRadius') && null !== $data->getSearchRadius()) { + $dataArray['SearchRadius'] = $data->getSearchRadius(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class; + $dataArray['DistanceUnitOfMeasure'] = $data->getDistanceUnitOfMeasure(); + if ($data->isInitialized('maximumLocation') && null !== $data->getMaximumLocation()) { + $dataArray['MaximumLocation'] = $data->getMaximumLocation(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SearchRadius', $data)) { - $object->setSearchRadius($data['SearchRadius']); - unset($data['SearchRadius']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('DistanceUnitOfMeasure', $data)) { - $object->setDistanceUnitOfMeasure($data['DistanceUnitOfMeasure']); - unset($data['DistanceUnitOfMeasure']); - } - if (\array_key_exists('MaximumLocation', $data)) { - $object->setMaximumLocation($data['MaximumLocation']); - unset($data['MaximumLocation']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('searchRadius') && null !== $object->getSearchRadius()) { - $data['SearchRadius'] = $object->getSearchRadius(); - } - $data['DistanceUnitOfMeasure'] = $object->getDistanceUnitOfMeasure(); - if ($object->isInitialized('maximumLocation') && null !== $object->getMaximumLocation()) { - $data['MaximumLocation'] = $object->getMaximumLocation(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/OriginBillToAccountNormalizer.php b/src/Api/Normalizer/OriginBillToAccountNormalizer.php index 413602e4..a9d5671f 100644 --- a/src/Api/Normalizer/OriginBillToAccountNormalizer.php +++ b/src/Api/Normalizer/OriginBillToAccountNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class OriginBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class OriginBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginBillToAccount::class; + return $type === \ShipStream\Ups\Api\Model\OriginBillToAccount::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginBillToAccount::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginBillToAccount::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginBillToAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\OriginBillToAccount(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Option'] = $object->getOption(); - $data['Number'] = $object->getNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginBillToAccount::class => false]; - } - } -} else { - class OriginBillToAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginBillToAccount::class; + if (\array_key_exists('Option', $data)) { + $object->setOption($data['Option']); + unset($data['Option']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginBillToAccount::class; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginBillToAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Option', $data)) { - $object->setOption($data['Option']); - unset($data['Option']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Option'] = $object->getOption(); - $data['Number'] = $object->getNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Option'] = $data->getOption(); + $dataArray['Number'] = $data->getNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginBillToAccount::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\OriginBillToAccount::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/OriginPackageReferenceNumberNormalizer.php b/src/Api/Normalizer/OriginPackageReferenceNumberNormalizer.php index 40c80e26..94492b2b 100644 --- a/src/Api/Normalizer/OriginPackageReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/OriginPackageReferenceNumberNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class OriginPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class OriginPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('BarCodeIndicator', $data)) { + $object->setBarCodeIndicator($data['BarCodeIndicator']); + unset($data['BarCodeIndicator']); + } + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class => false]; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class OriginPackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class; + $dataArray = []; + if ($data->isInitialized('barCodeIndicator') && null !== $data->getBarCodeIndicator()) { + $dataArray['BarCodeIndicator'] = $data->getBarCodeIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/OriginShipmentReferenceNumberNormalizer.php b/src/Api/Normalizer/OriginShipmentReferenceNumberNormalizer.php index 566c016b..625f527d 100644 --- a/src/Api/Normalizer/OriginShipmentReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/OriginShipmentReferenceNumberNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class OriginShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class OriginShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('BarCodeIndicator', $data)) { + $object->setBarCodeIndicator($data['BarCodeIndicator']); + unset($data['BarCodeIndicator']); + } + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class => false]; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class OriginShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class; + $dataArray = []; + if ($data->isInitialized('barCodeIndicator') && null !== $data->getBarCodeIndicator()) { + $dataArray['BarCodeIndicator'] = $data->getBarCodeIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/OverSeasLegDimensionsNormalizer.php b/src/Api/Normalizer/OverSeasLegDimensionsNormalizer.php index 78940974..8098e6c3 100644 --- a/src/Api/Normalizer/OverSeasLegDimensionsNormalizer.php +++ b/src/Api/Normalizer/OverSeasLegDimensionsNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class OverSeasLegDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class OverSeasLegDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class; + return $type === \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OverSeasLegDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Volume', $data)) { - $object->setVolume($data['Volume']); - unset($data['Volume']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\OverSeasLegDimensions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('volume') && null !== $object->getVolume()) { - $data['Volume'] = $object->getVolume(); - } - $data['Height'] = $object->getHeight(); - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Volume', $data)) { + $object->setVolume($data['Volume']); + unset($data['Volume']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OverSeasLegDimensions::class => false]; + if (\array_key_exists('Height', $data)) { + $object->setHeight($data['Height']); + unset($data['Height']); } - } -} else { - class OverSeasLegDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class; + if (\array_key_exists('Length', $data)) { + $object->setLength($data['Length']); + unset($data['Length']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class; + if (\array_key_exists('Width', $data)) { + $object->setWidth($data['Width']); + unset($data['Width']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OverSeasLegDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Volume', $data)) { - $object->setVolume($data['Volume']); - unset($data['Volume']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('volume') && null !== $object->getVolume()) { - $data['Volume'] = $object->getVolume(); - } - $data['Height'] = $object->getHeight(); - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OverSeasLegDimensions::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('volume') && null !== $data->getVolume()) { + $dataArray['Volume'] = $data->getVolume(); + } + $dataArray['Height'] = $data->getHeight(); + $dataArray['Length'] = $data->getLength(); + $dataArray['Width'] = $data->getWidth(); + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\OverSeasLegDimensions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/OverSeasLegValueNormalizer.php b/src/Api/Normalizer/OverSeasLegValueNormalizer.php index b6ca5436..6c47f134 100644 --- a/src/Api/Normalizer/OverSeasLegValueNormalizer.php +++ b/src/Api/Normalizer/OverSeasLegValueNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class OverSeasLegValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class OverSeasLegValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OverSeasLegValue::class; + return $type === \ShipStream\Ups\Api\Model\OverSeasLegValue::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OverSeasLegValue::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OverSeasLegValue::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OverSeasLegValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Cube', $data)) { - $object->setCube($this->denormalizer->denormalize($data['Cube'], \ShipStream\Ups\Api\Model\ValueCube::class, 'json', $context)); - unset($data['Cube']); - } - if (\array_key_exists('CWT', $data)) { - $object->setCWT($this->denormalizer->denormalize($data['CWT'], \ShipStream\Ups\Api\Model\ValueCWT::class, 'json', $context)); - unset($data['CWT']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\OverSeasLegValue(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('cube') && null !== $object->getCube()) { - $data['Cube'] = $this->normalizer->normalize($object->getCube(), 'json', $context); - } - if ($object->isInitialized('cWT') && null !== $object->getCWT()) { - $data['CWT'] = $this->normalizer->normalize($object->getCWT(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Cube', $data)) { + $object->setCube($this->denormalizer->denormalize($data['Cube'], \ShipStream\Ups\Api\Model\ValueCube::class, 'json', $context)); + unset($data['Cube']); + } + if (\array_key_exists('CWT', $data)) { + $object->setCWT($this->denormalizer->denormalize($data['CWT'], \ShipStream\Ups\Api\Model\ValueCWT::class, 'json', $context)); + unset($data['CWT']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OverSeasLegValue::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class OverSeasLegValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\OverSeasLegValue::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\OverSeasLegValue::class; + $dataArray = []; + if ($data->isInitialized('cube') && null !== $data->getCube()) { + $dataArray['Cube'] = $this->normalizer->normalize($data->getCube(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\OverSeasLegValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Cube', $data)) { - $object->setCube($this->denormalizer->denormalize($data['Cube'], \ShipStream\Ups\Api\Model\ValueCube::class, 'json', $context)); - unset($data['Cube']); - } - if (\array_key_exists('CWT', $data)) { - $object->setCWT($this->denormalizer->denormalize($data['CWT'], \ShipStream\Ups\Api\Model\ValueCWT::class, 'json', $context)); - unset($data['CWT']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('cWT') && null !== $data->getCWT()) { + $dataArray['CWT'] = $this->normalizer->normalize($data->getCWT(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('cube') && null !== $object->getCube()) { - $data['Cube'] = $this->normalizer->normalize($object->getCube(), 'json', $context); - } - if ($object->isInitialized('cWT') && null !== $object->getCWT()) { - $data['CWT'] = $this->normalizer->normalize($object->getCWT(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\OverSeasLegValue::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\OverSeasLegValue::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PAPERLESSDOCUMENTDeleteRequestWrapperNormalizer.php b/src/Api/Normalizer/PAPERLESSDOCUMENTDeleteRequestWrapperNormalizer.php index 3f18f825..d6dfd70c 100644 --- a/src/Api/Normalizer/PAPERLESSDOCUMENTDeleteRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/PAPERLESSDOCUMENTDeleteRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PAPERLESSDOCUMENTDeleteRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PAPERLESSDOCUMENTDeleteRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DeleteRequest', $data)) { - $object->setDeleteRequest($this->denormalizer->denormalize($data['DeleteRequest'], \ShipStream\Ups\Api\Model\DeleteRequest::class, 'json', $context)); - unset($data['DeleteRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['DeleteRequest'] = $this->normalizer->normalize($object->getDeleteRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DeleteRequest', $data)) { + $object->setDeleteRequest($this->denormalizer->denormalize($data['DeleteRequest'], \ShipStream\Ups\Api\Model\DeleteRequest::class, 'json', $context)); + unset($data['DeleteRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PAPERLESSDOCUMENTDeleteRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['DeleteRequest'] = $this->normalizer->normalize($data->getDeleteRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('DeleteRequest', $data)) { - $object->setDeleteRequest($this->denormalizer->denormalize($data['DeleteRequest'], \ShipStream\Ups\Api\Model\DeleteRequest::class, 'json', $context)); - unset($data['DeleteRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['DeleteRequest'] = $this->normalizer->normalize($object->getDeleteRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PAPERLESSDOCUMENTDeleteResponseWrapperNormalizer.php b/src/Api/Normalizer/PAPERLESSDOCUMENTDeleteResponseWrapperNormalizer.php index e2a26307..cb1f3c96 100644 --- a/src/Api/Normalizer/PAPERLESSDOCUMENTDeleteResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/PAPERLESSDOCUMENTDeleteResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PAPERLESSDOCUMENTDeleteResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PAPERLESSDOCUMENTDeleteResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DeleteResponse', $data)) { - $object->setDeleteResponse($this->denormalizer->denormalize($data['DeleteResponse'], \ShipStream\Ups\Api\Model\DeleteResponse::class, 'json', $context)); - unset($data['DeleteResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['DeleteResponse'] = $this->normalizer->normalize($object->getDeleteResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DeleteResponse', $data)) { + $object->setDeleteResponse($this->denormalizer->denormalize($data['DeleteResponse'], \ShipStream\Ups\Api\Model\DeleteResponse::class, 'json', $context)); + unset($data['DeleteResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PAPERLESSDOCUMENTDeleteResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['DeleteResponse'] = $this->normalizer->normalize($data->getDeleteResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('DeleteResponse', $data)) { - $object->setDeleteResponse($this->denormalizer->denormalize($data['DeleteResponse'], \ShipStream\Ups\Api\Model\DeleteResponse::class, 'json', $context)); - unset($data['DeleteResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['DeleteResponse'] = $this->normalizer->normalize($object->getDeleteResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTDeleteResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PAPERLESSDOCUMENTRequestWrapperNormalizer.php b/src/Api/Normalizer/PAPERLESSDOCUMENTRequestWrapperNormalizer.php index 5597e7ef..4447f023 100644 --- a/src/Api/Normalizer/PAPERLESSDOCUMENTRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/PAPERLESSDOCUMENTRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PAPERLESSDOCUMENTRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PAPERLESSDOCUMENTRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PushToImageRepositoryRequest', $data)) { - $object->setPushToImageRepositoryRequest($this->denormalizer->denormalize($data['PushToImageRepositoryRequest'], \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class, 'json', $context)); - unset($data['PushToImageRepositoryRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PushToImageRepositoryRequest'] = $this->normalizer->normalize($object->getPushToImageRepositoryRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PushToImageRepositoryRequest', $data)) { + $object->setPushToImageRepositoryRequest($this->denormalizer->denormalize($data['PushToImageRepositoryRequest'], \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class, 'json', $context)); + unset($data['PushToImageRepositoryRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PAPERLESSDOCUMENTRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PushToImageRepositoryRequest'] = $this->normalizer->normalize($data->getPushToImageRepositoryRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PushToImageRepositoryRequest', $data)) { - $object->setPushToImageRepositoryRequest($this->denormalizer->denormalize($data['PushToImageRepositoryRequest'], \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class, 'json', $context)); - unset($data['PushToImageRepositoryRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PushToImageRepositoryRequest'] = $this->normalizer->normalize($object->getPushToImageRepositoryRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PAPERLESSDOCUMENTResponseWrapperNormalizer.php b/src/Api/Normalizer/PAPERLESSDOCUMENTResponseWrapperNormalizer.php index fa9a4f57..02508314 100644 --- a/src/Api/Normalizer/PAPERLESSDOCUMENTResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/PAPERLESSDOCUMENTResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PAPERLESSDOCUMENTResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PAPERLESSDOCUMENTResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PushToImageRepositoryResponse', $data)) { - $object->setPushToImageRepositoryResponse($this->denormalizer->denormalize($data['PushToImageRepositoryResponse'], \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class, 'json', $context)); - unset($data['PushToImageRepositoryResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PushToImageRepositoryResponse'] = $this->normalizer->normalize($object->getPushToImageRepositoryResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PushToImageRepositoryResponse', $data)) { + $object->setPushToImageRepositoryResponse($this->denormalizer->denormalize($data['PushToImageRepositoryResponse'], \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class, 'json', $context)); + unset($data['PushToImageRepositoryResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PAPERLESSDOCUMENTResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PushToImageRepositoryResponse'] = $this->normalizer->normalize($data->getPushToImageRepositoryResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PushToImageRepositoryResponse', $data)) { - $object->setPushToImageRepositoryResponse($this->denormalizer->denormalize($data['PushToImageRepositoryResponse'], \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class, 'json', $context)); - unset($data['PushToImageRepositoryResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PushToImageRepositoryResponse'] = $this->normalizer->normalize($object->getPushToImageRepositoryResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PAPERLESSDOCUMENTUploadRequestWrapperNormalizer.php b/src/Api/Normalizer/PAPERLESSDOCUMENTUploadRequestWrapperNormalizer.php index 1418ccf1..f2d59e1e 100644 --- a/src/Api/Normalizer/PAPERLESSDOCUMENTUploadRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/PAPERLESSDOCUMENTUploadRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PAPERLESSDOCUMENTUploadRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PAPERLESSDOCUMENTUploadRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UploadRequest', $data)) { - $object->setUploadRequest($this->denormalizer->denormalize($data['UploadRequest'], \ShipStream\Ups\Api\Model\UploadRequest::class, 'json', $context)); - unset($data['UploadRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UploadRequest'] = $this->normalizer->normalize($object->getUploadRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('UploadRequest', $data)) { + $object->setUploadRequest($this->denormalizer->denormalize($data['UploadRequest'], \ShipStream\Ups\Api\Model\UploadRequest::class, 'json', $context)); + unset($data['UploadRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PAPERLESSDOCUMENTUploadRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['UploadRequest'] = $this->normalizer->normalize($data->getUploadRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('UploadRequest', $data)) { - $object->setUploadRequest($this->denormalizer->denormalize($data['UploadRequest'], \ShipStream\Ups\Api\Model\UploadRequest::class, 'json', $context)); - unset($data['UploadRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UploadRequest'] = $this->normalizer->normalize($object->getUploadRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PAPERLESSDOCUMENTUploadResponseWrapperNormalizer.php b/src/Api/Normalizer/PAPERLESSDOCUMENTUploadResponseWrapperNormalizer.php index 4a9b32b8..b2a1abe1 100644 --- a/src/Api/Normalizer/PAPERLESSDOCUMENTUploadResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/PAPERLESSDOCUMENTUploadResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PAPERLESSDOCUMENTUploadResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PAPERLESSDOCUMENTUploadResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UploadResponse', $data)) { - $object->setUploadResponse($this->denormalizer->denormalize($data['UploadResponse'], \ShipStream\Ups\Api\Model\UploadResponse::class, 'json', $context)); - unset($data['UploadResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UploadResponse'] = $this->normalizer->normalize($object->getUploadResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('UploadResponse', $data)) { + $object->setUploadResponse($this->denormalizer->denormalize($data['UploadResponse'], \ShipStream\Ups\Api\Model\UploadResponse::class, 'json', $context)); + unset($data['UploadResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PAPERLESSDOCUMENTUploadResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['UploadResponse'] = $this->normalizer->normalize($data->getUploadResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('UploadResponse', $data)) { - $object->setUploadResponse($this->denormalizer->denormalize($data['UploadResponse'], \ShipStream\Ups\Api\Model\UploadResponse::class, 'json', $context)); - unset($data['UploadResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UploadResponse'] = $this->normalizer->normalize($object->getUploadResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PAPERLESSDOCUMENTUploadResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PICKUPCancelRequestWrapperNormalizer.php b/src/Api/Normalizer/PICKUPCancelRequestWrapperNormalizer.php index e37e2171..8549e2e6 100644 --- a/src/Api/Normalizer/PICKUPCancelRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/PICKUPCancelRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PICKUPCancelRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PICKUPCancelRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupCancelRequest', $data)) { - $object->setPickupCancelRequest($this->denormalizer->denormalize($data['PickupCancelRequest'], \ShipStream\Ups\Api\Model\PickupCancelRequest::class, 'json', $context)); - unset($data['PickupCancelRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupCancelRequest'] = $this->normalizer->normalize($object->getPickupCancelRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupCancelRequest', $data)) { + $object->setPickupCancelRequest($this->denormalizer->denormalize($data['PickupCancelRequest'], \ShipStream\Ups\Api\Model\PickupCancelRequest::class, 'json', $context)); + unset($data['PickupCancelRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PICKUPCancelRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PickupCancelRequest'] = $this->normalizer->normalize($data->getPickupCancelRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PickupCancelRequest', $data)) { - $object->setPickupCancelRequest($this->denormalizer->denormalize($data['PickupCancelRequest'], \ShipStream\Ups\Api\Model\PickupCancelRequest::class, 'json', $context)); - unset($data['PickupCancelRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupCancelRequest'] = $this->normalizer->normalize($object->getPickupCancelRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PICKUPCancelRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PICKUPCancelResponseWrapperNormalizer.php b/src/Api/Normalizer/PICKUPCancelResponseWrapperNormalizer.php index 402f4ffa..79aad3b0 100644 --- a/src/Api/Normalizer/PICKUPCancelResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/PICKUPCancelResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PICKUPCancelResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PICKUPCancelResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupCancelResponse', $data)) { - $object->setPickupCancelResponse($this->denormalizer->denormalize($data['PickupCancelResponse'], \ShipStream\Ups\Api\Model\PickupCancelResponse::class, 'json', $context)); - unset($data['PickupCancelResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupCancelResponse'] = $this->normalizer->normalize($object->getPickupCancelResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupCancelResponse', $data)) { + $object->setPickupCancelResponse($this->denormalizer->denormalize($data['PickupCancelResponse'], \ShipStream\Ups\Api\Model\PickupCancelResponse::class, 'json', $context)); + unset($data['PickupCancelResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PICKUPCancelResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PickupCancelResponse'] = $this->normalizer->normalize($data->getPickupCancelResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PickupCancelResponse', $data)) { - $object->setPickupCancelResponse($this->denormalizer->denormalize($data['PickupCancelResponse'], \ShipStream\Ups\Api\Model\PickupCancelResponse::class, 'json', $context)); - unset($data['PickupCancelResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupCancelResponse'] = $this->normalizer->normalize($object->getPickupCancelResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PICKUPCancelResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PICKUPCreationRequestWrapperNormalizer.php b/src/Api/Normalizer/PICKUPCreationRequestWrapperNormalizer.php index 6288d7d9..f219d02a 100644 --- a/src/Api/Normalizer/PICKUPCreationRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/PICKUPCreationRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PICKUPCreationRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PICKUPCreationRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupCreationRequest', $data)) { - $object->setPickupCreationRequest($this->denormalizer->denormalize($data['PickupCreationRequest'], \ShipStream\Ups\Api\Model\PickupCreationRequest::class, 'json', $context)); - unset($data['PickupCreationRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupCreationRequest'] = $this->normalizer->normalize($object->getPickupCreationRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupCreationRequest', $data)) { + $object->setPickupCreationRequest($this->denormalizer->denormalize($data['PickupCreationRequest'], \ShipStream\Ups\Api\Model\PickupCreationRequest::class, 'json', $context)); + unset($data['PickupCreationRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PICKUPCreationRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PickupCreationRequest'] = $this->normalizer->normalize($data->getPickupCreationRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PickupCreationRequest', $data)) { - $object->setPickupCreationRequest($this->denormalizer->denormalize($data['PickupCreationRequest'], \ShipStream\Ups\Api\Model\PickupCreationRequest::class, 'json', $context)); - unset($data['PickupCreationRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupCreationRequest'] = $this->normalizer->normalize($object->getPickupCreationRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PICKUPCreationRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PICKUPCreationResponseWrapperNormalizer.php b/src/Api/Normalizer/PICKUPCreationResponseWrapperNormalizer.php index 8ddb9be3..5844677d 100644 --- a/src/Api/Normalizer/PICKUPCreationResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/PICKUPCreationResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PICKUPCreationResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PICKUPCreationResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupCreationResponse', $data)) { - $object->setPickupCreationResponse($this->denormalizer->denormalize($data['PickupCreationResponse'], \ShipStream\Ups\Api\Model\PickupCreationResponse::class, 'json', $context)); - unset($data['PickupCreationResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupCreationResponse'] = $this->normalizer->normalize($object->getPickupCreationResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupCreationResponse', $data)) { + $object->setPickupCreationResponse($this->denormalizer->denormalize($data['PickupCreationResponse'], \ShipStream\Ups\Api\Model\PickupCreationResponse::class, 'json', $context)); + unset($data['PickupCreationResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PICKUPCreationResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PickupCreationResponse'] = $this->normalizer->normalize($data->getPickupCreationResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PickupCreationResponse', $data)) { - $object->setPickupCreationResponse($this->denormalizer->denormalize($data['PickupCreationResponse'], \ShipStream\Ups\Api\Model\PickupCreationResponse::class, 'json', $context)); - unset($data['PickupCreationResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupCreationResponse'] = $this->normalizer->normalize($object->getPickupCreationResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PICKUPCreationResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PICKUPPendingRequestWrapperNormalizer.php b/src/Api/Normalizer/PICKUPPendingRequestWrapperNormalizer.php index d6f5b796..a508546f 100644 --- a/src/Api/Normalizer/PICKUPPendingRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/PICKUPPendingRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PICKUPPendingRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PICKUPPendingRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupPendingStatusRequest', $data)) { - $object->setPickupPendingStatusRequest($this->denormalizer->denormalize($data['PickupPendingStatusRequest'], \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class, 'json', $context)); - unset($data['PickupPendingStatusRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupPendingStatusRequest'] = $this->normalizer->normalize($object->getPickupPendingStatusRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupPendingStatusRequest', $data)) { + $object->setPickupPendingStatusRequest($this->denormalizer->denormalize($data['PickupPendingStatusRequest'], \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class, 'json', $context)); + unset($data['PickupPendingStatusRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PICKUPPendingRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PickupPendingStatusRequest'] = $this->normalizer->normalize($data->getPickupPendingStatusRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PickupPendingStatusRequest', $data)) { - $object->setPickupPendingStatusRequest($this->denormalizer->denormalize($data['PickupPendingStatusRequest'], \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class, 'json', $context)); - unset($data['PickupPendingStatusRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupPendingStatusRequest'] = $this->normalizer->normalize($object->getPickupPendingStatusRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PICKUPPendingRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PICKUPPendingResponseWrapperNormalizer.php b/src/Api/Normalizer/PICKUPPendingResponseWrapperNormalizer.php index 805d3f05..c576901c 100644 --- a/src/Api/Normalizer/PICKUPPendingResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/PICKUPPendingResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PICKUPPendingResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PICKUPPendingResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupPendingStatusResponse', $data)) { - $object->setPickupPendingStatusResponse($this->denormalizer->denormalize($data['PickupPendingStatusResponse'], \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class, 'json', $context)); - unset($data['PickupPendingStatusResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupPendingStatusResponse'] = $this->normalizer->normalize($object->getPickupPendingStatusResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupPendingStatusResponse', $data)) { + $object->setPickupPendingStatusResponse($this->denormalizer->denormalize($data['PickupPendingStatusResponse'], \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class, 'json', $context)); + unset($data['PickupPendingStatusResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PICKUPPendingResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PickupPendingStatusResponse'] = $this->normalizer->normalize($data->getPickupPendingStatusResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PickupPendingStatusResponse', $data)) { - $object->setPickupPendingStatusResponse($this->denormalizer->denormalize($data['PickupPendingStatusResponse'], \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class, 'json', $context)); - unset($data['PickupPendingStatusResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupPendingStatusResponse'] = $this->normalizer->normalize($object->getPickupPendingStatusResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PICKUPPendingResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PICKUPPolDivRequestWrapperNormalizer.php b/src/Api/Normalizer/PICKUPPolDivRequestWrapperNormalizer.php index c162491a..166ccc7f 100644 --- a/src/Api/Normalizer/PICKUPPolDivRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/PICKUPPolDivRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PICKUPPolDivRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PICKUPPolDivRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupGetPoliticalDivision1ListRequest', $data)) { - $object->setPickupGetPoliticalDivision1ListRequest($this->denormalizer->denormalize($data['PickupGetPoliticalDivision1ListRequest'], \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class, 'json', $context)); - unset($data['PickupGetPoliticalDivision1ListRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupGetPoliticalDivision1ListRequest'] = $this->normalizer->normalize($object->getPickupGetPoliticalDivision1ListRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupGetPoliticalDivision1ListRequest', $data)) { + $object->setPickupGetPoliticalDivision1ListRequest($this->denormalizer->denormalize($data['PickupGetPoliticalDivision1ListRequest'], \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class, 'json', $context)); + unset($data['PickupGetPoliticalDivision1ListRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PICKUPPolDivRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PickupGetPoliticalDivision1ListRequest'] = $this->normalizer->normalize($data->getPickupGetPoliticalDivision1ListRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PickupGetPoliticalDivision1ListRequest', $data)) { - $object->setPickupGetPoliticalDivision1ListRequest($this->denormalizer->denormalize($data['PickupGetPoliticalDivision1ListRequest'], \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class, 'json', $context)); - unset($data['PickupGetPoliticalDivision1ListRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupGetPoliticalDivision1ListRequest'] = $this->normalizer->normalize($object->getPickupGetPoliticalDivision1ListRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PICKUPPolDivRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PICKUPPolDivResponseWrapperNormalizer.php b/src/Api/Normalizer/PICKUPPolDivResponseWrapperNormalizer.php index 33aa7d67..26848ebb 100644 --- a/src/Api/Normalizer/PICKUPPolDivResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/PICKUPPolDivResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PICKUPPolDivResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PICKUPPolDivResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupGetPoliticalDivision1ListResponse', $data)) { - $object->setPickupGetPoliticalDivision1ListResponse($this->denormalizer->denormalize($data['PickupGetPoliticalDivision1ListResponse'], \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class, 'json', $context)); - unset($data['PickupGetPoliticalDivision1ListResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupGetPoliticalDivision1ListResponse'] = $this->normalizer->normalize($object->getPickupGetPoliticalDivision1ListResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupGetPoliticalDivision1ListResponse', $data)) { + $object->setPickupGetPoliticalDivision1ListResponse($this->denormalizer->denormalize($data['PickupGetPoliticalDivision1ListResponse'], \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class, 'json', $context)); + unset($data['PickupGetPoliticalDivision1ListResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PICKUPPolDivResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PickupGetPoliticalDivision1ListResponse'] = $this->normalizer->normalize($data->getPickupGetPoliticalDivision1ListResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PickupGetPoliticalDivision1ListResponse', $data)) { - $object->setPickupGetPoliticalDivision1ListResponse($this->denormalizer->denormalize($data['PickupGetPoliticalDivision1ListResponse'], \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class, 'json', $context)); - unset($data['PickupGetPoliticalDivision1ListResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupGetPoliticalDivision1ListResponse'] = $this->normalizer->normalize($object->getPickupGetPoliticalDivision1ListResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PICKUPPolDivResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PICKUPRequestWrapperNormalizer.php b/src/Api/Normalizer/PICKUPRequestWrapperNormalizer.php index c8e03340..a9adc309 100644 --- a/src/Api/Normalizer/PICKUPRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/PICKUPRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PICKUPRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PICKUPRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupRateRequest', $data)) { - $object->setPickupRateRequest($this->denormalizer->denormalize($data['PickupRateRequest'], \ShipStream\Ups\Api\Model\PickupRateRequest::class, 'json', $context)); - unset($data['PickupRateRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PICKUPRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupRateRequest'] = $this->normalizer->normalize($object->getPickupRateRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupRateRequest', $data)) { + $object->setPickupRateRequest($this->denormalizer->denormalize($data['PickupRateRequest'], \ShipStream\Ups\Api\Model\PickupRateRequest::class, 'json', $context)); + unset($data['PickupRateRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PICKUPRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PickupRateRequest'] = $this->normalizer->normalize($data->getPickupRateRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PickupRateRequest', $data)) { - $object->setPickupRateRequest($this->denormalizer->denormalize($data['PickupRateRequest'], \ShipStream\Ups\Api\Model\PickupRateRequest::class, 'json', $context)); - unset($data['PickupRateRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupRateRequest'] = $this->normalizer->normalize($object->getPickupRateRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PICKUPRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PICKUPResponseWrapperNormalizer.php b/src/Api/Normalizer/PICKUPResponseWrapperNormalizer.php index e1f0c12e..382d4b0c 100644 --- a/src/Api/Normalizer/PICKUPResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/PICKUPResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PICKUPResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PICKUPResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupRateResponse', $data)) { - $object->setPickupRateResponse($this->denormalizer->denormalize($data['PickupRateResponse'], \ShipStream\Ups\Api\Model\PickupRateResponse::class, 'json', $context)); - unset($data['PickupRateResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PICKUPResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupRateResponse'] = $this->normalizer->normalize($object->getPickupRateResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupRateResponse', $data)) { + $object->setPickupRateResponse($this->denormalizer->denormalize($data['PickupRateResponse'], \ShipStream\Ups\Api\Model\PickupRateResponse::class, 'json', $context)); + unset($data['PickupRateResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PICKUPResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PickupRateResponse'] = $this->normalizer->normalize($data->getPickupRateResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PickupRateResponse', $data)) { - $object->setPickupRateResponse($this->denormalizer->denormalize($data['PickupRateResponse'], \ShipStream\Ups\Api\Model\PickupRateResponse::class, 'json', $context)); - unset($data['PickupRateResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupRateResponse'] = $this->normalizer->normalize($object->getPickupRateResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PICKUPResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PICKUPServCenterRequestWrapperNormalizer.php b/src/Api/Normalizer/PICKUPServCenterRequestWrapperNormalizer.php index cf243c65..da3f9dd4 100644 --- a/src/Api/Normalizer/PICKUPServCenterRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/PICKUPServCenterRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PICKUPServCenterRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PICKUPServCenterRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupGetServiceCenterFacilitiesRequest', $data)) { - $object->setPickupGetServiceCenterFacilitiesRequest($this->denormalizer->denormalize($data['PickupGetServiceCenterFacilitiesRequest'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class, 'json', $context)); - unset($data['PickupGetServiceCenterFacilitiesRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupGetServiceCenterFacilitiesRequest'] = $this->normalizer->normalize($object->getPickupGetServiceCenterFacilitiesRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupGetServiceCenterFacilitiesRequest', $data)) { + $object->setPickupGetServiceCenterFacilitiesRequest($this->denormalizer->denormalize($data['PickupGetServiceCenterFacilitiesRequest'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class, 'json', $context)); + unset($data['PickupGetServiceCenterFacilitiesRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PICKUPServCenterRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PickupGetServiceCenterFacilitiesRequest'] = $this->normalizer->normalize($data->getPickupGetServiceCenterFacilitiesRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PickupGetServiceCenterFacilitiesRequest', $data)) { - $object->setPickupGetServiceCenterFacilitiesRequest($this->denormalizer->denormalize($data['PickupGetServiceCenterFacilitiesRequest'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class, 'json', $context)); - unset($data['PickupGetServiceCenterFacilitiesRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupGetServiceCenterFacilitiesRequest'] = $this->normalizer->normalize($object->getPickupGetServiceCenterFacilitiesRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PICKUPServCenterRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PICKUPServCenterResponseWrapperNormalizer.php b/src/Api/Normalizer/PICKUPServCenterResponseWrapperNormalizer.php index a443ce57..aa3ad976 100644 --- a/src/Api/Normalizer/PICKUPServCenterResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/PICKUPServCenterResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PICKUPServCenterResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PICKUPServCenterResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupGetServiceCenterFacilitiesResponse', $data)) { - $object->setPickupGetServiceCenterFacilitiesResponse($this->denormalizer->denormalize($data['PickupGetServiceCenterFacilitiesResponse'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class, 'json', $context)); - unset($data['PickupGetServiceCenterFacilitiesResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupGetServiceCenterFacilitiesResponse'] = $this->normalizer->normalize($object->getPickupGetServiceCenterFacilitiesResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupGetServiceCenterFacilitiesResponse', $data)) { + $object->setPickupGetServiceCenterFacilitiesResponse($this->denormalizer->denormalize($data['PickupGetServiceCenterFacilitiesResponse'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class, 'json', $context)); + unset($data['PickupGetServiceCenterFacilitiesResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PICKUPServCenterResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PickupGetServiceCenterFacilitiesResponse'] = $this->normalizer->normalize($data->getPickupGetServiceCenterFacilitiesResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PickupGetServiceCenterFacilitiesResponse', $data)) { - $object->setPickupGetServiceCenterFacilitiesResponse($this->denormalizer->denormalize($data['PickupGetServiceCenterFacilitiesResponse'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class, 'json', $context)); - unset($data['PickupGetServiceCenterFacilitiesResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupGetServiceCenterFacilitiesResponse'] = $this->normalizer->normalize($object->getPickupGetServiceCenterFacilitiesResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PICKUPServCenterResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/POMPickupNotificationsNormalizer.php b/src/Api/Normalizer/POMPickupNotificationsNormalizer.php index 4399497d..869d40ac 100644 --- a/src/Api/Normalizer/POMPickupNotificationsNormalizer.php +++ b/src/Api/Normalizer/POMPickupNotificationsNormalizer.php @@ -5,174 +5,86 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class POMPickupNotificationsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class POMPickupNotificationsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\POMPickupNotifications::class; + return $type === \ShipStream\Ups\Api\Model\POMPickupNotifications::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\POMPickupNotifications::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\POMPickupNotifications::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\POMPickupNotifications(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('EMailNotification', $data)) { - $values = []; - foreach ($data['EMailNotification'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class, 'json', $context); - } - $object->setEMailNotification($values); - unset($data['EMailNotification']); - } - if (\array_key_exists('FailedEMail', $data)) { - $object->setFailedEMail($data['FailedEMail']); - unset($data['FailedEMail']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\POMPickupNotifications(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('companyName') && null !== $object->getCompanyName()) { - $data['CompanyName'] = $object->getCompanyName(); - } - if ($object->isInitialized('eMailNotification') && null !== $object->getEMailNotification()) { - $values = []; - foreach ($object->getEMailNotification() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['EMailNotification'] = $values; - } - if ($object->isInitialized('failedEMail') && null !== $object->getFailedEMail()) { - $data['FailedEMail'] = $object->getFailedEMail(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('CompanyName', $data)) { + $object->setCompanyName($data['CompanyName']); + unset($data['CompanyName']); + } + if (\array_key_exists('EMailNotification', $data)) { + $values = []; + foreach ($data['EMailNotification'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class, 'json', $context); } - return $data; + $object->setEMailNotification($values); + unset($data['EMailNotification']); + } + if (\array_key_exists('FailedEMail', $data)) { + $object->setFailedEMail($data['FailedEMail']); + unset($data['FailedEMail']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\POMPickupNotifications::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class POMPickupNotificationsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\POMPickupNotifications::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\POMPickupNotifications::class; + $dataArray = []; + if ($data->isInitialized('companyName') && null !== $data->getCompanyName()) { + $dataArray['CompanyName'] = $data->getCompanyName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\POMPickupNotifications(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('EMailNotification', $data)) { - $values = []; - foreach ($data['EMailNotification'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class, 'json', $context); - } - $object->setEMailNotification($values); - unset($data['EMailNotification']); - } - if (\array_key_exists('FailedEMail', $data)) { - $object->setFailedEMail($data['FailedEMail']); - unset($data['FailedEMail']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + if ($data->isInitialized('eMailNotification') && null !== $data->getEMailNotification()) { + $values = []; + foreach ($data->getEMailNotification() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['EMailNotification'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('companyName') && null !== $object->getCompanyName()) { - $data['CompanyName'] = $object->getCompanyName(); - } - if ($object->isInitialized('eMailNotification') && null !== $object->getEMailNotification()) { - $values = []; - foreach ($object->getEMailNotification() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['EMailNotification'] = $values; - } - if ($object->isInitialized('failedEMail') && null !== $object->getFailedEMail()) { - $data['FailedEMail'] = $object->getFailedEMail(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('failedEMail') && null !== $data->getFailedEMail()) { + $dataArray['FailedEMail'] = $data->getFailedEMail(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\POMPickupNotifications::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\POMPickupNotifications::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PRENOTIFICATIONRequestWrapperNormalizer.php b/src/Api/Normalizer/PRENOTIFICATIONRequestWrapperNormalizer.php index 4de12c02..454fcd4e 100644 --- a/src/Api/Normalizer/PRENOTIFICATIONRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/PRENOTIFICATIONRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PRENOTIFICATIONRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PRENOTIFICATIONRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PreNotificationRequest', $data)) { - $object->setPreNotificationRequest($this->denormalizer->denormalize($data['PreNotificationRequest'], \ShipStream\Ups\Api\Model\PreNotificationRequest::class, 'json', $context)); - unset($data['PreNotificationRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PreNotificationRequest'] = $this->normalizer->normalize($object->getPreNotificationRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PreNotificationRequest', $data)) { + $object->setPreNotificationRequest($this->denormalizer->denormalize($data['PreNotificationRequest'], \ShipStream\Ups\Api\Model\PreNotificationRequest::class, 'json', $context)); + unset($data['PreNotificationRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PRENOTIFICATIONRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PreNotificationRequest'] = $this->normalizer->normalize($data->getPreNotificationRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PreNotificationRequest', $data)) { - $object->setPreNotificationRequest($this->denormalizer->denormalize($data['PreNotificationRequest'], \ShipStream\Ups\Api\Model\PreNotificationRequest::class, 'json', $context)); - unset($data['PreNotificationRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PreNotificationRequest'] = $this->normalizer->normalize($object->getPreNotificationRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PRENOTIFICATIONRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PRENOTIFICATIONResponseWrapperNormalizer.php b/src/Api/Normalizer/PRENOTIFICATIONResponseWrapperNormalizer.php index 8639258b..0aa77920 100644 --- a/src/Api/Normalizer/PRENOTIFICATIONResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/PRENOTIFICATIONResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PRENOTIFICATIONResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PRENOTIFICATIONResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PreNotificationResponse', $data)) { - $object->setPreNotificationResponse($this->denormalizer->denormalize($data['PreNotificationResponse'], \ShipStream\Ups\Api\Model\PreNotificationResponse::class, 'json', $context)); - unset($data['PreNotificationResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PreNotificationResponse'] = $this->normalizer->normalize($object->getPreNotificationResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PreNotificationResponse', $data)) { + $object->setPreNotificationResponse($this->denormalizer->denormalize($data['PreNotificationResponse'], \ShipStream\Ups\Api\Model\PreNotificationResponse::class, 'json', $context)); + unset($data['PreNotificationResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PRENOTIFICATIONResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PreNotificationResponse'] = $this->normalizer->normalize($data->getPreNotificationResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PreNotificationResponse', $data)) { - $object->setPreNotificationResponse($this->denormalizer->denormalize($data['PreNotificationResponse'], \ShipStream\Ups\Api\Model\PreNotificationResponse::class, 'json', $context)); - unset($data['PreNotificationResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PreNotificationResponse'] = $this->normalizer->normalize($object->getPreNotificationResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PRENOTIFICATIONResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageActivityNormalizer.php b/src/Api/Normalizer/PackageActivityNormalizer.php index d2c3f0bc..9286dbe8 100644 --- a/src/Api/Normalizer/PackageActivityNormalizer.php +++ b/src/Api/Normalizer/PackageActivityNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageActivityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageActivityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageActivity::class; + return $type === \ShipStream\Ups\Api\Model\PackageActivity::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageActivity::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageActivity::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageActivity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageActivity(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('date') && null !== $object->getDate()) { - $data['Date'] = $object->getDate(); - } - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['Time'] = $object->getTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Date', $data)) { + $object->setDate($data['Date']); + unset($data['Date']); + } + if (\array_key_exists('Time', $data)) { + $object->setTime($data['Time']); + unset($data['Time']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageActivity::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PackageActivityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageActivity::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageActivity::class; + $dataArray = []; + if ($data->isInitialized('date') && null !== $data->getDate()) { + $dataArray['Date'] = $data->getDate(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageActivity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('time') && null !== $data->getTime()) { + $dataArray['Time'] = $data->getTime(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('date') && null !== $object->getDate()) { - $data['Date'] = $object->getDate(); - } - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['Time'] = $object->getTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageActivity::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageActivity::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageAddressNormalizer.php b/src/Api/Normalizer/PackageAddressNormalizer.php index 3431a5ad..e10d97d3 100644 --- a/src/Api/Normalizer/PackageAddressNormalizer.php +++ b/src/Api/Normalizer/PackageAddressNormalizer.php @@ -5,178 +5,88 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageAddress::class; + return $type === \ShipStream\Ups\Api\Model\PackageAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('address', $data) && $data['address'] !== null) { - $object->setAddress($this->denormalizer->denormalize($data['address'], \ShipStream\Ups\Api\Model\Address::class, 'json', $context)); - unset($data['address']); - } - elseif (\array_key_exists('address', $data) && $data['address'] === null) { - $object->setAddress(null); - } - if (\array_key_exists('attentionName', $data)) { - $object->setAttentionName($data['attentionName']); - unset($data['attentionName']); - } - if (\array_key_exists('name', $data)) { - $object->setName($data['name']); - unset($data['name']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['attentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('address', $data) && $data['address'] !== null) { + $object->setAddress($this->denormalizer->denormalize($data['address'], \ShipStream\Ups\Api\Model\Address::class, 'json', $context)); + unset($data['address']); + } + elseif (\array_key_exists('address', $data) && $data['address'] === null) { + $object->setAddress(null); + } + if (\array_key_exists('attentionName', $data)) { + $object->setAttentionName($data['attentionName']); + unset($data['attentionName']); + } + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageAddress::class => false]; + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PackageAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageAddress::class; + $dataArray = []; + if ($data->isInitialized('address')) { + $dataArray['address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageAddress::class; + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['attentionName'] = $data->getAttentionName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('address', $data) && $data['address'] !== null) { - $object->setAddress($this->denormalizer->denormalize($data['address'], \ShipStream\Ups\Api\Model\Address::class, 'json', $context)); - unset($data['address']); - } - elseif (\array_key_exists('address', $data) && $data['address'] === null) { - $object->setAddress(null); - } - if (\array_key_exists('attentionName', $data)) { - $object->setAttentionName($data['attentionName']); - unset($data['attentionName']); - } - if (\array_key_exists('name', $data)) { - $object->setName($data['name']); - unset($data['name']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('name') && null !== $data->getName()) { + $dataArray['name'] = $data->getName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['attentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('type') && null !== $data->getType()) { + $dataArray['type'] = $data->getType(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageAddress::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageChemicalRecordNormalizer.php b/src/Api/Normalizer/PackageChemicalRecordNormalizer.php index 349daac4..b62efdac 100644 --- a/src/Api/Normalizer/PackageChemicalRecordNormalizer.php +++ b/src/Api/Normalizer/PackageChemicalRecordNormalizer.php @@ -5,374 +5,186 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageChemicalRecordNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageChemicalRecordNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageChemicalRecord::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageChemicalRecord::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageChemicalRecord(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ChemicalRecordIdentifier', $data)) { - $object->setChemicalRecordIdentifier($data['ChemicalRecordIdentifier']); - unset($data['ChemicalRecordIdentifier']); - } - if (\array_key_exists('ReportableQuantity', $data)) { - $object->setReportableQuantity($data['ReportableQuantity']); - unset($data['ReportableQuantity']); - } - if (\array_key_exists('ClassDivisionNumber', $data)) { - $object->setClassDivisionNumber($data['ClassDivisionNumber']); - unset($data['ClassDivisionNumber']); - } - if (\array_key_exists('SubRiskClass', $data)) { - $object->setSubRiskClass($data['SubRiskClass']); - unset($data['SubRiskClass']); - } - if (\array_key_exists('IDNumber', $data)) { - $object->setIDNumber($data['IDNumber']); - unset($data['IDNumber']); - } - if (\array_key_exists('PackagingGroupType', $data)) { - $object->setPackagingGroupType($data['PackagingGroupType']); - unset($data['PackagingGroupType']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('UOM', $data)) { - $object->setUOM($data['UOM']); - unset($data['UOM']); - } - if (\array_key_exists('PackagingInstructionCode', $data)) { - $object->setPackagingInstructionCode($data['PackagingInstructionCode']); - unset($data['PackagingInstructionCode']); - } - if (\array_key_exists('ProperShippingName', $data)) { - $object->setProperShippingName($data['ProperShippingName']); - unset($data['ProperShippingName']); - } - if (\array_key_exists('TechnicalName', $data)) { - $object->setTechnicalName($data['TechnicalName']); - unset($data['TechnicalName']); - } - if (\array_key_exists('AdditionalDescription', $data)) { - $object->setAdditionalDescription($data['AdditionalDescription']); - unset($data['AdditionalDescription']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($data['PackagingType']); - unset($data['PackagingType']); - } - if (\array_key_exists('HazardLabelRequired', $data)) { - $object->setHazardLabelRequired($data['HazardLabelRequired']); - unset($data['HazardLabelRequired']); - } - if (\array_key_exists('PackagingTypeQuantity', $data)) { - $object->setPackagingTypeQuantity($data['PackagingTypeQuantity']); - unset($data['PackagingTypeQuantity']); - } - if (\array_key_exists('CommodityRegulatedLevelCode', $data)) { - $object->setCommodityRegulatedLevelCode($data['CommodityRegulatedLevelCode']); - unset($data['CommodityRegulatedLevelCode']); - } - if (\array_key_exists('TransportCategory', $data)) { - $object->setTransportCategory($data['TransportCategory']); - unset($data['TransportCategory']); - } - if (\array_key_exists('TunnelRestrictionCode', $data)) { - $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); - unset($data['TunnelRestrictionCode']); - } - if (\array_key_exists('AllPackedInOneIndicator', $data)) { - $object->setAllPackedInOneIndicator($data['AllPackedInOneIndicator']); - unset($data['AllPackedInOneIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\PackageChemicalRecord::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageChemicalRecord::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PackageChemicalRecord(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ChemicalRecordIdentifier'] = $object->getChemicalRecordIdentifier(); - if ($object->isInitialized('reportableQuantity') && null !== $object->getReportableQuantity()) { - $data['ReportableQuantity'] = $object->getReportableQuantity(); - } - if ($object->isInitialized('classDivisionNumber') && null !== $object->getClassDivisionNumber()) { - $data['ClassDivisionNumber'] = $object->getClassDivisionNumber(); - } - if ($object->isInitialized('subRiskClass') && null !== $object->getSubRiskClass()) { - $data['SubRiskClass'] = $object->getSubRiskClass(); - } - if ($object->isInitialized('iDNumber') && null !== $object->getIDNumber()) { - $data['IDNumber'] = $object->getIDNumber(); - } - if ($object->isInitialized('packagingGroupType') && null !== $object->getPackagingGroupType()) { - $data['PackagingGroupType'] = $object->getPackagingGroupType(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['Quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('uOM') && null !== $object->getUOM()) { - $data['UOM'] = $object->getUOM(); - } - if ($object->isInitialized('packagingInstructionCode') && null !== $object->getPackagingInstructionCode()) { - $data['PackagingInstructionCode'] = $object->getPackagingInstructionCode(); - } - if ($object->isInitialized('properShippingName') && null !== $object->getProperShippingName()) { - $data['ProperShippingName'] = $object->getProperShippingName(); - } - if ($object->isInitialized('technicalName') && null !== $object->getTechnicalName()) { - $data['TechnicalName'] = $object->getTechnicalName(); - } - if ($object->isInitialized('additionalDescription') && null !== $object->getAdditionalDescription()) { - $data['AdditionalDescription'] = $object->getAdditionalDescription(); - } - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $object->getPackagingType(); - } - if ($object->isInitialized('hazardLabelRequired') && null !== $object->getHazardLabelRequired()) { - $data['HazardLabelRequired'] = $object->getHazardLabelRequired(); - } - if ($object->isInitialized('packagingTypeQuantity') && null !== $object->getPackagingTypeQuantity()) { - $data['PackagingTypeQuantity'] = $object->getPackagingTypeQuantity(); - } - $data['CommodityRegulatedLevelCode'] = $object->getCommodityRegulatedLevelCode(); - if ($object->isInitialized('transportCategory') && null !== $object->getTransportCategory()) { - $data['TransportCategory'] = $object->getTransportCategory(); - } - if ($object->isInitialized('tunnelRestrictionCode') && null !== $object->getTunnelRestrictionCode()) { - $data['TunnelRestrictionCode'] = $object->getTunnelRestrictionCode(); - } - if ($object->isInitialized('allPackedInOneIndicator') && null !== $object->getAllPackedInOneIndicator()) { - $data['AllPackedInOneIndicator'] = $object->getAllPackedInOneIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ChemicalRecordIdentifier', $data)) { + $object->setChemicalRecordIdentifier($data['ChemicalRecordIdentifier']); + unset($data['ChemicalRecordIdentifier']); + } + if (\array_key_exists('ReportableQuantity', $data)) { + $object->setReportableQuantity($data['ReportableQuantity']); + unset($data['ReportableQuantity']); + } + if (\array_key_exists('ClassDivisionNumber', $data)) { + $object->setClassDivisionNumber($data['ClassDivisionNumber']); + unset($data['ClassDivisionNumber']); + } + if (\array_key_exists('SubRiskClass', $data)) { + $object->setSubRiskClass($data['SubRiskClass']); + unset($data['SubRiskClass']); + } + if (\array_key_exists('IDNumber', $data)) { + $object->setIDNumber($data['IDNumber']); + unset($data['IDNumber']); + } + if (\array_key_exists('PackagingGroupType', $data)) { + $object->setPackagingGroupType($data['PackagingGroupType']); + unset($data['PackagingGroupType']); + } + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); + } + if (\array_key_exists('UOM', $data)) { + $object->setUOM($data['UOM']); + unset($data['UOM']); + } + if (\array_key_exists('PackagingInstructionCode', $data)) { + $object->setPackagingInstructionCode($data['PackagingInstructionCode']); + unset($data['PackagingInstructionCode']); + } + if (\array_key_exists('ProperShippingName', $data)) { + $object->setProperShippingName($data['ProperShippingName']); + unset($data['ProperShippingName']); + } + if (\array_key_exists('TechnicalName', $data)) { + $object->setTechnicalName($data['TechnicalName']); + unset($data['TechnicalName']); + } + if (\array_key_exists('AdditionalDescription', $data)) { + $object->setAdditionalDescription($data['AdditionalDescription']); + unset($data['AdditionalDescription']); + } + if (\array_key_exists('PackagingType', $data)) { + $object->setPackagingType($data['PackagingType']); + unset($data['PackagingType']); + } + if (\array_key_exists('HazardLabelRequired', $data)) { + $object->setHazardLabelRequired($data['HazardLabelRequired']); + unset($data['HazardLabelRequired']); + } + if (\array_key_exists('PackagingTypeQuantity', $data)) { + $object->setPackagingTypeQuantity($data['PackagingTypeQuantity']); + unset($data['PackagingTypeQuantity']); + } + if (\array_key_exists('CommodityRegulatedLevelCode', $data)) { + $object->setCommodityRegulatedLevelCode($data['CommodityRegulatedLevelCode']); + unset($data['CommodityRegulatedLevelCode']); + } + if (\array_key_exists('TransportCategory', $data)) { + $object->setTransportCategory($data['TransportCategory']); + unset($data['TransportCategory']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageChemicalRecord::class => false]; + if (\array_key_exists('TunnelRestrictionCode', $data)) { + $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); + unset($data['TunnelRestrictionCode']); } + if (\array_key_exists('AllPackedInOneIndicator', $data)) { + $object->setAllPackedInOneIndicator($data['AllPackedInOneIndicator']); + unset($data['AllPackedInOneIndicator']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PackageChemicalRecordNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageChemicalRecord::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageChemicalRecord::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageChemicalRecord(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ChemicalRecordIdentifier', $data)) { - $object->setChemicalRecordIdentifier($data['ChemicalRecordIdentifier']); - unset($data['ChemicalRecordIdentifier']); - } - if (\array_key_exists('ReportableQuantity', $data)) { - $object->setReportableQuantity($data['ReportableQuantity']); - unset($data['ReportableQuantity']); - } - if (\array_key_exists('ClassDivisionNumber', $data)) { - $object->setClassDivisionNumber($data['ClassDivisionNumber']); - unset($data['ClassDivisionNumber']); - } - if (\array_key_exists('SubRiskClass', $data)) { - $object->setSubRiskClass($data['SubRiskClass']); - unset($data['SubRiskClass']); - } - if (\array_key_exists('IDNumber', $data)) { - $object->setIDNumber($data['IDNumber']); - unset($data['IDNumber']); - } - if (\array_key_exists('PackagingGroupType', $data)) { - $object->setPackagingGroupType($data['PackagingGroupType']); - unset($data['PackagingGroupType']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('UOM', $data)) { - $object->setUOM($data['UOM']); - unset($data['UOM']); - } - if (\array_key_exists('PackagingInstructionCode', $data)) { - $object->setPackagingInstructionCode($data['PackagingInstructionCode']); - unset($data['PackagingInstructionCode']); - } - if (\array_key_exists('ProperShippingName', $data)) { - $object->setProperShippingName($data['ProperShippingName']); - unset($data['ProperShippingName']); - } - if (\array_key_exists('TechnicalName', $data)) { - $object->setTechnicalName($data['TechnicalName']); - unset($data['TechnicalName']); - } - if (\array_key_exists('AdditionalDescription', $data)) { - $object->setAdditionalDescription($data['AdditionalDescription']); - unset($data['AdditionalDescription']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($data['PackagingType']); - unset($data['PackagingType']); - } - if (\array_key_exists('HazardLabelRequired', $data)) { - $object->setHazardLabelRequired($data['HazardLabelRequired']); - unset($data['HazardLabelRequired']); - } - if (\array_key_exists('PackagingTypeQuantity', $data)) { - $object->setPackagingTypeQuantity($data['PackagingTypeQuantity']); - unset($data['PackagingTypeQuantity']); - } - if (\array_key_exists('CommodityRegulatedLevelCode', $data)) { - $object->setCommodityRegulatedLevelCode($data['CommodityRegulatedLevelCode']); - unset($data['CommodityRegulatedLevelCode']); - } - if (\array_key_exists('TransportCategory', $data)) { - $object->setTransportCategory($data['TransportCategory']); - unset($data['TransportCategory']); - } - if (\array_key_exists('TunnelRestrictionCode', $data)) { - $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); - unset($data['TunnelRestrictionCode']); - } - if (\array_key_exists('AllPackedInOneIndicator', $data)) { - $object->setAllPackedInOneIndicator($data['AllPackedInOneIndicator']); - unset($data['AllPackedInOneIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['ChemicalRecordIdentifier'] = $data->getChemicalRecordIdentifier(); + if ($data->isInitialized('reportableQuantity') && null !== $data->getReportableQuantity()) { + $dataArray['ReportableQuantity'] = $data->getReportableQuantity(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ChemicalRecordIdentifier'] = $object->getChemicalRecordIdentifier(); - if ($object->isInitialized('reportableQuantity') && null !== $object->getReportableQuantity()) { - $data['ReportableQuantity'] = $object->getReportableQuantity(); - } - if ($object->isInitialized('classDivisionNumber') && null !== $object->getClassDivisionNumber()) { - $data['ClassDivisionNumber'] = $object->getClassDivisionNumber(); - } - if ($object->isInitialized('subRiskClass') && null !== $object->getSubRiskClass()) { - $data['SubRiskClass'] = $object->getSubRiskClass(); - } - if ($object->isInitialized('iDNumber') && null !== $object->getIDNumber()) { - $data['IDNumber'] = $object->getIDNumber(); - } - if ($object->isInitialized('packagingGroupType') && null !== $object->getPackagingGroupType()) { - $data['PackagingGroupType'] = $object->getPackagingGroupType(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['Quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('uOM') && null !== $object->getUOM()) { - $data['UOM'] = $object->getUOM(); - } - if ($object->isInitialized('packagingInstructionCode') && null !== $object->getPackagingInstructionCode()) { - $data['PackagingInstructionCode'] = $object->getPackagingInstructionCode(); - } - if ($object->isInitialized('properShippingName') && null !== $object->getProperShippingName()) { - $data['ProperShippingName'] = $object->getProperShippingName(); - } - if ($object->isInitialized('technicalName') && null !== $object->getTechnicalName()) { - $data['TechnicalName'] = $object->getTechnicalName(); - } - if ($object->isInitialized('additionalDescription') && null !== $object->getAdditionalDescription()) { - $data['AdditionalDescription'] = $object->getAdditionalDescription(); - } - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $object->getPackagingType(); - } - if ($object->isInitialized('hazardLabelRequired') && null !== $object->getHazardLabelRequired()) { - $data['HazardLabelRequired'] = $object->getHazardLabelRequired(); - } - if ($object->isInitialized('packagingTypeQuantity') && null !== $object->getPackagingTypeQuantity()) { - $data['PackagingTypeQuantity'] = $object->getPackagingTypeQuantity(); - } - $data['CommodityRegulatedLevelCode'] = $object->getCommodityRegulatedLevelCode(); - if ($object->isInitialized('transportCategory') && null !== $object->getTransportCategory()) { - $data['TransportCategory'] = $object->getTransportCategory(); - } - if ($object->isInitialized('tunnelRestrictionCode') && null !== $object->getTunnelRestrictionCode()) { - $data['TunnelRestrictionCode'] = $object->getTunnelRestrictionCode(); - } - if ($object->isInitialized('allPackedInOneIndicator') && null !== $object->getAllPackedInOneIndicator()) { - $data['AllPackedInOneIndicator'] = $object->getAllPackedInOneIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('classDivisionNumber') && null !== $data->getClassDivisionNumber()) { + $dataArray['ClassDivisionNumber'] = $data->getClassDivisionNumber(); + } + if ($data->isInitialized('subRiskClass') && null !== $data->getSubRiskClass()) { + $dataArray['SubRiskClass'] = $data->getSubRiskClass(); + } + if ($data->isInitialized('iDNumber') && null !== $data->getIDNumber()) { + $dataArray['IDNumber'] = $data->getIDNumber(); + } + if ($data->isInitialized('packagingGroupType') && null !== $data->getPackagingGroupType()) { + $dataArray['PackagingGroupType'] = $data->getPackagingGroupType(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageChemicalRecord::class => false]; + if ($data->isInitialized('quantity') && null !== $data->getQuantity()) { + $dataArray['Quantity'] = $data->getQuantity(); } + if ($data->isInitialized('uOM') && null !== $data->getUOM()) { + $dataArray['UOM'] = $data->getUOM(); + } + if ($data->isInitialized('packagingInstructionCode') && null !== $data->getPackagingInstructionCode()) { + $dataArray['PackagingInstructionCode'] = $data->getPackagingInstructionCode(); + } + if ($data->isInitialized('properShippingName') && null !== $data->getProperShippingName()) { + $dataArray['ProperShippingName'] = $data->getProperShippingName(); + } + if ($data->isInitialized('technicalName') && null !== $data->getTechnicalName()) { + $dataArray['TechnicalName'] = $data->getTechnicalName(); + } + if ($data->isInitialized('additionalDescription') && null !== $data->getAdditionalDescription()) { + $dataArray['AdditionalDescription'] = $data->getAdditionalDescription(); + } + if ($data->isInitialized('packagingType') && null !== $data->getPackagingType()) { + $dataArray['PackagingType'] = $data->getPackagingType(); + } + if ($data->isInitialized('hazardLabelRequired') && null !== $data->getHazardLabelRequired()) { + $dataArray['HazardLabelRequired'] = $data->getHazardLabelRequired(); + } + if ($data->isInitialized('packagingTypeQuantity') && null !== $data->getPackagingTypeQuantity()) { + $dataArray['PackagingTypeQuantity'] = $data->getPackagingTypeQuantity(); + } + $dataArray['CommodityRegulatedLevelCode'] = $data->getCommodityRegulatedLevelCode(); + if ($data->isInitialized('transportCategory') && null !== $data->getTransportCategory()) { + $dataArray['TransportCategory'] = $data->getTransportCategory(); + } + if ($data->isInitialized('tunnelRestrictionCode') && null !== $data->getTunnelRestrictionCode()) { + $dataArray['TunnelRestrictionCode'] = $data->getTunnelRestrictionCode(); + } + if ($data->isInitialized('allPackedInOneIndicator') && null !== $data->getAllPackedInOneIndicator()) { + $dataArray['AllPackedInOneIndicator'] = $data->getAllPackedInOneIndicator(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageChemicalRecord::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageCommodityNormalizer.php b/src/Api/Normalizer/PackageCommodityNormalizer.php index 14773a23..ff167bb3 100644 --- a/src/Api/Normalizer/PackageCommodityNormalizer.php +++ b/src/Api/Normalizer/PackageCommodityNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageCommodity::class; + return $type === \ShipStream\Ups\Api\Model\PackageCommodity::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageCommodity::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageCommodity::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageCommodity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightClass', $data)) { - $object->setFreightClass($data['FreightClass']); - unset($data['FreightClass']); - } - if (\array_key_exists('NMFC', $data)) { - $object->setNMFC($this->denormalizer->denormalize($data['NMFC'], \ShipStream\Ups\Api\Model\CommodityNMFC::class, 'json', $context)); - unset($data['NMFC']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageCommodity(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['FreightClass'] = $object->getFreightClass(); - if ($object->isInitialized('nMFC') && null !== $object->getNMFC()) { - $data['NMFC'] = $this->normalizer->normalize($object->getNMFC(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('FreightClass', $data)) { + $object->setFreightClass($data['FreightClass']); + unset($data['FreightClass']); + } + if (\array_key_exists('NMFC', $data)) { + $object->setNMFC($this->denormalizer->denormalize($data['NMFC'], \ShipStream\Ups\Api\Model\CommodityNMFC::class, 'json', $context)); + unset($data['NMFC']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageCommodity::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PackageCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageCommodity::class; + $dataArray = []; + $dataArray['FreightClass'] = $data->getFreightClass(); + if ($data->isInitialized('nMFC') && null !== $data->getNMFC()) { + $dataArray['NMFC'] = $this->normalizer->normalize($data->getNMFC(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageCommodity::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageCommodity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightClass', $data)) { - $object->setFreightClass($data['FreightClass']); - unset($data['FreightClass']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('NMFC', $data)) { - $object->setNMFC($this->denormalizer->denormalize($data['NMFC'], \ShipStream\Ups\Api\Model\CommodityNMFC::class, 'json', $context)); - unset($data['NMFC']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['FreightClass'] = $object->getFreightClass(); - if ($object->isInitialized('nMFC') && null !== $object->getNMFC()) { - $data['NMFC'] = $this->normalizer->normalize($object->getNMFC(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageCommodity::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageCommodity::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageDimWeightNormalizer.php b/src/Api/Normalizer/PackageDimWeightNormalizer.php index 05e1bbf3..d13fc733 100644 --- a/src/Api/Normalizer/PackageDimWeightNormalizer.php +++ b/src/Api/Normalizer/PackageDimWeightNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageDimWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageDimWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageDimWeight::class; + return $type === \ShipStream\Ups\Api\Model\PackageDimWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageDimWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageDimWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageDimWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageDimWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['Weight'] = $object->getWeight(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); + } + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageDimWeight::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PackageDimWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageDimWeight::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageDimWeight::class; + $dataArray = []; + if ($data->isInitialized('unitOfMeasurement') && null !== $data->getUnitOfMeasurement()) { + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageDimWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('weight') && null !== $data->getWeight()) { + $dataArray['Weight'] = $data->getWeight(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['Weight'] = $object->getWeight(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageDimWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageDimWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageDimensionalWeightNormalizer.php b/src/Api/Normalizer/PackageDimensionalWeightNormalizer.php index 45feacdd..7990fa9a 100644 --- a/src/Api/Normalizer/PackageDimensionalWeightNormalizer.php +++ b/src/Api/Normalizer/PackageDimensionalWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageDimensionalWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageDimensionalWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class; + return $type === \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageDimensionalWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageDimensionalWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageDimensionalWeight::class => false]; - } - } -} else { - class PackageDimensionalWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageDimensionalWeight::class; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageDimensionalWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionalWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Weight'] = $data->getWeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageDimensionalWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageDimensionalWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageDimensionsNormalizer.php b/src/Api/Normalizer/PackageDimensionsNormalizer.php index 30696b18..7bdc4b64 100644 --- a/src/Api/Normalizer/PackageDimensionsNormalizer.php +++ b/src/Api/Normalizer/PackageDimensionsNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageDimensions::class; + return $type === \ShipStream\Ups\Api\Model\PackageDimensions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageDimensions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageDimensions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageDimensions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['Height'] = $object->getHeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageDimensions::class => false]; + if (\array_key_exists('Length', $data)) { + $object->setLength($data['Length']); + unset($data['Length']); } - } -} else { - class PackageDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageDimensions::class; + if (\array_key_exists('Width', $data)) { + $object->setWidth($data['Width']); + unset($data['Width']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageDimensions::class; + if (\array_key_exists('Height', $data)) { + $object->setHeight($data['Height']); + unset($data['Height']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['Height'] = $object->getHeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Length'] = $data->getLength(); + $dataArray['Width'] = $data->getWidth(); + $dataArray['Height'] = $data->getHeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageDimensions::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageDimensions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageHazMatPackageInformationNormalizer.php b/src/Api/Normalizer/PackageHazMatPackageInformationNormalizer.php index d9d90361..81319588 100644 --- a/src/Api/Normalizer/PackageHazMatPackageInformationNormalizer.php +++ b/src/Api/Normalizer/PackageHazMatPackageInformationNormalizer.php @@ -5,172 +5,85 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageHazMatPackageInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageHazMatPackageInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class; + return $type === \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AllPackedInOneIndicator', $data)) { - $object->setAllPackedInOneIndicator($data['AllPackedInOneIndicator']); - unset($data['AllPackedInOneIndicator']); - } - if (\array_key_exists('OverPackedIndicator', $data)) { - $object->setOverPackedIndicator($data['OverPackedIndicator']); - unset($data['OverPackedIndicator']); - } - if (\array_key_exists('QValue', $data)) { - $object->setQValue($data['QValue']); - unset($data['QValue']); - } - if (\array_key_exists('OuterPackagingType', $data)) { - $object->setOuterPackagingType($data['OuterPackagingType']); - unset($data['OuterPackagingType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('allPackedInOneIndicator') && null !== $object->getAllPackedInOneIndicator()) { - $data['AllPackedInOneIndicator'] = $object->getAllPackedInOneIndicator(); - } - if ($object->isInitialized('overPackedIndicator') && null !== $object->getOverPackedIndicator()) { - $data['OverPackedIndicator'] = $object->getOverPackedIndicator(); - } - if ($object->isInitialized('qValue') && null !== $object->getQValue()) { - $data['QValue'] = $object->getQValue(); - } - if ($object->isInitialized('outerPackagingType') && null !== $object->getOuterPackagingType()) { - $data['OuterPackagingType'] = $object->getOuterPackagingType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AllPackedInOneIndicator', $data)) { + $object->setAllPackedInOneIndicator($data['AllPackedInOneIndicator']); + unset($data['AllPackedInOneIndicator']); + } + if (\array_key_exists('OverPackedIndicator', $data)) { + $object->setOverPackedIndicator($data['OverPackedIndicator']); + unset($data['OverPackedIndicator']); + } + if (\array_key_exists('QValue', $data)) { + $object->setQValue($data['QValue']); + unset($data['QValue']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class => false]; + if (\array_key_exists('OuterPackagingType', $data)) { + $object->setOuterPackagingType($data['OuterPackagingType']); + unset($data['OuterPackagingType']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PackageHazMatPackageInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class; + $dataArray = []; + if ($data->isInitialized('allPackedInOneIndicator') && null !== $data->getAllPackedInOneIndicator()) { + $dataArray['AllPackedInOneIndicator'] = $data->getAllPackedInOneIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class; + if ($data->isInitialized('overPackedIndicator') && null !== $data->getOverPackedIndicator()) { + $dataArray['OverPackedIndicator'] = $data->getOverPackedIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AllPackedInOneIndicator', $data)) { - $object->setAllPackedInOneIndicator($data['AllPackedInOneIndicator']); - unset($data['AllPackedInOneIndicator']); - } - if (\array_key_exists('OverPackedIndicator', $data)) { - $object->setOverPackedIndicator($data['OverPackedIndicator']); - unset($data['OverPackedIndicator']); - } - if (\array_key_exists('QValue', $data)) { - $object->setQValue($data['QValue']); - unset($data['QValue']); - } - if (\array_key_exists('OuterPackagingType', $data)) { - $object->setOuterPackagingType($data['OuterPackagingType']); - unset($data['OuterPackagingType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('qValue') && null !== $data->getQValue()) { + $dataArray['QValue'] = $data->getQValue(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('allPackedInOneIndicator') && null !== $object->getAllPackedInOneIndicator()) { - $data['AllPackedInOneIndicator'] = $object->getAllPackedInOneIndicator(); - } - if ($object->isInitialized('overPackedIndicator') && null !== $object->getOverPackedIndicator()) { - $data['OverPackedIndicator'] = $object->getOverPackedIndicator(); - } - if ($object->isInitialized('qValue') && null !== $object->getQValue()) { - $data['QValue'] = $object->getQValue(); - } - if ($object->isInitialized('outerPackagingType') && null !== $object->getOuterPackagingType()) { - $data['OuterPackagingType'] = $object->getOuterPackagingType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('outerPackagingType') && null !== $data->getOuterPackagingType()) { + $dataArray['OuterPackagingType'] = $data->getOuterPackagingType(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageLevelResultStatusNormalizer.php b/src/Api/Normalizer/PackageLevelResultStatusNormalizer.php index 0af2eb00..39b55e53 100644 --- a/src/Api/Normalizer/PackageLevelResultStatusNormalizer.php +++ b/src/Api/Normalizer/PackageLevelResultStatusNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageLevelResultStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageLevelResultStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class; + return $type === \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageLevelResultStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageLevelResultStatus(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageLevelResultStatus::class => false]; - } - } -} else { - class PackageLevelResultStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageLevelResultStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageLevelResultStatus::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageLevelResultStatus::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageNormalizer.php b/src/Api/Normalizer/PackageNormalizer.php index 1f43ef13..2d317a57 100644 --- a/src/Api/Normalizer/PackageNormalizer.php +++ b/src/Api/Normalizer/PackageNormalizer.php @@ -5,562 +5,280 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Package::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Package::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Package(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('accessPointInformation', $data)) { - $object->setAccessPointInformation($this->denormalizer->denormalize($data['accessPointInformation'], \ShipStream\Ups\Api\Model\AccessPointInformation::class, 'json', $context)); - unset($data['accessPointInformation']); - } - if (\array_key_exists('activity', $data)) { - $values = []; - foreach ($data['activity'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Activity::class, 'json', $context); - } - $object->setActivity($values); - unset($data['activity']); - } - if (\array_key_exists('additionalAttributes', $data)) { - $values_1 = []; - foreach ($data['additionalAttributes'] as $value_1) { - $values_1[] = $value_1; - } - $object->setAdditionalAttributes($values_1); - unset($data['additionalAttributes']); - } - if (\array_key_exists('additionalServices', $data)) { - $values_2 = []; - foreach ($data['additionalServices'] as $value_2) { - $values_2[] = $value_2; - } - $object->setAdditionalServices($values_2); - unset($data['additionalServices']); - } - if (\array_key_exists('alternateTrackingNumber', $data)) { - $values_3 = []; - foreach ($data['alternateTrackingNumber'] as $value_3) { - $values_3[] = $this->denormalizer->denormalize($value_3, \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class, 'json', $context); - } - $object->setAlternateTrackingNumber($values_3); - unset($data['alternateTrackingNumber']); - } - if (\array_key_exists('currentStatus', $data)) { - $object->setCurrentStatus($this->denormalizer->denormalize($data['currentStatus'], \ShipStream\Ups\Api\Model\Status::class, 'json', $context)); - unset($data['currentStatus']); - } - if (\array_key_exists('deliveryDate', $data)) { - $values_4 = []; - foreach ($data['deliveryDate'] as $value_4) { - $values_4[] = $this->denormalizer->denormalize($value_4, \ShipStream\Ups\Api\Model\DeliveryDate::class, 'json', $context); - } - $object->setDeliveryDate($values_4); - unset($data['deliveryDate']); - } - if (\array_key_exists('deliveryInformation', $data)) { - $object->setDeliveryInformation($this->denormalizer->denormalize($data['deliveryInformation'], \ShipStream\Ups\Api\Model\DeliveryInformation::class, 'json', $context)); - unset($data['deliveryInformation']); - } - if (\array_key_exists('deliveryTime', $data)) { - $object->setDeliveryTime($this->denormalizer->denormalize($data['deliveryTime'], \ShipStream\Ups\Api\Model\DeliveryTime::class, 'json', $context)); - unset($data['deliveryTime']); - } - if (\array_key_exists('milestones', $data)) { - $values_5 = []; - foreach ($data['milestones'] as $value_5) { - $values_5[] = $this->denormalizer->denormalize($value_5, \ShipStream\Ups\Api\Model\Milestones::class, 'json', $context); - } - $object->setMilestones($values_5); - unset($data['milestones']); - } - if (\array_key_exists('packageAddress', $data)) { - $values_6 = []; - foreach ($data['packageAddress'] as $value_6) { - $values_6[] = $this->denormalizer->denormalize($value_6, \ShipStream\Ups\Api\Model\PackageAddress::class, 'json', $context); - } - $object->setPackageAddress($values_6); - unset($data['packageAddress']); - } - if (\array_key_exists('packageCount', $data)) { - $object->setPackageCount($data['packageCount']); - unset($data['packageCount']); - } - if (\array_key_exists('paymentInformation', $data)) { - $values_7 = []; - foreach ($data['paymentInformation'] as $value_7) { - $values_7[] = $this->denormalizer->denormalize($value_7, \ShipStream\Ups\Api\Model\PaymentInformation::class, 'json', $context); - } - $object->setPaymentInformation($values_7); - unset($data['paymentInformation']); - } - if (\array_key_exists('referenceNumber', $data)) { - $values_8 = []; - foreach ($data['referenceNumber'] as $value_8) { - $values_8[] = $this->denormalizer->denormalize($value_8, \ShipStream\Ups\Api\Model\ReferenceNumber::class, 'json', $context); - } - $object->setReferenceNumber($values_8); - unset($data['referenceNumber']); - } - if (\array_key_exists('service', $data)) { - $object->setService($this->denormalizer->denormalize($data['service'], \ShipStream\Ups\Api\Model\Service::class, 'json', $context)); - unset($data['service']); - } - if (\array_key_exists('statusCode', $data)) { - $object->setStatusCode($data['statusCode']); - unset($data['statusCode']); - } - if (\array_key_exists('statusDescription', $data)) { - $object->setStatusDescription($data['statusDescription']); - unset($data['statusDescription']); - } - if (\array_key_exists('suppressionIndicators', $data)) { - $values_9 = []; - foreach ($data['suppressionIndicators'] as $value_9) { - $values_9[] = $value_9; - } - $object->setSuppressionIndicators($values_9); - unset($data['suppressionIndicators']); - } - if (\array_key_exists('trackingNumber', $data)) { - $object->setTrackingNumber($data['trackingNumber']); - unset($data['trackingNumber']); - } - if (\array_key_exists('weight', $data) && $data['weight'] !== null) { - $object->setWeight($this->denormalizer->denormalize($data['weight'], \ShipStream\Ups\Api\Model\Weight::class, 'json', $context)); - unset($data['weight']); - } - elseif (\array_key_exists('weight', $data) && $data['weight'] === null) { - $object->setWeight(null); - } - foreach ($data as $key => $value_10) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_10; - } - } + return $type === \ShipStream\Ups\Api\Model\Package::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Package::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\Package(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('accessPointInformation') && null !== $object->getAccessPointInformation()) { - $data['accessPointInformation'] = $this->normalizer->normalize($object->getAccessPointInformation(), 'json', $context); - } - if ($object->isInitialized('activity') && null !== $object->getActivity()) { - $values = []; - foreach ($object->getActivity() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['activity'] = $values; - } - if ($object->isInitialized('additionalAttributes') && null !== $object->getAdditionalAttributes()) { - $values_1 = []; - foreach ($object->getAdditionalAttributes() as $value_1) { - $values_1[] = $value_1; - } - $data['additionalAttributes'] = $values_1; - } - if ($object->isInitialized('additionalServices') && null !== $object->getAdditionalServices()) { - $values_2 = []; - foreach ($object->getAdditionalServices() as $value_2) { - $values_2[] = $value_2; - } - $data['additionalServices'] = $values_2; - } - if ($object->isInitialized('alternateTrackingNumber') && null !== $object->getAlternateTrackingNumber()) { - $values_3 = []; - foreach ($object->getAlternateTrackingNumber() as $value_3) { - $values_3[] = $this->normalizer->normalize($value_3, 'json', $context); - } - $data['alternateTrackingNumber'] = $values_3; - } - if ($object->isInitialized('currentStatus') && null !== $object->getCurrentStatus()) { - $data['currentStatus'] = $this->normalizer->normalize($object->getCurrentStatus(), 'json', $context); - } - if ($object->isInitialized('deliveryDate') && null !== $object->getDeliveryDate()) { - $values_4 = []; - foreach ($object->getDeliveryDate() as $value_4) { - $values_4[] = $this->normalizer->normalize($value_4, 'json', $context); - } - $data['deliveryDate'] = $values_4; - } - if ($object->isInitialized('deliveryInformation') && null !== $object->getDeliveryInformation()) { - $data['deliveryInformation'] = $this->normalizer->normalize($object->getDeliveryInformation(), 'json', $context); - } - if ($object->isInitialized('deliveryTime') && null !== $object->getDeliveryTime()) { - $data['deliveryTime'] = $this->normalizer->normalize($object->getDeliveryTime(), 'json', $context); - } - if ($object->isInitialized('milestones') && null !== $object->getMilestones()) { - $values_5 = []; - foreach ($object->getMilestones() as $value_5) { - $values_5[] = $this->normalizer->normalize($value_5, 'json', $context); - } - $data['milestones'] = $values_5; - } - if ($object->isInitialized('packageAddress') && null !== $object->getPackageAddress()) { - $values_6 = []; - foreach ($object->getPackageAddress() as $value_6) { - $values_6[] = $this->normalizer->normalize($value_6, 'json', $context); - } - $data['packageAddress'] = $values_6; - } - if ($object->isInitialized('packageCount') && null !== $object->getPackageCount()) { - $data['packageCount'] = $object->getPackageCount(); + if (\array_key_exists('accessPointInformation', $data)) { + $object->setAccessPointInformation($this->denormalizer->denormalize($data['accessPointInformation'], \ShipStream\Ups\Api\Model\AccessPointInformation::class, 'json', $context)); + unset($data['accessPointInformation']); + } + if (\array_key_exists('activity', $data)) { + $values = []; + foreach ($data['activity'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Activity::class, 'json', $context); } - if ($object->isInitialized('paymentInformation') && null !== $object->getPaymentInformation()) { - $values_7 = []; - foreach ($object->getPaymentInformation() as $value_7) { - $values_7[] = $this->normalizer->normalize($value_7, 'json', $context); - } - $data['paymentInformation'] = $values_7; + $object->setActivity($values); + unset($data['activity']); + } + if (\array_key_exists('additionalAttributes', $data)) { + $values_1 = []; + foreach ($data['additionalAttributes'] as $value_1) { + $values_1[] = $value_1; } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $values_8 = []; - foreach ($object->getReferenceNumber() as $value_8) { - $values_8[] = $this->normalizer->normalize($value_8, 'json', $context); - } - $data['referenceNumber'] = $values_8; + $object->setAdditionalAttributes($values_1); + unset($data['additionalAttributes']); + } + if (\array_key_exists('additionalServices', $data)) { + $values_2 = []; + foreach ($data['additionalServices'] as $value_2) { + $values_2[] = $value_2; } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['service'] = $this->normalizer->normalize($object->getService(), 'json', $context); + $object->setAdditionalServices($values_2); + unset($data['additionalServices']); + } + if (\array_key_exists('alternateTrackingNumber', $data)) { + $values_3 = []; + foreach ($data['alternateTrackingNumber'] as $value_3) { + $values_3[] = $this->denormalizer->denormalize($value_3, \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class, 'json', $context); } - if ($object->isInitialized('statusCode') && null !== $object->getStatusCode()) { - $data['statusCode'] = $object->getStatusCode(); + $object->setAlternateTrackingNumber($values_3); + unset($data['alternateTrackingNumber']); + } + if (\array_key_exists('currentStatus', $data)) { + $object->setCurrentStatus($this->denormalizer->denormalize($data['currentStatus'], \ShipStream\Ups\Api\Model\Status::class, 'json', $context)); + unset($data['currentStatus']); + } + if (\array_key_exists('deliveryDate', $data)) { + $values_4 = []; + foreach ($data['deliveryDate'] as $value_4) { + $values_4[] = $this->denormalizer->denormalize($value_4, \ShipStream\Ups\Api\Model\DeliveryDate::class, 'json', $context); } - if ($object->isInitialized('statusDescription') && null !== $object->getStatusDescription()) { - $data['statusDescription'] = $object->getStatusDescription(); + $object->setDeliveryDate($values_4); + unset($data['deliveryDate']); + } + if (\array_key_exists('deliveryInformation', $data)) { + $object->setDeliveryInformation($this->denormalizer->denormalize($data['deliveryInformation'], \ShipStream\Ups\Api\Model\DeliveryInformation::class, 'json', $context)); + unset($data['deliveryInformation']); + } + if (\array_key_exists('deliveryTime', $data)) { + $object->setDeliveryTime($this->denormalizer->denormalize($data['deliveryTime'], \ShipStream\Ups\Api\Model\DeliveryTime::class, 'json', $context)); + unset($data['deliveryTime']); + } + if (\array_key_exists('milestones', $data)) { + $values_5 = []; + foreach ($data['milestones'] as $value_5) { + $values_5[] = $this->denormalizer->denormalize($value_5, \ShipStream\Ups\Api\Model\Milestones::class, 'json', $context); } - if ($object->isInitialized('suppressionIndicators') && null !== $object->getSuppressionIndicators()) { - $values_9 = []; - foreach ($object->getSuppressionIndicators() as $value_9) { - $values_9[] = $value_9; - } - $data['suppressionIndicators'] = $values_9; + $object->setMilestones($values_5); + unset($data['milestones']); + } + if (\array_key_exists('packageAddress', $data)) { + $values_6 = []; + foreach ($data['packageAddress'] as $value_6) { + $values_6[] = $this->denormalizer->denormalize($value_6, \ShipStream\Ups\Api\Model\PackageAddress::class, 'json', $context); } - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $data['trackingNumber'] = $object->getTrackingNumber(); + $object->setPackageAddress($values_6); + unset($data['packageAddress']); + } + if (\array_key_exists('packageCount', $data)) { + $object->setPackageCount($data['packageCount']); + unset($data['packageCount']); + } + if (\array_key_exists('paymentInformation', $data)) { + $values_7 = []; + foreach ($data['paymentInformation'] as $value_7) { + $values_7[] = $this->denormalizer->denormalize($value_7, \ShipStream\Ups\Api\Model\PaymentInformation::class, 'json', $context); } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['weight'] = $this->normalizer->normalize($object->getWeight(), 'json', $context); + $object->setPaymentInformation($values_7); + unset($data['paymentInformation']); + } + if (\array_key_exists('referenceNumber', $data)) { + $values_8 = []; + foreach ($data['referenceNumber'] as $value_8) { + $values_8[] = $this->denormalizer->denormalize($value_8, \ShipStream\Ups\Api\Model\ReferenceNumber::class, 'json', $context); } - foreach ($object as $key => $value_10) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_10; - } + $object->setReferenceNumber($values_8); + unset($data['referenceNumber']); + } + if (\array_key_exists('service', $data)) { + $object->setService($this->denormalizer->denormalize($data['service'], \ShipStream\Ups\Api\Model\Service::class, 'json', $context)); + unset($data['service']); + } + if (\array_key_exists('statusCode', $data)) { + $object->setStatusCode($data['statusCode']); + unset($data['statusCode']); + } + if (\array_key_exists('statusDescription', $data)) { + $object->setStatusDescription($data['statusDescription']); + unset($data['statusDescription']); + } + if (\array_key_exists('suppressionIndicators', $data)) { + $values_9 = []; + foreach ($data['suppressionIndicators'] as $value_9) { + $values_9[] = $value_9; } - return $data; + $object->setSuppressionIndicators($values_9); + unset($data['suppressionIndicators']); + } + if (\array_key_exists('trackingNumber', $data)) { + $object->setTrackingNumber($data['trackingNumber']); + unset($data['trackingNumber']); + } + if (\array_key_exists('weight', $data) && $data['weight'] !== null) { + $object->setWeight($this->denormalizer->denormalize($data['weight'], \ShipStream\Ups\Api\Model\Weight::class, 'json', $context)); + unset($data['weight']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Package::class => false]; + elseif (\array_key_exists('weight', $data) && $data['weight'] === null) { + $object->setWeight(null); } + foreach ($data as $key => $value_10) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_10; + } + } + return $object; } -} else { - class PackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Package::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Package::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Package(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('accessPointInformation', $data)) { - $object->setAccessPointInformation($this->denormalizer->denormalize($data['accessPointInformation'], \ShipStream\Ups\Api\Model\AccessPointInformation::class, 'json', $context)); - unset($data['accessPointInformation']); - } - if (\array_key_exists('activity', $data)) { - $values = []; - foreach ($data['activity'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Activity::class, 'json', $context); - } - $object->setActivity($values); - unset($data['activity']); - } - if (\array_key_exists('additionalAttributes', $data)) { - $values_1 = []; - foreach ($data['additionalAttributes'] as $value_1) { - $values_1[] = $value_1; - } - $object->setAdditionalAttributes($values_1); - unset($data['additionalAttributes']); - } - if (\array_key_exists('additionalServices', $data)) { - $values_2 = []; - foreach ($data['additionalServices'] as $value_2) { - $values_2[] = $value_2; - } - $object->setAdditionalServices($values_2); - unset($data['additionalServices']); - } - if (\array_key_exists('alternateTrackingNumber', $data)) { - $values_3 = []; - foreach ($data['alternateTrackingNumber'] as $value_3) { - $values_3[] = $this->denormalizer->denormalize($value_3, \ShipStream\Ups\Api\Model\AlternateTrackingNumber::class, 'json', $context); - } - $object->setAlternateTrackingNumber($values_3); - unset($data['alternateTrackingNumber']); - } - if (\array_key_exists('currentStatus', $data)) { - $object->setCurrentStatus($this->denormalizer->denormalize($data['currentStatus'], \ShipStream\Ups\Api\Model\Status::class, 'json', $context)); - unset($data['currentStatus']); - } - if (\array_key_exists('deliveryDate', $data)) { - $values_4 = []; - foreach ($data['deliveryDate'] as $value_4) { - $values_4[] = $this->denormalizer->denormalize($value_4, \ShipStream\Ups\Api\Model\DeliveryDate::class, 'json', $context); - } - $object->setDeliveryDate($values_4); - unset($data['deliveryDate']); - } - if (\array_key_exists('deliveryInformation', $data)) { - $object->setDeliveryInformation($this->denormalizer->denormalize($data['deliveryInformation'], \ShipStream\Ups\Api\Model\DeliveryInformation::class, 'json', $context)); - unset($data['deliveryInformation']); - } - if (\array_key_exists('deliveryTime', $data)) { - $object->setDeliveryTime($this->denormalizer->denormalize($data['deliveryTime'], \ShipStream\Ups\Api\Model\DeliveryTime::class, 'json', $context)); - unset($data['deliveryTime']); - } - if (\array_key_exists('milestones', $data)) { - $values_5 = []; - foreach ($data['milestones'] as $value_5) { - $values_5[] = $this->denormalizer->denormalize($value_5, \ShipStream\Ups\Api\Model\Milestones::class, 'json', $context); - } - $object->setMilestones($values_5); - unset($data['milestones']); - } - if (\array_key_exists('packageAddress', $data)) { - $values_6 = []; - foreach ($data['packageAddress'] as $value_6) { - $values_6[] = $this->denormalizer->denormalize($value_6, \ShipStream\Ups\Api\Model\PackageAddress::class, 'json', $context); - } - $object->setPackageAddress($values_6); - unset($data['packageAddress']); - } - if (\array_key_exists('packageCount', $data)) { - $object->setPackageCount($data['packageCount']); - unset($data['packageCount']); - } - if (\array_key_exists('paymentInformation', $data)) { - $values_7 = []; - foreach ($data['paymentInformation'] as $value_7) { - $values_7[] = $this->denormalizer->denormalize($value_7, \ShipStream\Ups\Api\Model\PaymentInformation::class, 'json', $context); - } - $object->setPaymentInformation($values_7); - unset($data['paymentInformation']); - } - if (\array_key_exists('referenceNumber', $data)) { - $values_8 = []; - foreach ($data['referenceNumber'] as $value_8) { - $values_8[] = $this->denormalizer->denormalize($value_8, \ShipStream\Ups\Api\Model\ReferenceNumber::class, 'json', $context); - } - $object->setReferenceNumber($values_8); - unset($data['referenceNumber']); - } - if (\array_key_exists('service', $data)) { - $object->setService($this->denormalizer->denormalize($data['service'], \ShipStream\Ups\Api\Model\Service::class, 'json', $context)); - unset($data['service']); - } - if (\array_key_exists('statusCode', $data)) { - $object->setStatusCode($data['statusCode']); - unset($data['statusCode']); - } - if (\array_key_exists('statusDescription', $data)) { - $object->setStatusDescription($data['statusDescription']); - unset($data['statusDescription']); - } - if (\array_key_exists('suppressionIndicators', $data)) { - $values_9 = []; - foreach ($data['suppressionIndicators'] as $value_9) { - $values_9[] = $value_9; - } - $object->setSuppressionIndicators($values_9); - unset($data['suppressionIndicators']); - } - if (\array_key_exists('trackingNumber', $data)) { - $object->setTrackingNumber($data['trackingNumber']); - unset($data['trackingNumber']); - } - if (\array_key_exists('weight', $data) && $data['weight'] !== null) { - $object->setWeight($this->denormalizer->denormalize($data['weight'], \ShipStream\Ups\Api\Model\Weight::class, 'json', $context)); - unset($data['weight']); - } - elseif (\array_key_exists('weight', $data) && $data['weight'] === null) { - $object->setWeight(null); - } - foreach ($data as $key => $value_10) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_10; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('accessPointInformation') && null !== $data->getAccessPointInformation()) { + $dataArray['accessPointInformation'] = $this->normalizer->normalize($data->getAccessPointInformation(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('accessPointInformation') && null !== $object->getAccessPointInformation()) { - $data['accessPointInformation'] = $this->normalizer->normalize($object->getAccessPointInformation(), 'json', $context); - } - if ($object->isInitialized('activity') && null !== $object->getActivity()) { - $values = []; - foreach ($object->getActivity() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['activity'] = $values; - } - if ($object->isInitialized('additionalAttributes') && null !== $object->getAdditionalAttributes()) { - $values_1 = []; - foreach ($object->getAdditionalAttributes() as $value_1) { - $values_1[] = $value_1; - } - $data['additionalAttributes'] = $values_1; + if ($data->isInitialized('activity') && null !== $data->getActivity()) { + $values = []; + foreach ($data->getActivity() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - if ($object->isInitialized('additionalServices') && null !== $object->getAdditionalServices()) { - $values_2 = []; - foreach ($object->getAdditionalServices() as $value_2) { - $values_2[] = $value_2; - } - $data['additionalServices'] = $values_2; - } - if ($object->isInitialized('alternateTrackingNumber') && null !== $object->getAlternateTrackingNumber()) { - $values_3 = []; - foreach ($object->getAlternateTrackingNumber() as $value_3) { - $values_3[] = $this->normalizer->normalize($value_3, 'json', $context); - } - $data['alternateTrackingNumber'] = $values_3; - } - if ($object->isInitialized('currentStatus') && null !== $object->getCurrentStatus()) { - $data['currentStatus'] = $this->normalizer->normalize($object->getCurrentStatus(), 'json', $context); - } - if ($object->isInitialized('deliveryDate') && null !== $object->getDeliveryDate()) { - $values_4 = []; - foreach ($object->getDeliveryDate() as $value_4) { - $values_4[] = $this->normalizer->normalize($value_4, 'json', $context); - } - $data['deliveryDate'] = $values_4; - } - if ($object->isInitialized('deliveryInformation') && null !== $object->getDeliveryInformation()) { - $data['deliveryInformation'] = $this->normalizer->normalize($object->getDeliveryInformation(), 'json', $context); - } - if ($object->isInitialized('deliveryTime') && null !== $object->getDeliveryTime()) { - $data['deliveryTime'] = $this->normalizer->normalize($object->getDeliveryTime(), 'json', $context); - } - if ($object->isInitialized('milestones') && null !== $object->getMilestones()) { - $values_5 = []; - foreach ($object->getMilestones() as $value_5) { - $values_5[] = $this->normalizer->normalize($value_5, 'json', $context); - } - $data['milestones'] = $values_5; - } - if ($object->isInitialized('packageAddress') && null !== $object->getPackageAddress()) { - $values_6 = []; - foreach ($object->getPackageAddress() as $value_6) { - $values_6[] = $this->normalizer->normalize($value_6, 'json', $context); - } - $data['packageAddress'] = $values_6; - } - if ($object->isInitialized('packageCount') && null !== $object->getPackageCount()) { - $data['packageCount'] = $object->getPackageCount(); - } - if ($object->isInitialized('paymentInformation') && null !== $object->getPaymentInformation()) { - $values_7 = []; - foreach ($object->getPaymentInformation() as $value_7) { - $values_7[] = $this->normalizer->normalize($value_7, 'json', $context); - } - $data['paymentInformation'] = $values_7; + $dataArray['activity'] = $values; + } + if ($data->isInitialized('additionalAttributes') && null !== $data->getAdditionalAttributes()) { + $values_1 = []; + foreach ($data->getAdditionalAttributes() as $value_1) { + $values_1[] = $value_1; } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $values_8 = []; - foreach ($object->getReferenceNumber() as $value_8) { - $values_8[] = $this->normalizer->normalize($value_8, 'json', $context); - } - $data['referenceNumber'] = $values_8; + $dataArray['additionalAttributes'] = $values_1; + } + if ($data->isInitialized('additionalServices') && null !== $data->getAdditionalServices()) { + $values_2 = []; + foreach ($data->getAdditionalServices() as $value_2) { + $values_2[] = $value_2; } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['service'] = $this->normalizer->normalize($object->getService(), 'json', $context); + $dataArray['additionalServices'] = $values_2; + } + if ($data->isInitialized('alternateTrackingNumber') && null !== $data->getAlternateTrackingNumber()) { + $values_3 = []; + foreach ($data->getAlternateTrackingNumber() as $value_3) { + $values_3[] = $this->normalizer->normalize($value_3, 'json', $context); } - if ($object->isInitialized('statusCode') && null !== $object->getStatusCode()) { - $data['statusCode'] = $object->getStatusCode(); + $dataArray['alternateTrackingNumber'] = $values_3; + } + if ($data->isInitialized('currentStatus') && null !== $data->getCurrentStatus()) { + $dataArray['currentStatus'] = $this->normalizer->normalize($data->getCurrentStatus(), 'json', $context); + } + if ($data->isInitialized('deliveryDate') && null !== $data->getDeliveryDate()) { + $values_4 = []; + foreach ($data->getDeliveryDate() as $value_4) { + $values_4[] = $this->normalizer->normalize($value_4, 'json', $context); } - if ($object->isInitialized('statusDescription') && null !== $object->getStatusDescription()) { - $data['statusDescription'] = $object->getStatusDescription(); + $dataArray['deliveryDate'] = $values_4; + } + if ($data->isInitialized('deliveryInformation') && null !== $data->getDeliveryInformation()) { + $dataArray['deliveryInformation'] = $this->normalizer->normalize($data->getDeliveryInformation(), 'json', $context); + } + if ($data->isInitialized('deliveryTime') && null !== $data->getDeliveryTime()) { + $dataArray['deliveryTime'] = $this->normalizer->normalize($data->getDeliveryTime(), 'json', $context); + } + if ($data->isInitialized('milestones') && null !== $data->getMilestones()) { + $values_5 = []; + foreach ($data->getMilestones() as $value_5) { + $values_5[] = $this->normalizer->normalize($value_5, 'json', $context); } - if ($object->isInitialized('suppressionIndicators') && null !== $object->getSuppressionIndicators()) { - $values_9 = []; - foreach ($object->getSuppressionIndicators() as $value_9) { - $values_9[] = $value_9; - } - $data['suppressionIndicators'] = $values_9; + $dataArray['milestones'] = $values_5; + } + if ($data->isInitialized('packageAddress') && null !== $data->getPackageAddress()) { + $values_6 = []; + foreach ($data->getPackageAddress() as $value_6) { + $values_6[] = $this->normalizer->normalize($value_6, 'json', $context); } - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $data['trackingNumber'] = $object->getTrackingNumber(); + $dataArray['packageAddress'] = $values_6; + } + if ($data->isInitialized('packageCount') && null !== $data->getPackageCount()) { + $dataArray['packageCount'] = $data->getPackageCount(); + } + if ($data->isInitialized('paymentInformation') && null !== $data->getPaymentInformation()) { + $values_7 = []; + foreach ($data->getPaymentInformation() as $value_7) { + $values_7[] = $this->normalizer->normalize($value_7, 'json', $context); } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['weight'] = $this->normalizer->normalize($object->getWeight(), 'json', $context); + $dataArray['paymentInformation'] = $values_7; + } + if ($data->isInitialized('referenceNumber') && null !== $data->getReferenceNumber()) { + $values_8 = []; + foreach ($data->getReferenceNumber() as $value_8) { + $values_8[] = $this->normalizer->normalize($value_8, 'json', $context); } - foreach ($object as $key => $value_10) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_10; - } + $dataArray['referenceNumber'] = $values_8; + } + if ($data->isInitialized('service') && null !== $data->getService()) { + $dataArray['service'] = $this->normalizer->normalize($data->getService(), 'json', $context); + } + if ($data->isInitialized('statusCode') && null !== $data->getStatusCode()) { + $dataArray['statusCode'] = $data->getStatusCode(); + } + if ($data->isInitialized('statusDescription') && null !== $data->getStatusDescription()) { + $dataArray['statusDescription'] = $data->getStatusDescription(); + } + if ($data->isInitialized('suppressionIndicators') && null !== $data->getSuppressionIndicators()) { + $values_9 = []; + foreach ($data->getSuppressionIndicators() as $value_9) { + $values_9[] = $value_9; } - return $data; + $dataArray['suppressionIndicators'] = $values_9; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Package::class => false]; + if ($data->isInitialized('trackingNumber') && null !== $data->getTrackingNumber()) { + $dataArray['trackingNumber'] = $data->getTrackingNumber(); } + if ($data->isInitialized('weight')) { + $dataArray['weight'] = $this->normalizer->normalize($data->getWeight(), 'json', $context); + } + foreach ($data as $key => $value_10) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_10; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Package::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackagePackageServiceOptionsNormalizer.php b/src/Api/Normalizer/PackagePackageServiceOptionsNormalizer.php index fae6024c..3350436a 100644 --- a/src/Api/Normalizer/PackagePackageServiceOptionsNormalizer.php +++ b/src/Api/Normalizer/PackagePackageServiceOptionsNormalizer.php @@ -5,314 +5,156 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackagePackageServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackagePackageServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class; + return $type === \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackagePackageServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DeliveryConfirmation', $data)) { - $object->setDeliveryConfirmation($this->denormalizer->denormalize($data['DeliveryConfirmation'], \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class, 'json', $context)); - unset($data['DeliveryConfirmation']); - } - if (\array_key_exists('DeclaredValue', $data)) { - $object->setDeclaredValue($this->denormalizer->denormalize($data['DeclaredValue'], \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class, 'json', $context)); - unset($data['DeclaredValue']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('AccessPointCOD', $data)) { - $object->setAccessPointCOD($this->denormalizer->denormalize($data['AccessPointCOD'], \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class, 'json', $context)); - unset($data['AccessPointCOD']); - } - if (\array_key_exists('ShipperReleaseIndicator', $data)) { - $object->setShipperReleaseIndicator($data['ShipperReleaseIndicator']); - unset($data['ShipperReleaseIndicator']); - } - if (\array_key_exists('Notification', $data)) { - $object->setNotification($this->denormalizer->denormalize($data['Notification'], \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class, 'json', $context)); - unset($data['Notification']); - } - if (\array_key_exists('HazMat', $data)) { - $values = []; - foreach ($data['HazMat'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class, 'json', $context); - } - $object->setHazMat($values); - unset($data['HazMat']); - } - if (\array_key_exists('DryIce', $data)) { - $object->setDryIce($this->denormalizer->denormalize($data['DryIce'], \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class, 'json', $context)); - unset($data['DryIce']); - } - if (\array_key_exists('UPSPremiumCareIndicator', $data)) { - $object->setUPSPremiumCareIndicator($data['UPSPremiumCareIndicator']); - unset($data['UPSPremiumCareIndicator']); - } - if (\array_key_exists('ProactiveIndicator', $data)) { - $object->setProactiveIndicator($data['ProactiveIndicator']); - unset($data['ProactiveIndicator']); - } - if (\array_key_exists('PackageIdentifier', $data)) { - $object->setPackageIdentifier($data['PackageIdentifier']); - unset($data['PackageIdentifier']); - } - if (\array_key_exists('ClinicalTrialsID', $data)) { - $object->setClinicalTrialsID($data['ClinicalTrialsID']); - unset($data['ClinicalTrialsID']); - } - if (\array_key_exists('RefrigerationIndicator', $data)) { - $object->setRefrigerationIndicator($data['RefrigerationIndicator']); - unset($data['RefrigerationIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PackagePackageServiceOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('deliveryConfirmation') && null !== $object->getDeliveryConfirmation()) { - $data['DeliveryConfirmation'] = $this->normalizer->normalize($object->getDeliveryConfirmation(), 'json', $context); - } - if ($object->isInitialized('declaredValue') && null !== $object->getDeclaredValue()) { - $data['DeclaredValue'] = $this->normalizer->normalize($object->getDeclaredValue(), 'json', $context); - } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('accessPointCOD') && null !== $object->getAccessPointCOD()) { - $data['AccessPointCOD'] = $this->normalizer->normalize($object->getAccessPointCOD(), 'json', $context); - } - if ($object->isInitialized('shipperReleaseIndicator') && null !== $object->getShipperReleaseIndicator()) { - $data['ShipperReleaseIndicator'] = $object->getShipperReleaseIndicator(); - } - if ($object->isInitialized('notification') && null !== $object->getNotification()) { - $data['Notification'] = $this->normalizer->normalize($object->getNotification(), 'json', $context); - } - if ($object->isInitialized('hazMat') && null !== $object->getHazMat()) { - $values = []; - foreach ($object->getHazMat() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['HazMat'] = $values; - } - if ($object->isInitialized('dryIce') && null !== $object->getDryIce()) { - $data['DryIce'] = $this->normalizer->normalize($object->getDryIce(), 'json', $context); - } - if ($object->isInitialized('uPSPremiumCareIndicator') && null !== $object->getUPSPremiumCareIndicator()) { - $data['UPSPremiumCareIndicator'] = $object->getUPSPremiumCareIndicator(); - } - if ($object->isInitialized('proactiveIndicator') && null !== $object->getProactiveIndicator()) { - $data['ProactiveIndicator'] = $object->getProactiveIndicator(); - } - if ($object->isInitialized('packageIdentifier') && null !== $object->getPackageIdentifier()) { - $data['PackageIdentifier'] = $object->getPackageIdentifier(); - } - if ($object->isInitialized('clinicalTrialsID') && null !== $object->getClinicalTrialsID()) { - $data['ClinicalTrialsID'] = $object->getClinicalTrialsID(); - } - if ($object->isInitialized('refrigerationIndicator') && null !== $object->getRefrigerationIndicator()) { - $data['RefrigerationIndicator'] = $object->getRefrigerationIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('DeliveryConfirmation', $data)) { + $object->setDeliveryConfirmation($this->denormalizer->denormalize($data['DeliveryConfirmation'], \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class, 'json', $context)); + unset($data['DeliveryConfirmation']); + } + if (\array_key_exists('DeclaredValue', $data)) { + $object->setDeclaredValue($this->denormalizer->denormalize($data['DeclaredValue'], \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class, 'json', $context)); + unset($data['DeclaredValue']); + } + if (\array_key_exists('COD', $data)) { + $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class, 'json', $context)); + unset($data['COD']); + } + if (\array_key_exists('AccessPointCOD', $data)) { + $object->setAccessPointCOD($this->denormalizer->denormalize($data['AccessPointCOD'], \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class, 'json', $context)); + unset($data['AccessPointCOD']); + } + if (\array_key_exists('ShipperReleaseIndicator', $data)) { + $object->setShipperReleaseIndicator($data['ShipperReleaseIndicator']); + unset($data['ShipperReleaseIndicator']); + } + if (\array_key_exists('Notification', $data)) { + $object->setNotification($this->denormalizer->denormalize($data['Notification'], \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class, 'json', $context)); + unset($data['Notification']); + } + if (\array_key_exists('HazMat', $data)) { + $values = []; + foreach ($data['HazMat'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class, 'json', $context); } - return $data; + $object->setHazMat($values); + unset($data['HazMat']); + } + if (\array_key_exists('DryIce', $data)) { + $object->setDryIce($this->denormalizer->denormalize($data['DryIce'], \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class, 'json', $context)); + unset($data['DryIce']); + } + if (\array_key_exists('UPSPremiumCareIndicator', $data)) { + $object->setUPSPremiumCareIndicator($data['UPSPremiumCareIndicator']); + unset($data['UPSPremiumCareIndicator']); + } + if (\array_key_exists('ProactiveIndicator', $data)) { + $object->setProactiveIndicator($data['ProactiveIndicator']); + unset($data['ProactiveIndicator']); + } + if (\array_key_exists('PackageIdentifier', $data)) { + $object->setPackageIdentifier($data['PackageIdentifier']); + unset($data['PackageIdentifier']); + } + if (\array_key_exists('ClinicalTrialsID', $data)) { + $object->setClinicalTrialsID($data['ClinicalTrialsID']); + unset($data['ClinicalTrialsID']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class => false]; + if (\array_key_exists('RefrigerationIndicator', $data)) { + $object->setRefrigerationIndicator($data['RefrigerationIndicator']); + unset($data['RefrigerationIndicator']); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class PackagePackageServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class; + $dataArray = []; + if ($data->isInitialized('deliveryConfirmation') && null !== $data->getDeliveryConfirmation()) { + $dataArray['DeliveryConfirmation'] = $this->normalizer->normalize($data->getDeliveryConfirmation(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class; + if ($data->isInitialized('declaredValue') && null !== $data->getDeclaredValue()) { + $dataArray['DeclaredValue'] = $this->normalizer->normalize($data->getDeclaredValue(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackagePackageServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DeliveryConfirmation', $data)) { - $object->setDeliveryConfirmation($this->denormalizer->denormalize($data['DeliveryConfirmation'], \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class, 'json', $context)); - unset($data['DeliveryConfirmation']); - } - if (\array_key_exists('DeclaredValue', $data)) { - $object->setDeclaredValue($this->denormalizer->denormalize($data['DeclaredValue'], \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class, 'json', $context)); - unset($data['DeclaredValue']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('AccessPointCOD', $data)) { - $object->setAccessPointCOD($this->denormalizer->denormalize($data['AccessPointCOD'], \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class, 'json', $context)); - unset($data['AccessPointCOD']); - } - if (\array_key_exists('ShipperReleaseIndicator', $data)) { - $object->setShipperReleaseIndicator($data['ShipperReleaseIndicator']); - unset($data['ShipperReleaseIndicator']); - } - if (\array_key_exists('Notification', $data)) { - $object->setNotification($this->denormalizer->denormalize($data['Notification'], \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class, 'json', $context)); - unset($data['Notification']); - } - if (\array_key_exists('HazMat', $data)) { - $values = []; - foreach ($data['HazMat'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class, 'json', $context); - } - $object->setHazMat($values); - unset($data['HazMat']); - } - if (\array_key_exists('DryIce', $data)) { - $object->setDryIce($this->denormalizer->denormalize($data['DryIce'], \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class, 'json', $context)); - unset($data['DryIce']); - } - if (\array_key_exists('UPSPremiumCareIndicator', $data)) { - $object->setUPSPremiumCareIndicator($data['UPSPremiumCareIndicator']); - unset($data['UPSPremiumCareIndicator']); - } - if (\array_key_exists('ProactiveIndicator', $data)) { - $object->setProactiveIndicator($data['ProactiveIndicator']); - unset($data['ProactiveIndicator']); - } - if (\array_key_exists('PackageIdentifier', $data)) { - $object->setPackageIdentifier($data['PackageIdentifier']); - unset($data['PackageIdentifier']); - } - if (\array_key_exists('ClinicalTrialsID', $data)) { - $object->setClinicalTrialsID($data['ClinicalTrialsID']); - unset($data['ClinicalTrialsID']); - } - if (\array_key_exists('RefrigerationIndicator', $data)) { - $object->setRefrigerationIndicator($data['RefrigerationIndicator']); - unset($data['RefrigerationIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('cOD') && null !== $data->getCOD()) { + $dataArray['COD'] = $this->normalizer->normalize($data->getCOD(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('deliveryConfirmation') && null !== $object->getDeliveryConfirmation()) { - $data['DeliveryConfirmation'] = $this->normalizer->normalize($object->getDeliveryConfirmation(), 'json', $context); - } - if ($object->isInitialized('declaredValue') && null !== $object->getDeclaredValue()) { - $data['DeclaredValue'] = $this->normalizer->normalize($object->getDeclaredValue(), 'json', $context); - } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('accessPointCOD') && null !== $object->getAccessPointCOD()) { - $data['AccessPointCOD'] = $this->normalizer->normalize($object->getAccessPointCOD(), 'json', $context); - } - if ($object->isInitialized('shipperReleaseIndicator') && null !== $object->getShipperReleaseIndicator()) { - $data['ShipperReleaseIndicator'] = $object->getShipperReleaseIndicator(); - } - if ($object->isInitialized('notification') && null !== $object->getNotification()) { - $data['Notification'] = $this->normalizer->normalize($object->getNotification(), 'json', $context); - } - if ($object->isInitialized('hazMat') && null !== $object->getHazMat()) { - $values = []; - foreach ($object->getHazMat() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['HazMat'] = $values; - } - if ($object->isInitialized('dryIce') && null !== $object->getDryIce()) { - $data['DryIce'] = $this->normalizer->normalize($object->getDryIce(), 'json', $context); - } - if ($object->isInitialized('uPSPremiumCareIndicator') && null !== $object->getUPSPremiumCareIndicator()) { - $data['UPSPremiumCareIndicator'] = $object->getUPSPremiumCareIndicator(); - } - if ($object->isInitialized('proactiveIndicator') && null !== $object->getProactiveIndicator()) { - $data['ProactiveIndicator'] = $object->getProactiveIndicator(); - } - if ($object->isInitialized('packageIdentifier') && null !== $object->getPackageIdentifier()) { - $data['PackageIdentifier'] = $object->getPackageIdentifier(); - } - if ($object->isInitialized('clinicalTrialsID') && null !== $object->getClinicalTrialsID()) { - $data['ClinicalTrialsID'] = $object->getClinicalTrialsID(); - } - if ($object->isInitialized('refrigerationIndicator') && null !== $object->getRefrigerationIndicator()) { - $data['RefrigerationIndicator'] = $object->getRefrigerationIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if ($data->isInitialized('accessPointCOD') && null !== $data->getAccessPointCOD()) { + $dataArray['AccessPointCOD'] = $this->normalizer->normalize($data->getAccessPointCOD(), 'json', $context); + } + if ($data->isInitialized('shipperReleaseIndicator') && null !== $data->getShipperReleaseIndicator()) { + $dataArray['ShipperReleaseIndicator'] = $data->getShipperReleaseIndicator(); + } + if ($data->isInitialized('notification') && null !== $data->getNotification()) { + $dataArray['Notification'] = $this->normalizer->normalize($data->getNotification(), 'json', $context); + } + if ($data->isInitialized('hazMat') && null !== $data->getHazMat()) { + $values = []; + foreach ($data->getHazMat() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $data; + $dataArray['HazMat'] = $values; + } + if ($data->isInitialized('dryIce') && null !== $data->getDryIce()) { + $dataArray['DryIce'] = $this->normalizer->normalize($data->getDryIce(), 'json', $context); + } + if ($data->isInitialized('uPSPremiumCareIndicator') && null !== $data->getUPSPremiumCareIndicator()) { + $dataArray['UPSPremiumCareIndicator'] = $data->getUPSPremiumCareIndicator(); + } + if ($data->isInitialized('proactiveIndicator') && null !== $data->getProactiveIndicator()) { + $dataArray['ProactiveIndicator'] = $data->getProactiveIndicator(); + } + if ($data->isInitialized('packageIdentifier') && null !== $data->getPackageIdentifier()) { + $dataArray['PackageIdentifier'] = $data->getPackageIdentifier(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class => false]; + if ($data->isInitialized('clinicalTrialsID') && null !== $data->getClinicalTrialsID()) { + $dataArray['ClinicalTrialsID'] = $data->getClinicalTrialsID(); } + if ($data->isInitialized('refrigerationIndicator') && null !== $data->getRefrigerationIndicator()) { + $dataArray['RefrigerationIndicator'] = $data->getRefrigerationIndicator(); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackagePackageWeightNormalizer.php b/src/Api/Normalizer/PackagePackageWeightNormalizer.php index aefde42b..6b6e3c4b 100644 --- a/src/Api/Normalizer/PackagePackageWeightNormalizer.php +++ b/src/Api/Normalizer/PackagePackageWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackagePackageWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackagePackageWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackagePackageWeight::class; + return $type === \ShipStream\Ups\Api\Model\PackagePackageWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackagePackageWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackagePackageWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackagePackageWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackagePackageWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackagePackageWeight::class => false]; - } - } -} else { - class PackagePackageWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackagePackageWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackagePackageWeight::class; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackagePackageWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Weight'] = $data->getWeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackagePackageWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackagePackageWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackagePackagingNormalizer.php b/src/Api/Normalizer/PackagePackagingNormalizer.php index 03514c80..ac6fd0b5 100644 --- a/src/Api/Normalizer/PackagePackagingNormalizer.php +++ b/src/Api/Normalizer/PackagePackagingNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackagePackagingNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackagePackagingNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackagePackaging::class; + return $type === \ShipStream\Ups\Api\Model\PackagePackaging::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackagePackaging::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackagePackaging::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackagePackaging(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackagePackaging(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackagePackaging::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PackagePackagingNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackagePackaging::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackagePackaging::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackagePackaging(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackagePackaging::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackagePackaging::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackagePackagingTypeNormalizer.php b/src/Api/Normalizer/PackagePackagingTypeNormalizer.php index 37244142..b0b44471 100644 --- a/src/Api/Normalizer/PackagePackagingTypeNormalizer.php +++ b/src/Api/Normalizer/PackagePackagingTypeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackagePackagingTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackagePackagingTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackagePackagingType::class; + return $type === \ShipStream\Ups\Api\Model\PackagePackagingType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackagePackagingType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackagePackagingType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackagePackagingType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackagePackagingType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackagePackagingType::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PackagePackagingTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackagePackagingType::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackagePackagingType::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackagePackagingType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackagePackagingType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackagePackagingType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageReferenceNumberNormalizer.php b/src/Api/Normalizer/PackageReferenceNumberNormalizer.php index f410b03e..3996fd2a 100644 --- a/src/Api/Normalizer/PackageReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/PackageReferenceNumberNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\PackageReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('BarCodeIndicator', $data)) { + $object->setBarCodeIndicator($data['BarCodeIndicator']); + unset($data['BarCodeIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageReferenceNumber::class => false]; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PackageReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageReferenceNumber::class; + $dataArray = []; + if ($data->isInitialized('barCodeIndicator') && null !== $data->getBarCodeIndicator()) { + $dataArray['BarCodeIndicator'] = $data->getBarCodeIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageReferenceNumber::class; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageResultsAccessorialNormalizer.php b/src/Api/Normalizer/PackageResultsAccessorialNormalizer.php index b44837b8..ddacc90f 100644 --- a/src/Api/Normalizer/PackageResultsAccessorialNormalizer.php +++ b/src/Api/Normalizer/PackageResultsAccessorialNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageResultsAccessorialNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageResultsAccessorialNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class; + return $type === \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsAccessorial(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageResultsAccessorial(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsAccessorial::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PackageResultsAccessorialNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsAccessorial(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsAccessorial::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageResultsAccessorial::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageResultsBaseServiceChargeNormalizer.php b/src/Api/Normalizer/PackageResultsBaseServiceChargeNormalizer.php index d8232810..4481ed6b 100644 --- a/src/Api/Normalizer/PackageResultsBaseServiceChargeNormalizer.php +++ b/src/Api/Normalizer/PackageResultsBaseServiceChargeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageResultsBaseServiceChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageResultsBaseServiceChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class; + return $type === \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class => false]; - } - } -} else { - class PackageResultsBaseServiceChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageResultsChemicalRecordResultsNormalizer.php b/src/Api/Normalizer/PackageResultsChemicalRecordResultsNormalizer.php index 4fee9a24..6b5e97f4 100644 --- a/src/Api/Normalizer/PackageResultsChemicalRecordResultsNormalizer.php +++ b/src/Api/Normalizer/PackageResultsChemicalRecordResultsNormalizer.php @@ -5,182 +5,90 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageResultsChemicalRecordResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageResultsChemicalRecordResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class; + return $type === \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ChemicalRecordIdentifier', $data)) { - $object->setChemicalRecordIdentifier($data['ChemicalRecordIdentifier']); - unset($data['ChemicalRecordIdentifier']); - } - if (\array_key_exists('ADRPoints', $data)) { - $object->setADRPoints($data['ADRPoints']); - unset($data['ADRPoints']); - } - if (\array_key_exists('TransportCategory', $data)) { - $object->setTransportCategory($data['TransportCategory']); - unset($data['TransportCategory']); - } - if (\array_key_exists('TunnelRestrictionCode', $data)) { - $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); - unset($data['TunnelRestrictionCode']); - } - if (\array_key_exists('ADRUnits', $data)) { - $object->setADRUnits($data['ADRUnits']); - unset($data['ADRUnits']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ChemicalRecordIdentifier'] = $object->getChemicalRecordIdentifier(); - if ($object->isInitialized('aDRPoints') && null !== $object->getADRPoints()) { - $data['ADRPoints'] = $object->getADRPoints(); - } - if ($object->isInitialized('transportCategory') && null !== $object->getTransportCategory()) { - $data['TransportCategory'] = $object->getTransportCategory(); - } - if ($object->isInitialized('tunnelRestrictionCode') && null !== $object->getTunnelRestrictionCode()) { - $data['TunnelRestrictionCode'] = $object->getTunnelRestrictionCode(); - } - if ($object->isInitialized('aDRUnits') && null !== $object->getADRUnits()) { - $data['ADRUnits'] = $object->getADRUnits(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ChemicalRecordIdentifier', $data)) { + $object->setChemicalRecordIdentifier($data['ChemicalRecordIdentifier']); + unset($data['ChemicalRecordIdentifier']); + } + if (\array_key_exists('ADRPoints', $data)) { + $object->setADRPoints($data['ADRPoints']); + unset($data['ADRPoints']); + } + if (\array_key_exists('TransportCategory', $data)) { + $object->setTransportCategory($data['TransportCategory']); + unset($data['TransportCategory']); + } + if (\array_key_exists('TunnelRestrictionCode', $data)) { + $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); + unset($data['TunnelRestrictionCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class => false]; + if (\array_key_exists('ADRUnits', $data)) { + $object->setADRUnits($data['ADRUnits']); + unset($data['ADRUnits']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PackageResultsChemicalRecordResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class; + $dataArray = []; + $dataArray['ChemicalRecordIdentifier'] = $data->getChemicalRecordIdentifier(); + if ($data->isInitialized('aDRPoints') && null !== $data->getADRPoints()) { + $dataArray['ADRPoints'] = $data->getADRPoints(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class; + if ($data->isInitialized('transportCategory') && null !== $data->getTransportCategory()) { + $dataArray['TransportCategory'] = $data->getTransportCategory(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ChemicalRecordIdentifier', $data)) { - $object->setChemicalRecordIdentifier($data['ChemicalRecordIdentifier']); - unset($data['ChemicalRecordIdentifier']); - } - if (\array_key_exists('ADRPoints', $data)) { - $object->setADRPoints($data['ADRPoints']); - unset($data['ADRPoints']); - } - if (\array_key_exists('TransportCategory', $data)) { - $object->setTransportCategory($data['TransportCategory']); - unset($data['TransportCategory']); - } - if (\array_key_exists('TunnelRestrictionCode', $data)) { - $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); - unset($data['TunnelRestrictionCode']); - } - if (\array_key_exists('ADRUnits', $data)) { - $object->setADRUnits($data['ADRUnits']); - unset($data['ADRUnits']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('tunnelRestrictionCode') && null !== $data->getTunnelRestrictionCode()) { + $dataArray['TunnelRestrictionCode'] = $data->getTunnelRestrictionCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ChemicalRecordIdentifier'] = $object->getChemicalRecordIdentifier(); - if ($object->isInitialized('aDRPoints') && null !== $object->getADRPoints()) { - $data['ADRPoints'] = $object->getADRPoints(); - } - if ($object->isInitialized('transportCategory') && null !== $object->getTransportCategory()) { - $data['TransportCategory'] = $object->getTransportCategory(); - } - if ($object->isInitialized('tunnelRestrictionCode') && null !== $object->getTunnelRestrictionCode()) { - $data['TunnelRestrictionCode'] = $object->getTunnelRestrictionCode(); - } - if ($object->isInitialized('aDRUnits') && null !== $object->getADRUnits()) { - $data['ADRUnits'] = $object->getADRUnits(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('aDRUnits') && null !== $data->getADRUnits()) { + $dataArray['ADRUnits'] = $data->getADRUnits(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageResultsChemicalRecordResults::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageResultsFormNormalizer.php b/src/Api/Normalizer/PackageResultsFormNormalizer.php index 99949e3d..089b4f4e 100644 --- a/src/Api/Normalizer/PackageResultsFormNormalizer.php +++ b/src/Api/Normalizer/PackageResultsFormNormalizer.php @@ -5,178 +5,88 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageResultsFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageResultsFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsForm::class; + return $type === \ShipStream\Ups\Api\Model\PackageResultsForm::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsForm::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsForm::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\FormImage::class, 'json', $context)); - unset($data['Image']); - } - if (\array_key_exists('FormGroupId', $data)) { - $object->setFormGroupId($data['FormGroupId']); - unset($data['FormGroupId']); - } - if (\array_key_exists('FormGroupIdName', $data)) { - $object->setFormGroupIdName($data['FormGroupIdName']); - unset($data['FormGroupIdName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageResultsForm(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - if ($object->isInitialized('image') && null !== $object->getImage()) { - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - } - if ($object->isInitialized('formGroupId') && null !== $object->getFormGroupId()) { - $data['FormGroupId'] = $object->getFormGroupId(); - } - if ($object->isInitialized('formGroupIdName') && null !== $object->getFormGroupIdName()) { - $data['FormGroupIdName'] = $object->getFormGroupIdName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); + } + if (\array_key_exists('Image', $data)) { + $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\FormImage::class, 'json', $context)); + unset($data['Image']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsForm::class => false]; + if (\array_key_exists('FormGroupId', $data)) { + $object->setFormGroupId($data['FormGroupId']); + unset($data['FormGroupId']); } + if (\array_key_exists('FormGroupIdName', $data)) { + $object->setFormGroupIdName($data['FormGroupIdName']); + unset($data['FormGroupIdName']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PackageResultsFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsForm::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + if ($data->isInitialized('image') && null !== $data->getImage()) { + $dataArray['Image'] = $this->normalizer->normalize($data->getImage(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsForm::class; + if ($data->isInitialized('formGroupId') && null !== $data->getFormGroupId()) { + $dataArray['FormGroupId'] = $data->getFormGroupId(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\FormImage::class, 'json', $context)); - unset($data['Image']); - } - if (\array_key_exists('FormGroupId', $data)) { - $object->setFormGroupId($data['FormGroupId']); - unset($data['FormGroupId']); - } - if (\array_key_exists('FormGroupIdName', $data)) { - $object->setFormGroupIdName($data['FormGroupIdName']); - unset($data['FormGroupIdName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('formGroupIdName') && null !== $data->getFormGroupIdName()) { + $dataArray['FormGroupIdName'] = $data->getFormGroupIdName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - if ($object->isInitialized('image') && null !== $object->getImage()) { - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - } - if ($object->isInitialized('formGroupId') && null !== $object->getFormGroupId()) { - $data['FormGroupId'] = $object->getFormGroupId(); - } - if ($object->isInitialized('formGroupIdName') && null !== $object->getFormGroupIdName()) { - $data['FormGroupIdName'] = $object->getFormGroupIdName(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsForm::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageResultsForm::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageResultsItemizedChargesNormalizer.php b/src/Api/Normalizer/PackageResultsItemizedChargesNormalizer.php index 17c41c12..db25b04d 100644 --- a/src/Api/Normalizer/PackageResultsItemizedChargesNormalizer.php +++ b/src/Api/Normalizer/PackageResultsItemizedChargesNormalizer.php @@ -5,174 +5,86 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageResultsItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageResultsItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class; + return $type === \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('SubType', $data)) { - $object->setSubType($data['SubType']); - unset($data['SubType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - if ($object->isInitialized('subType') && null !== $object->getSubType()) { - $data['SubType'] = $object->getSubType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class => false]; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - } -} else { - class PackageResultsItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('SubType', $data)) { - $object->setSubType($data['SubType']); - unset($data['SubType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('SubType', $data)) { + $object->setSubType($data['SubType']); + unset($data['SubType']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - if ($object->isInitialized('subType') && null !== $object->getSubType()) { - $data['SubType'] = $object->getSubType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); + } + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + if ($data->isInitialized('subType') && null !== $data->getSubType()) { + $dataArray['SubType'] = $data->getSubType(); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageResultsNegotiatedChargesNormalizer.php b/src/Api/Normalizer/PackageResultsNegotiatedChargesNormalizer.php index 76bca2b5..68135fb6 100644 --- a/src/Api/Normalizer/PackageResultsNegotiatedChargesNormalizer.php +++ b/src/Api/Normalizer/PackageResultsNegotiatedChargesNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageResultsNegotiatedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageResultsNegotiatedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class; + return $type === \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values = []; - foreach ($data['ItemizedCharges'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values); - unset($data['ItemizedCharges']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values = []; - foreach ($object->getItemizedCharges() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ItemizedCharges'] = $values; + if (\array_key_exists('ItemizedCharges', $data)) { + $values = []; + foreach ($data['ItemizedCharges'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class, 'json', $context); } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setItemizedCharges($values); + unset($data['ItemizedCharges']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PackageResultsNegotiatedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values = []; - foreach ($data['ItemizedCharges'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values); - unset($data['ItemizedCharges']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + $dataArray = []; + if ($data->isInitialized('itemizedCharges') && null !== $data->getItemizedCharges()) { + $values = []; + foreach ($data->getItemizedCharges() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['ItemizedCharges'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values = []; - foreach ($object->getItemizedCharges() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ItemizedCharges'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageResultsRateModifierNormalizer.php b/src/Api/Normalizer/PackageResultsRateModifierNormalizer.php index ab5a5e20..f6c2d540 100644 --- a/src/Api/Normalizer/PackageResultsRateModifierNormalizer.php +++ b/src/Api/Normalizer/PackageResultsRateModifierNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageResultsRateModifierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageResultsRateModifierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class; + return $type === \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsRateModifier(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ModifierType', $data)) { - $object->setModifierType($data['ModifierType']); - unset($data['ModifierType']); - } - if (\array_key_exists('ModifierDesc', $data)) { - $object->setModifierDesc($data['ModifierDesc']); - unset($data['ModifierDesc']); - } - if (\array_key_exists('Amount', $data)) { - $object->setAmount($data['Amount']); - unset($data['Amount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageResultsRateModifier(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ModifierType'] = $object->getModifierType(); - $data['ModifierDesc'] = $object->getModifierDesc(); - $data['Amount'] = $object->getAmount(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ModifierType', $data)) { + $object->setModifierType($data['ModifierType']); + unset($data['ModifierType']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsRateModifier::class => false]; + if (\array_key_exists('ModifierDesc', $data)) { + $object->setModifierDesc($data['ModifierDesc']); + unset($data['ModifierDesc']); } - } -} else { - class PackageResultsRateModifierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class; + if (\array_key_exists('Amount', $data)) { + $object->setAmount($data['Amount']); + unset($data['Amount']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsRateModifier(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ModifierType', $data)) { - $object->setModifierType($data['ModifierType']); - unset($data['ModifierType']); - } - if (\array_key_exists('ModifierDesc', $data)) { - $object->setModifierDesc($data['ModifierDesc']); - unset($data['ModifierDesc']); - } - if (\array_key_exists('Amount', $data)) { - $object->setAmount($data['Amount']); - unset($data['Amount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ModifierType'] = $object->getModifierType(); - $data['ModifierDesc'] = $object->getModifierDesc(); - $data['Amount'] = $object->getAmount(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ModifierType'] = $data->getModifierType(); + $dataArray['ModifierDesc'] = $data->getModifierDesc(); + $dataArray['Amount'] = $data->getAmount(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsRateModifier::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageResultsRateModifier::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageResultsServiceOptionsChargesNormalizer.php b/src/Api/Normalizer/PackageResultsServiceOptionsChargesNormalizer.php index 8d49d0ca..b96c926d 100644 --- a/src/Api/Normalizer/PackageResultsServiceOptionsChargesNormalizer.php +++ b/src/Api/Normalizer/PackageResultsServiceOptionsChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageResultsServiceOptionsChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageResultsServiceOptionsChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class; + return $type === \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class => false]; - } - } -} else { - class PackageResultsServiceOptionsChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageResultsShippingLabelNormalizer.php b/src/Api/Normalizer/PackageResultsShippingLabelNormalizer.php index f5d3ef38..eafcb778 100644 --- a/src/Api/Normalizer/PackageResultsShippingLabelNormalizer.php +++ b/src/Api/Normalizer/PackageResultsShippingLabelNormalizer.php @@ -5,208 +5,103 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageResultsShippingLabelNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageResultsShippingLabelNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class; + return $type === \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsShippingLabel(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - if (\array_key_exists('GraphicImagePart', $data)) { - $values = []; - foreach ($data['GraphicImagePart'] as $value) { - $values[] = $value; - } - $object->setGraphicImagePart($values); - unset($data['GraphicImagePart']); - } - if (\array_key_exists('InternationalSignatureGraphicImage', $data)) { - $object->setInternationalSignatureGraphicImage($data['InternationalSignatureGraphicImage']); - unset($data['InternationalSignatureGraphicImage']); - } - if (\array_key_exists('HTMLImage', $data)) { - $object->setHTMLImage($data['HTMLImage']); - unset($data['HTMLImage']); - } - if (\array_key_exists('PDF417', $data)) { - $object->setPDF417($data['PDF417']); - unset($data['PDF417']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageResultsShippingLabel(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - if ($object->isInitialized('graphicImagePart') && null !== $object->getGraphicImagePart()) { - $values = []; - foreach ($object->getGraphicImagePart() as $value) { - $values[] = $value; - } - $data['GraphicImagePart'] = $values; - } - if ($object->isInitialized('internationalSignatureGraphicImage') && null !== $object->getInternationalSignatureGraphicImage()) { - $data['InternationalSignatureGraphicImage'] = $object->getInternationalSignatureGraphicImage(); - } - if ($object->isInitialized('hTMLImage') && null !== $object->getHTMLImage()) { - $data['HTMLImage'] = $object->getHTMLImage(); - } - if ($object->isInitialized('pDF417') && null !== $object->getPDF417()) { - $data['PDF417'] = $object->getPDF417(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ImageFormat', $data)) { + $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class, 'json', $context)); + unset($data['ImageFormat']); + } + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); + } + if (\array_key_exists('GraphicImagePart', $data)) { + $values = []; + foreach ($data['GraphicImagePart'] as $value) { + $values[] = $value; } - return $data; + $object->setGraphicImagePart($values); + unset($data['GraphicImagePart']); + } + if (\array_key_exists('InternationalSignatureGraphicImage', $data)) { + $object->setInternationalSignatureGraphicImage($data['InternationalSignatureGraphicImage']); + unset($data['InternationalSignatureGraphicImage']); + } + if (\array_key_exists('HTMLImage', $data)) { + $object->setHTMLImage($data['HTMLImage']); + unset($data['HTMLImage']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class => false]; + if (\array_key_exists('PDF417', $data)) { + $object->setPDF417($data['PDF417']); + unset($data['PDF417']); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class PackageResultsShippingLabelNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class; + $dataArray = []; + $dataArray['ImageFormat'] = $this->normalizer->normalize($data->getImageFormat(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + if ($data->isInitialized('graphicImagePart') && null !== $data->getGraphicImagePart()) { + $values = []; + foreach ($data->getGraphicImagePart() as $value) { + $values[] = $value; + } + $dataArray['GraphicImagePart'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class; + if ($data->isInitialized('internationalSignatureGraphicImage') && null !== $data->getInternationalSignatureGraphicImage()) { + $dataArray['InternationalSignatureGraphicImage'] = $data->getInternationalSignatureGraphicImage(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsShippingLabel(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - if (\array_key_exists('GraphicImagePart', $data)) { - $values = []; - foreach ($data['GraphicImagePart'] as $value) { - $values[] = $value; - } - $object->setGraphicImagePart($values); - unset($data['GraphicImagePart']); - } - if (\array_key_exists('InternationalSignatureGraphicImage', $data)) { - $object->setInternationalSignatureGraphicImage($data['InternationalSignatureGraphicImage']); - unset($data['InternationalSignatureGraphicImage']); - } - if (\array_key_exists('HTMLImage', $data)) { - $object->setHTMLImage($data['HTMLImage']); - unset($data['HTMLImage']); - } - if (\array_key_exists('PDF417', $data)) { - $object->setPDF417($data['PDF417']); - unset($data['PDF417']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('hTMLImage') && null !== $data->getHTMLImage()) { + $dataArray['HTMLImage'] = $data->getHTMLImage(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - if ($object->isInitialized('graphicImagePart') && null !== $object->getGraphicImagePart()) { - $values = []; - foreach ($object->getGraphicImagePart() as $value) { - $values[] = $value; - } - $data['GraphicImagePart'] = $values; - } - if ($object->isInitialized('internationalSignatureGraphicImage') && null !== $object->getInternationalSignatureGraphicImage()) { - $data['InternationalSignatureGraphicImage'] = $object->getInternationalSignatureGraphicImage(); - } - if ($object->isInitialized('hTMLImage') && null !== $object->getHTMLImage()) { - $data['HTMLImage'] = $object->getHTMLImage(); - } - if ($object->isInitialized('pDF417') && null !== $object->getPDF417()) { - $data['PDF417'] = $object->getPDF417(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('pDF417') && null !== $data->getPDF417()) { + $dataArray['PDF417'] = $data->getPDF417(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageResultsShippingReceiptNormalizer.php b/src/Api/Normalizer/PackageResultsShippingReceiptNormalizer.php index 4b2ef11a..efa2cc8a 100644 --- a/src/Api/Normalizer/PackageResultsShippingReceiptNormalizer.php +++ b/src/Api/Normalizer/PackageResultsShippingReceiptNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageResultsShippingReceiptNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageResultsShippingReceiptNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class; + return $type === \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class => false]; - } - } -} else { - class PackageResultsShippingReceiptNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class; + if (\array_key_exists('ImageFormat', $data)) { + $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class, 'json', $context)); + unset($data['ImageFormat']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class; + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ImageFormat'] = $this->normalizer->normalize($data->getImageFormat(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageResultsSimpleRateNormalizer.php b/src/Api/Normalizer/PackageResultsSimpleRateNormalizer.php index 6bf5338c..1045e66d 100644 --- a/src/Api/Normalizer/PackageResultsSimpleRateNormalizer.php +++ b/src/Api/Normalizer/PackageResultsSimpleRateNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageResultsSimpleRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageResultsSimpleRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class; + return $type === \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsSimpleRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageResultsSimpleRate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PackageResultsSimpleRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageResultsSimpleRate(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageServiceOptionsAccessPointCODNormalizer.php b/src/Api/Normalizer/PackageServiceOptionsAccessPointCODNormalizer.php index b54a4bdf..de9a6e18 100644 --- a/src/Api/Normalizer/PackageServiceOptionsAccessPointCODNormalizer.php +++ b/src/Api/Normalizer/PackageServiceOptionsAccessPointCODNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageServiceOptionsAccessPointCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageServiceOptionsAccessPointCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class; + return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class => false]; - } - } -} else { - class PackageServiceOptionsAccessPointCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageServiceOptionsCODCODAmountNormalizer.php b/src/Api/Normalizer/PackageServiceOptionsCODCODAmountNormalizer.php index 9c32327b..01e3f584 100644 --- a/src/Api/Normalizer/PackageServiceOptionsCODCODAmountNormalizer.php +++ b/src/Api/Normalizer/PackageServiceOptionsCODCODAmountNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageServiceOptionsCODCODAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageServiceOptionsCODCODAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class; + return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class => false]; - } - } -} else { - class PackageServiceOptionsCODCODAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageServiceOptionsCODNormalizer.php b/src/Api/Normalizer/PackageServiceOptionsCODNormalizer.php index dd5695ce..776866fb 100644 --- a/src/Api/Normalizer/PackageServiceOptionsCODNormalizer.php +++ b/src/Api/Normalizer/PackageServiceOptionsCODNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageServiceOptionsCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageServiceOptionsCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class; + return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CODFundsCode', $data)) { - $object->setCODFundsCode($data['CODFundsCode']); - unset($data['CODFundsCode']); - } - if (\array_key_exists('CODAmount', $data)) { - $object->setCODAmount($this->denormalizer->denormalize($data['CODAmount'], \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class, 'json', $context)); - unset($data['CODAmount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CODFundsCode'] = $object->getCODFundsCode(); - $data['CODAmount'] = $this->normalizer->normalize($object->getCODAmount(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class => false]; - } - } -} else { - class PackageServiceOptionsCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class; + if (\array_key_exists('CODFundsCode', $data)) { + $object->setCODFundsCode($data['CODFundsCode']); + unset($data['CODFundsCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class; + if (\array_key_exists('CODAmount', $data)) { + $object->setCODAmount($this->denormalizer->denormalize($data['CODAmount'], \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class, 'json', $context)); + unset($data['CODAmount']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CODFundsCode', $data)) { - $object->setCODFundsCode($data['CODFundsCode']); - unset($data['CODFundsCode']); - } - if (\array_key_exists('CODAmount', $data)) { - $object->setCODAmount($this->denormalizer->denormalize($data['CODAmount'], \ShipStream\Ups\Api\Model\PackageServiceOptionsCODCODAmount::class, 'json', $context)); - unset($data['CODAmount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CODFundsCode'] = $object->getCODFundsCode(); - $data['CODAmount'] = $this->normalizer->normalize($object->getCODAmount(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CODFundsCode'] = $data->getCODFundsCode(); + $dataArray['CODAmount'] = $this->normalizer->normalize($data->getCODAmount(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageServiceOptionsDeclaredValueNormalizer.php b/src/Api/Normalizer/PackageServiceOptionsDeclaredValueNormalizer.php index bc6b8350..e3ce11d8 100644 --- a/src/Api/Normalizer/PackageServiceOptionsDeclaredValueNormalizer.php +++ b/src/Api/Normalizer/PackageServiceOptionsDeclaredValueNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageServiceOptionsDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageServiceOptionsDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class; + return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\DeclaredValueType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class => false]; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\DeclaredValueType::class, 'json', $context)); + unset($data['Type']); } - } -} else { - class PackageServiceOptionsDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\DeclaredValueType::class, 'json', $context)); - unset($data['Type']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('type') && null !== $data->getType()) { + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class => false]; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageServiceOptionsDeclaredValue::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageServiceOptionsDeliveryConfirmationNormalizer.php b/src/Api/Normalizer/PackageServiceOptionsDeliveryConfirmationNormalizer.php index ae774db0..323af4cd 100644 --- a/src/Api/Normalizer/PackageServiceOptionsDeliveryConfirmationNormalizer.php +++ b/src/Api/Normalizer/PackageServiceOptionsDeliveryConfirmationNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageServiceOptionsDeliveryConfirmationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageServiceOptionsDeliveryConfirmationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class; + return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DCISType', $data)) { - $object->setDCISType($data['DCISType']); - unset($data['DCISType']); - } - if (\array_key_exists('DCISNumber', $data)) { - $object->setDCISNumber($data['DCISNumber']); - unset($data['DCISNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['DCISType'] = $object->getDCISType(); - if ($object->isInitialized('dCISNumber') && null !== $object->getDCISNumber()) { - $data['DCISNumber'] = $object->getDCISNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DCISType', $data)) { + $object->setDCISType($data['DCISType']); + unset($data['DCISType']); + } + if (\array_key_exists('DCISNumber', $data)) { + $object->setDCISNumber($data['DCISNumber']); + unset($data['DCISNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PackageServiceOptionsDeliveryConfirmationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class; + $dataArray = []; + $dataArray['DCISType'] = $data->getDCISType(); + if ($data->isInitialized('dCISNumber') && null !== $data->getDCISNumber()) { + $dataArray['DCISNumber'] = $data->getDCISNumber(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DCISType', $data)) { - $object->setDCISType($data['DCISType']); - unset($data['DCISType']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('DCISNumber', $data)) { - $object->setDCISNumber($data['DCISNumber']); - unset($data['DCISNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['DCISType'] = $object->getDCISType(); - if ($object->isInitialized('dCISNumber') && null !== $object->getDCISNumber()) { - $data['DCISNumber'] = $object->getDCISNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageServiceOptionsDeliveryConfirmation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageServiceOptionsDryIceNormalizer.php b/src/Api/Normalizer/PackageServiceOptionsDryIceNormalizer.php index 30f46985..b5eff6a2 100644 --- a/src/Api/Normalizer/PackageServiceOptionsDryIceNormalizer.php +++ b/src/Api/Normalizer/PackageServiceOptionsDryIceNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageServiceOptionsDryIceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageServiceOptionsDryIceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class; + return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('DryIceWeight', $data)) { - $object->setDryIceWeight($this->denormalizer->denormalize($data['DryIceWeight'], \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class, 'json', $context)); - unset($data['DryIceWeight']); - } - if (\array_key_exists('MedicalUseIndicator', $data)) { - $object->setMedicalUseIndicator($data['MedicalUseIndicator']); - unset($data['MedicalUseIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['RegulationSet'] = $object->getRegulationSet(); - $data['DryIceWeight'] = $this->normalizer->normalize($object->getDryIceWeight(), 'json', $context); - if ($object->isInitialized('medicalUseIndicator') && null !== $object->getMedicalUseIndicator()) { - $data['MedicalUseIndicator'] = $object->getMedicalUseIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class => false]; + if (\array_key_exists('RegulationSet', $data)) { + $object->setRegulationSet($data['RegulationSet']); + unset($data['RegulationSet']); } - } -} else { - class PackageServiceOptionsDryIceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class; + if (\array_key_exists('DryIceWeight', $data)) { + $object->setDryIceWeight($this->denormalizer->denormalize($data['DryIceWeight'], \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class, 'json', $context)); + unset($data['DryIceWeight']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class; + if (\array_key_exists('MedicalUseIndicator', $data)) { + $object->setMedicalUseIndicator($data['MedicalUseIndicator']); + unset($data['MedicalUseIndicator']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('DryIceWeight', $data)) { - $object->setDryIceWeight($this->denormalizer->denormalize($data['DryIceWeight'], \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class, 'json', $context)); - unset($data['DryIceWeight']); - } - if (\array_key_exists('MedicalUseIndicator', $data)) { - $object->setMedicalUseIndicator($data['MedicalUseIndicator']); - unset($data['MedicalUseIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['RegulationSet'] = $object->getRegulationSet(); - $data['DryIceWeight'] = $this->normalizer->normalize($object->getDryIceWeight(), 'json', $context); - if ($object->isInitialized('medicalUseIndicator') && null !== $object->getMedicalUseIndicator()) { - $data['MedicalUseIndicator'] = $object->getMedicalUseIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['RegulationSet'] = $data->getRegulationSet(); + $dataArray['DryIceWeight'] = $this->normalizer->normalize($data->getDryIceWeight(), 'json', $context); + if ($data->isInitialized('medicalUseIndicator') && null !== $data->getMedicalUseIndicator()) { + $dataArray['MedicalUseIndicator'] = $data->getMedicalUseIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageServiceOptionsDryIce::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageServiceOptionsHazMatNormalizer.php b/src/Api/Normalizer/PackageServiceOptionsHazMatNormalizer.php index 8ec13a0a..ca0d2098 100644 --- a/src/Api/Normalizer/PackageServiceOptionsHazMatNormalizer.php +++ b/src/Api/Normalizer/PackageServiceOptionsHazMatNormalizer.php @@ -5,524 +5,261 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageServiceOptionsHazMatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageServiceOptionsHazMatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackagingTypeQuantity', $data)) { - $object->setPackagingTypeQuantity($data['PackagingTypeQuantity']); - unset($data['PackagingTypeQuantity']); - } - if (\array_key_exists('RecordIdentifier1', $data)) { - $object->setRecordIdentifier1($data['RecordIdentifier1']); - unset($data['RecordIdentifier1']); - } - if (\array_key_exists('RecordIdentifier2', $data)) { - $object->setRecordIdentifier2($data['RecordIdentifier2']); - unset($data['RecordIdentifier2']); - } - if (\array_key_exists('RecordIdentifier3', $data)) { - $object->setRecordIdentifier3($data['RecordIdentifier3']); - unset($data['RecordIdentifier3']); - } - if (\array_key_exists('SubRiskClass', $data)) { - $object->setSubRiskClass($data['SubRiskClass']); - unset($data['SubRiskClass']); - } - if (\array_key_exists('aDRItemNumber', $data)) { - $object->setADRItemNumber($data['aDRItemNumber']); - unset($data['aDRItemNumber']); - } - if (\array_key_exists('aDRPackingGroupLetter', $data)) { - $object->setADRPackingGroupLetter($data['aDRPackingGroupLetter']); - unset($data['aDRPackingGroupLetter']); - } - if (\array_key_exists('TechnicalName', $data)) { - $object->setTechnicalName($data['TechnicalName']); - unset($data['TechnicalName']); - } - if (\array_key_exists('HazardLabelRequired', $data)) { - $object->setHazardLabelRequired($data['HazardLabelRequired']); - unset($data['HazardLabelRequired']); - } - if (\array_key_exists('ClassDivisionNumber', $data)) { - $object->setClassDivisionNumber($data['ClassDivisionNumber']); - unset($data['ClassDivisionNumber']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $object->setReferenceNumber($data['ReferenceNumber']); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('UOM', $data)) { - $object->setUOM($data['UOM']); - unset($data['UOM']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($data['PackagingType']); - unset($data['PackagingType']); - } - if (\array_key_exists('IDNumber', $data)) { - $object->setIDNumber($data['IDNumber']); - unset($data['IDNumber']); - } - if (\array_key_exists('ProperShippingName', $data)) { - $object->setProperShippingName($data['ProperShippingName']); - unset($data['ProperShippingName']); - } - if (\array_key_exists('AdditionalDescription', $data)) { - $object->setAdditionalDescription($data['AdditionalDescription']); - unset($data['AdditionalDescription']); - } - if (\array_key_exists('PackagingGroupType', $data)) { - $object->setPackagingGroupType($data['PackagingGroupType']); - unset($data['PackagingGroupType']); - } - if (\array_key_exists('PackagingInstructionCode', $data)) { - $object->setPackagingInstructionCode($data['PackagingInstructionCode']); - unset($data['PackagingInstructionCode']); - } - if (\array_key_exists('EmergencyPhone', $data)) { - $object->setEmergencyPhone($data['EmergencyPhone']); - unset($data['EmergencyPhone']); - } - if (\array_key_exists('EmergencyContact', $data)) { - $object->setEmergencyContact($data['EmergencyContact']); - unset($data['EmergencyContact']); - } - if (\array_key_exists('ReportableQuantity', $data)) { - $object->setReportableQuantity($data['ReportableQuantity']); - unset($data['ReportableQuantity']); - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('TransportationMode', $data)) { - $object->setTransportationMode($data['TransportationMode']); - unset($data['TransportationMode']); - } - if (\array_key_exists('CommodityRegulatedLevelCode', $data)) { - $object->setCommodityRegulatedLevelCode($data['CommodityRegulatedLevelCode']); - unset($data['CommodityRegulatedLevelCode']); - } - if (\array_key_exists('TransportCategory', $data)) { - $object->setTransportCategory($data['TransportCategory']); - unset($data['TransportCategory']); - } - if (\array_key_exists('TunnelRestrictionCode', $data)) { - $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); - unset($data['TunnelRestrictionCode']); - } - if (\array_key_exists('ChemicalRecordIdentifier', $data)) { - $object->setChemicalRecordIdentifier($data['ChemicalRecordIdentifier']); - unset($data['ChemicalRecordIdentifier']); - } - if (\array_key_exists('LocalTechnicalName', $data)) { - $object->setLocalTechnicalName($data['LocalTechnicalName']); - unset($data['LocalTechnicalName']); - } - if (\array_key_exists('LocalProperShippingName', $data)) { - $object->setLocalProperShippingName($data['LocalProperShippingName']); - unset($data['LocalProperShippingName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('packagingTypeQuantity') && null !== $object->getPackagingTypeQuantity()) { - $data['PackagingTypeQuantity'] = $object->getPackagingTypeQuantity(); - } - if ($object->isInitialized('recordIdentifier1') && null !== $object->getRecordIdentifier1()) { - $data['RecordIdentifier1'] = $object->getRecordIdentifier1(); - } - if ($object->isInitialized('recordIdentifier2') && null !== $object->getRecordIdentifier2()) { - $data['RecordIdentifier2'] = $object->getRecordIdentifier2(); - } - if ($object->isInitialized('recordIdentifier3') && null !== $object->getRecordIdentifier3()) { - $data['RecordIdentifier3'] = $object->getRecordIdentifier3(); - } - if ($object->isInitialized('subRiskClass') && null !== $object->getSubRiskClass()) { - $data['SubRiskClass'] = $object->getSubRiskClass(); - } - if ($object->isInitialized('aDRItemNumber') && null !== $object->getADRItemNumber()) { - $data['aDRItemNumber'] = $object->getADRItemNumber(); - } - if ($object->isInitialized('aDRPackingGroupLetter') && null !== $object->getADRPackingGroupLetter()) { - $data['aDRPackingGroupLetter'] = $object->getADRPackingGroupLetter(); - } - if ($object->isInitialized('technicalName') && null !== $object->getTechnicalName()) { - $data['TechnicalName'] = $object->getTechnicalName(); - } - if ($object->isInitialized('hazardLabelRequired') && null !== $object->getHazardLabelRequired()) { - $data['HazardLabelRequired'] = $object->getHazardLabelRequired(); - } - if ($object->isInitialized('classDivisionNumber') && null !== $object->getClassDivisionNumber()) { - $data['ClassDivisionNumber'] = $object->getClassDivisionNumber(); - } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $data['ReferenceNumber'] = $object->getReferenceNumber(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['Quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('uOM') && null !== $object->getUOM()) { - $data['UOM'] = $object->getUOM(); - } - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $object->getPackagingType(); - } - if ($object->isInitialized('iDNumber') && null !== $object->getIDNumber()) { - $data['IDNumber'] = $object->getIDNumber(); - } - $data['ProperShippingName'] = $object->getProperShippingName(); - if ($object->isInitialized('additionalDescription') && null !== $object->getAdditionalDescription()) { - $data['AdditionalDescription'] = $object->getAdditionalDescription(); - } - if ($object->isInitialized('packagingGroupType') && null !== $object->getPackagingGroupType()) { - $data['PackagingGroupType'] = $object->getPackagingGroupType(); - } - if ($object->isInitialized('packagingInstructionCode') && null !== $object->getPackagingInstructionCode()) { - $data['PackagingInstructionCode'] = $object->getPackagingInstructionCode(); - } - if ($object->isInitialized('emergencyPhone') && null !== $object->getEmergencyPhone()) { - $data['EmergencyPhone'] = $object->getEmergencyPhone(); - } - if ($object->isInitialized('emergencyContact') && null !== $object->getEmergencyContact()) { - $data['EmergencyContact'] = $object->getEmergencyContact(); - } - if ($object->isInitialized('reportableQuantity') && null !== $object->getReportableQuantity()) { - $data['ReportableQuantity'] = $object->getReportableQuantity(); - } - $data['RegulationSet'] = $object->getRegulationSet(); - $data['TransportationMode'] = $object->getTransportationMode(); - if ($object->isInitialized('commodityRegulatedLevelCode') && null !== $object->getCommodityRegulatedLevelCode()) { - $data['CommodityRegulatedLevelCode'] = $object->getCommodityRegulatedLevelCode(); - } - if ($object->isInitialized('transportCategory') && null !== $object->getTransportCategory()) { - $data['TransportCategory'] = $object->getTransportCategory(); - } - if ($object->isInitialized('tunnelRestrictionCode') && null !== $object->getTunnelRestrictionCode()) { - $data['TunnelRestrictionCode'] = $object->getTunnelRestrictionCode(); - } - if ($object->isInitialized('chemicalRecordIdentifier') && null !== $object->getChemicalRecordIdentifier()) { - $data['ChemicalRecordIdentifier'] = $object->getChemicalRecordIdentifier(); - } - if ($object->isInitialized('localTechnicalName') && null !== $object->getLocalTechnicalName()) { - $data['LocalTechnicalName'] = $object->getLocalTechnicalName(); - } - if ($object->isInitialized('localProperShippingName') && null !== $object->getLocalProperShippingName()) { - $data['LocalProperShippingName'] = $object->getLocalProperShippingName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PackagingTypeQuantity', $data)) { + $object->setPackagingTypeQuantity($data['PackagingTypeQuantity']); + unset($data['PackagingTypeQuantity']); + } + if (\array_key_exists('RecordIdentifier1', $data)) { + $object->setRecordIdentifier1($data['RecordIdentifier1']); + unset($data['RecordIdentifier1']); + } + if (\array_key_exists('RecordIdentifier2', $data)) { + $object->setRecordIdentifier2($data['RecordIdentifier2']); + unset($data['RecordIdentifier2']); + } + if (\array_key_exists('RecordIdentifier3', $data)) { + $object->setRecordIdentifier3($data['RecordIdentifier3']); + unset($data['RecordIdentifier3']); + } + if (\array_key_exists('SubRiskClass', $data)) { + $object->setSubRiskClass($data['SubRiskClass']); + unset($data['SubRiskClass']); + } + if (\array_key_exists('aDRItemNumber', $data)) { + $object->setADRItemNumber($data['aDRItemNumber']); + unset($data['aDRItemNumber']); + } + if (\array_key_exists('aDRPackingGroupLetter', $data)) { + $object->setADRPackingGroupLetter($data['aDRPackingGroupLetter']); + unset($data['aDRPackingGroupLetter']); + } + if (\array_key_exists('TechnicalName', $data)) { + $object->setTechnicalName($data['TechnicalName']); + unset($data['TechnicalName']); + } + if (\array_key_exists('HazardLabelRequired', $data)) { + $object->setHazardLabelRequired($data['HazardLabelRequired']); + unset($data['HazardLabelRequired']); + } + if (\array_key_exists('ClassDivisionNumber', $data)) { + $object->setClassDivisionNumber($data['ClassDivisionNumber']); + unset($data['ClassDivisionNumber']); + } + if (\array_key_exists('ReferenceNumber', $data)) { + $object->setReferenceNumber($data['ReferenceNumber']); + unset($data['ReferenceNumber']); + } + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); + } + if (\array_key_exists('UOM', $data)) { + $object->setUOM($data['UOM']); + unset($data['UOM']); + } + if (\array_key_exists('PackagingType', $data)) { + $object->setPackagingType($data['PackagingType']); + unset($data['PackagingType']); + } + if (\array_key_exists('IDNumber', $data)) { + $object->setIDNumber($data['IDNumber']); + unset($data['IDNumber']); + } + if (\array_key_exists('ProperShippingName', $data)) { + $object->setProperShippingName($data['ProperShippingName']); + unset($data['ProperShippingName']); + } + if (\array_key_exists('AdditionalDescription', $data)) { + $object->setAdditionalDescription($data['AdditionalDescription']); + unset($data['AdditionalDescription']); + } + if (\array_key_exists('PackagingGroupType', $data)) { + $object->setPackagingGroupType($data['PackagingGroupType']); + unset($data['PackagingGroupType']); + } + if (\array_key_exists('PackagingInstructionCode', $data)) { + $object->setPackagingInstructionCode($data['PackagingInstructionCode']); + unset($data['PackagingInstructionCode']); + } + if (\array_key_exists('EmergencyPhone', $data)) { + $object->setEmergencyPhone($data['EmergencyPhone']); + unset($data['EmergencyPhone']); + } + if (\array_key_exists('EmergencyContact', $data)) { + $object->setEmergencyContact($data['EmergencyContact']); + unset($data['EmergencyContact']); + } + if (\array_key_exists('ReportableQuantity', $data)) { + $object->setReportableQuantity($data['ReportableQuantity']); + unset($data['ReportableQuantity']); + } + if (\array_key_exists('RegulationSet', $data)) { + $object->setRegulationSet($data['RegulationSet']); + unset($data['RegulationSet']); + } + if (\array_key_exists('TransportationMode', $data)) { + $object->setTransportationMode($data['TransportationMode']); + unset($data['TransportationMode']); + } + if (\array_key_exists('CommodityRegulatedLevelCode', $data)) { + $object->setCommodityRegulatedLevelCode($data['CommodityRegulatedLevelCode']); + unset($data['CommodityRegulatedLevelCode']); + } + if (\array_key_exists('TransportCategory', $data)) { + $object->setTransportCategory($data['TransportCategory']); + unset($data['TransportCategory']); + } + if (\array_key_exists('TunnelRestrictionCode', $data)) { + $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); + unset($data['TunnelRestrictionCode']); + } + if (\array_key_exists('ChemicalRecordIdentifier', $data)) { + $object->setChemicalRecordIdentifier($data['ChemicalRecordIdentifier']); + unset($data['ChemicalRecordIdentifier']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class => false]; + if (\array_key_exists('LocalTechnicalName', $data)) { + $object->setLocalTechnicalName($data['LocalTechnicalName']); + unset($data['LocalTechnicalName']); } + if (\array_key_exists('LocalProperShippingName', $data)) { + $object->setLocalProperShippingName($data['LocalProperShippingName']); + unset($data['LocalProperShippingName']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PackageServiceOptionsHazMatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackagingTypeQuantity', $data)) { - $object->setPackagingTypeQuantity($data['PackagingTypeQuantity']); - unset($data['PackagingTypeQuantity']); - } - if (\array_key_exists('RecordIdentifier1', $data)) { - $object->setRecordIdentifier1($data['RecordIdentifier1']); - unset($data['RecordIdentifier1']); - } - if (\array_key_exists('RecordIdentifier2', $data)) { - $object->setRecordIdentifier2($data['RecordIdentifier2']); - unset($data['RecordIdentifier2']); - } - if (\array_key_exists('RecordIdentifier3', $data)) { - $object->setRecordIdentifier3($data['RecordIdentifier3']); - unset($data['RecordIdentifier3']); - } - if (\array_key_exists('SubRiskClass', $data)) { - $object->setSubRiskClass($data['SubRiskClass']); - unset($data['SubRiskClass']); - } - if (\array_key_exists('aDRItemNumber', $data)) { - $object->setADRItemNumber($data['aDRItemNumber']); - unset($data['aDRItemNumber']); - } - if (\array_key_exists('aDRPackingGroupLetter', $data)) { - $object->setADRPackingGroupLetter($data['aDRPackingGroupLetter']); - unset($data['aDRPackingGroupLetter']); - } - if (\array_key_exists('TechnicalName', $data)) { - $object->setTechnicalName($data['TechnicalName']); - unset($data['TechnicalName']); - } - if (\array_key_exists('HazardLabelRequired', $data)) { - $object->setHazardLabelRequired($data['HazardLabelRequired']); - unset($data['HazardLabelRequired']); - } - if (\array_key_exists('ClassDivisionNumber', $data)) { - $object->setClassDivisionNumber($data['ClassDivisionNumber']); - unset($data['ClassDivisionNumber']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $object->setReferenceNumber($data['ReferenceNumber']); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('UOM', $data)) { - $object->setUOM($data['UOM']); - unset($data['UOM']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($data['PackagingType']); - unset($data['PackagingType']); - } - if (\array_key_exists('IDNumber', $data)) { - $object->setIDNumber($data['IDNumber']); - unset($data['IDNumber']); - } - if (\array_key_exists('ProperShippingName', $data)) { - $object->setProperShippingName($data['ProperShippingName']); - unset($data['ProperShippingName']); - } - if (\array_key_exists('AdditionalDescription', $data)) { - $object->setAdditionalDescription($data['AdditionalDescription']); - unset($data['AdditionalDescription']); - } - if (\array_key_exists('PackagingGroupType', $data)) { - $object->setPackagingGroupType($data['PackagingGroupType']); - unset($data['PackagingGroupType']); - } - if (\array_key_exists('PackagingInstructionCode', $data)) { - $object->setPackagingInstructionCode($data['PackagingInstructionCode']); - unset($data['PackagingInstructionCode']); - } - if (\array_key_exists('EmergencyPhone', $data)) { - $object->setEmergencyPhone($data['EmergencyPhone']); - unset($data['EmergencyPhone']); - } - if (\array_key_exists('EmergencyContact', $data)) { - $object->setEmergencyContact($data['EmergencyContact']); - unset($data['EmergencyContact']); - } - if (\array_key_exists('ReportableQuantity', $data)) { - $object->setReportableQuantity($data['ReportableQuantity']); - unset($data['ReportableQuantity']); - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('TransportationMode', $data)) { - $object->setTransportationMode($data['TransportationMode']); - unset($data['TransportationMode']); - } - if (\array_key_exists('CommodityRegulatedLevelCode', $data)) { - $object->setCommodityRegulatedLevelCode($data['CommodityRegulatedLevelCode']); - unset($data['CommodityRegulatedLevelCode']); - } - if (\array_key_exists('TransportCategory', $data)) { - $object->setTransportCategory($data['TransportCategory']); - unset($data['TransportCategory']); - } - if (\array_key_exists('TunnelRestrictionCode', $data)) { - $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); - unset($data['TunnelRestrictionCode']); - } - if (\array_key_exists('ChemicalRecordIdentifier', $data)) { - $object->setChemicalRecordIdentifier($data['ChemicalRecordIdentifier']); - unset($data['ChemicalRecordIdentifier']); - } - if (\array_key_exists('LocalTechnicalName', $data)) { - $object->setLocalTechnicalName($data['LocalTechnicalName']); - unset($data['LocalTechnicalName']); - } - if (\array_key_exists('LocalProperShippingName', $data)) { - $object->setLocalProperShippingName($data['LocalProperShippingName']); - unset($data['LocalProperShippingName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('packagingTypeQuantity') && null !== $data->getPackagingTypeQuantity()) { + $dataArray['PackagingTypeQuantity'] = $data->getPackagingTypeQuantity(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('packagingTypeQuantity') && null !== $object->getPackagingTypeQuantity()) { - $data['PackagingTypeQuantity'] = $object->getPackagingTypeQuantity(); - } - if ($object->isInitialized('recordIdentifier1') && null !== $object->getRecordIdentifier1()) { - $data['RecordIdentifier1'] = $object->getRecordIdentifier1(); - } - if ($object->isInitialized('recordIdentifier2') && null !== $object->getRecordIdentifier2()) { - $data['RecordIdentifier2'] = $object->getRecordIdentifier2(); - } - if ($object->isInitialized('recordIdentifier3') && null !== $object->getRecordIdentifier3()) { - $data['RecordIdentifier3'] = $object->getRecordIdentifier3(); - } - if ($object->isInitialized('subRiskClass') && null !== $object->getSubRiskClass()) { - $data['SubRiskClass'] = $object->getSubRiskClass(); - } - if ($object->isInitialized('aDRItemNumber') && null !== $object->getADRItemNumber()) { - $data['aDRItemNumber'] = $object->getADRItemNumber(); - } - if ($object->isInitialized('aDRPackingGroupLetter') && null !== $object->getADRPackingGroupLetter()) { - $data['aDRPackingGroupLetter'] = $object->getADRPackingGroupLetter(); - } - if ($object->isInitialized('technicalName') && null !== $object->getTechnicalName()) { - $data['TechnicalName'] = $object->getTechnicalName(); - } - if ($object->isInitialized('hazardLabelRequired') && null !== $object->getHazardLabelRequired()) { - $data['HazardLabelRequired'] = $object->getHazardLabelRequired(); - } - if ($object->isInitialized('classDivisionNumber') && null !== $object->getClassDivisionNumber()) { - $data['ClassDivisionNumber'] = $object->getClassDivisionNumber(); - } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $data['ReferenceNumber'] = $object->getReferenceNumber(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['Quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('uOM') && null !== $object->getUOM()) { - $data['UOM'] = $object->getUOM(); - } - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $object->getPackagingType(); - } - if ($object->isInitialized('iDNumber') && null !== $object->getIDNumber()) { - $data['IDNumber'] = $object->getIDNumber(); - } - $data['ProperShippingName'] = $object->getProperShippingName(); - if ($object->isInitialized('additionalDescription') && null !== $object->getAdditionalDescription()) { - $data['AdditionalDescription'] = $object->getAdditionalDescription(); - } - if ($object->isInitialized('packagingGroupType') && null !== $object->getPackagingGroupType()) { - $data['PackagingGroupType'] = $object->getPackagingGroupType(); - } - if ($object->isInitialized('packagingInstructionCode') && null !== $object->getPackagingInstructionCode()) { - $data['PackagingInstructionCode'] = $object->getPackagingInstructionCode(); - } - if ($object->isInitialized('emergencyPhone') && null !== $object->getEmergencyPhone()) { - $data['EmergencyPhone'] = $object->getEmergencyPhone(); - } - if ($object->isInitialized('emergencyContact') && null !== $object->getEmergencyContact()) { - $data['EmergencyContact'] = $object->getEmergencyContact(); - } - if ($object->isInitialized('reportableQuantity') && null !== $object->getReportableQuantity()) { - $data['ReportableQuantity'] = $object->getReportableQuantity(); - } - $data['RegulationSet'] = $object->getRegulationSet(); - $data['TransportationMode'] = $object->getTransportationMode(); - if ($object->isInitialized('commodityRegulatedLevelCode') && null !== $object->getCommodityRegulatedLevelCode()) { - $data['CommodityRegulatedLevelCode'] = $object->getCommodityRegulatedLevelCode(); - } - if ($object->isInitialized('transportCategory') && null !== $object->getTransportCategory()) { - $data['TransportCategory'] = $object->getTransportCategory(); - } - if ($object->isInitialized('tunnelRestrictionCode') && null !== $object->getTunnelRestrictionCode()) { - $data['TunnelRestrictionCode'] = $object->getTunnelRestrictionCode(); - } - if ($object->isInitialized('chemicalRecordIdentifier') && null !== $object->getChemicalRecordIdentifier()) { - $data['ChemicalRecordIdentifier'] = $object->getChemicalRecordIdentifier(); - } - if ($object->isInitialized('localTechnicalName') && null !== $object->getLocalTechnicalName()) { - $data['LocalTechnicalName'] = $object->getLocalTechnicalName(); - } - if ($object->isInitialized('localProperShippingName') && null !== $object->getLocalProperShippingName()) { - $data['LocalProperShippingName'] = $object->getLocalProperShippingName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('recordIdentifier1') && null !== $data->getRecordIdentifier1()) { + $dataArray['RecordIdentifier1'] = $data->getRecordIdentifier1(); + } + if ($data->isInitialized('recordIdentifier2') && null !== $data->getRecordIdentifier2()) { + $dataArray['RecordIdentifier2'] = $data->getRecordIdentifier2(); + } + if ($data->isInitialized('recordIdentifier3') && null !== $data->getRecordIdentifier3()) { + $dataArray['RecordIdentifier3'] = $data->getRecordIdentifier3(); + } + if ($data->isInitialized('subRiskClass') && null !== $data->getSubRiskClass()) { + $dataArray['SubRiskClass'] = $data->getSubRiskClass(); + } + if ($data->isInitialized('aDRItemNumber') && null !== $data->getADRItemNumber()) { + $dataArray['aDRItemNumber'] = $data->getADRItemNumber(); + } + if ($data->isInitialized('aDRPackingGroupLetter') && null !== $data->getADRPackingGroupLetter()) { + $dataArray['aDRPackingGroupLetter'] = $data->getADRPackingGroupLetter(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class => false]; + if ($data->isInitialized('technicalName') && null !== $data->getTechnicalName()) { + $dataArray['TechnicalName'] = $data->getTechnicalName(); } + if ($data->isInitialized('hazardLabelRequired') && null !== $data->getHazardLabelRequired()) { + $dataArray['HazardLabelRequired'] = $data->getHazardLabelRequired(); + } + if ($data->isInitialized('classDivisionNumber') && null !== $data->getClassDivisionNumber()) { + $dataArray['ClassDivisionNumber'] = $data->getClassDivisionNumber(); + } + if ($data->isInitialized('referenceNumber') && null !== $data->getReferenceNumber()) { + $dataArray['ReferenceNumber'] = $data->getReferenceNumber(); + } + if ($data->isInitialized('quantity') && null !== $data->getQuantity()) { + $dataArray['Quantity'] = $data->getQuantity(); + } + if ($data->isInitialized('uOM') && null !== $data->getUOM()) { + $dataArray['UOM'] = $data->getUOM(); + } + if ($data->isInitialized('packagingType') && null !== $data->getPackagingType()) { + $dataArray['PackagingType'] = $data->getPackagingType(); + } + if ($data->isInitialized('iDNumber') && null !== $data->getIDNumber()) { + $dataArray['IDNumber'] = $data->getIDNumber(); + } + $dataArray['ProperShippingName'] = $data->getProperShippingName(); + if ($data->isInitialized('additionalDescription') && null !== $data->getAdditionalDescription()) { + $dataArray['AdditionalDescription'] = $data->getAdditionalDescription(); + } + if ($data->isInitialized('packagingGroupType') && null !== $data->getPackagingGroupType()) { + $dataArray['PackagingGroupType'] = $data->getPackagingGroupType(); + } + if ($data->isInitialized('packagingInstructionCode') && null !== $data->getPackagingInstructionCode()) { + $dataArray['PackagingInstructionCode'] = $data->getPackagingInstructionCode(); + } + if ($data->isInitialized('emergencyPhone') && null !== $data->getEmergencyPhone()) { + $dataArray['EmergencyPhone'] = $data->getEmergencyPhone(); + } + if ($data->isInitialized('emergencyContact') && null !== $data->getEmergencyContact()) { + $dataArray['EmergencyContact'] = $data->getEmergencyContact(); + } + if ($data->isInitialized('reportableQuantity') && null !== $data->getReportableQuantity()) { + $dataArray['ReportableQuantity'] = $data->getReportableQuantity(); + } + $dataArray['RegulationSet'] = $data->getRegulationSet(); + $dataArray['TransportationMode'] = $data->getTransportationMode(); + if ($data->isInitialized('commodityRegulatedLevelCode') && null !== $data->getCommodityRegulatedLevelCode()) { + $dataArray['CommodityRegulatedLevelCode'] = $data->getCommodityRegulatedLevelCode(); + } + if ($data->isInitialized('transportCategory') && null !== $data->getTransportCategory()) { + $dataArray['TransportCategory'] = $data->getTransportCategory(); + } + if ($data->isInitialized('tunnelRestrictionCode') && null !== $data->getTunnelRestrictionCode()) { + $dataArray['TunnelRestrictionCode'] = $data->getTunnelRestrictionCode(); + } + if ($data->isInitialized('chemicalRecordIdentifier') && null !== $data->getChemicalRecordIdentifier()) { + $dataArray['ChemicalRecordIdentifier'] = $data->getChemicalRecordIdentifier(); + } + if ($data->isInitialized('localTechnicalName') && null !== $data->getLocalTechnicalName()) { + $dataArray['LocalTechnicalName'] = $data->getLocalTechnicalName(); + } + if ($data->isInitialized('localProperShippingName') && null !== $data->getLocalProperShippingName()) { + $dataArray['LocalProperShippingName'] = $data->getLocalProperShippingName(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageServiceOptionsHazMat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageServiceOptionsInsuranceNormalizer.php b/src/Api/Normalizer/PackageServiceOptionsInsuranceNormalizer.php index 61432a71..cb7a688f 100644 --- a/src/Api/Normalizer/PackageServiceOptionsInsuranceNormalizer.php +++ b/src/Api/Normalizer/PackageServiceOptionsInsuranceNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageServiceOptionsInsuranceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageServiceOptionsInsuranceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class; + return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BasicFlexibleParcelIndicator', $data)) { - $object->setBasicFlexibleParcelIndicator($this->denormalizer->denormalize($data['BasicFlexibleParcelIndicator'], \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class, 'json', $context)); - unset($data['BasicFlexibleParcelIndicator']); - } - if (\array_key_exists('ExtendedFlexibleParcelIndicator', $data)) { - $object->setExtendedFlexibleParcelIndicator($this->denormalizer->denormalize($data['ExtendedFlexibleParcelIndicator'], \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class, 'json', $context)); - unset($data['ExtendedFlexibleParcelIndicator']); - } - if (\array_key_exists('TimeInTransitFlexibleParcelIndicator', $data)) { - $object->setTimeInTransitFlexibleParcelIndicator($this->denormalizer->denormalize($data['TimeInTransitFlexibleParcelIndicator'], \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class, 'json', $context)); - unset($data['TimeInTransitFlexibleParcelIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('basicFlexibleParcelIndicator') && null !== $object->getBasicFlexibleParcelIndicator()) { - $data['BasicFlexibleParcelIndicator'] = $this->normalizer->normalize($object->getBasicFlexibleParcelIndicator(), 'json', $context); - } - if ($object->isInitialized('extendedFlexibleParcelIndicator') && null !== $object->getExtendedFlexibleParcelIndicator()) { - $data['ExtendedFlexibleParcelIndicator'] = $this->normalizer->normalize($object->getExtendedFlexibleParcelIndicator(), 'json', $context); - } - if ($object->isInitialized('timeInTransitFlexibleParcelIndicator') && null !== $object->getTimeInTransitFlexibleParcelIndicator()) { - $data['TimeInTransitFlexibleParcelIndicator'] = $this->normalizer->normalize($object->getTimeInTransitFlexibleParcelIndicator(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('BasicFlexibleParcelIndicator', $data)) { + $object->setBasicFlexibleParcelIndicator($this->denormalizer->denormalize($data['BasicFlexibleParcelIndicator'], \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class, 'json', $context)); + unset($data['BasicFlexibleParcelIndicator']); + } + if (\array_key_exists('ExtendedFlexibleParcelIndicator', $data)) { + $object->setExtendedFlexibleParcelIndicator($this->denormalizer->denormalize($data['ExtendedFlexibleParcelIndicator'], \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class, 'json', $context)); + unset($data['ExtendedFlexibleParcelIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class => false]; + if (\array_key_exists('TimeInTransitFlexibleParcelIndicator', $data)) { + $object->setTimeInTransitFlexibleParcelIndicator($this->denormalizer->denormalize($data['TimeInTransitFlexibleParcelIndicator'], \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class, 'json', $context)); + unset($data['TimeInTransitFlexibleParcelIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PackageServiceOptionsInsuranceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class; + $dataArray = []; + if ($data->isInitialized('basicFlexibleParcelIndicator') && null !== $data->getBasicFlexibleParcelIndicator()) { + $dataArray['BasicFlexibleParcelIndicator'] = $this->normalizer->normalize($data->getBasicFlexibleParcelIndicator(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class; + if ($data->isInitialized('extendedFlexibleParcelIndicator') && null !== $data->getExtendedFlexibleParcelIndicator()) { + $dataArray['ExtendedFlexibleParcelIndicator'] = $this->normalizer->normalize($data->getExtendedFlexibleParcelIndicator(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BasicFlexibleParcelIndicator', $data)) { - $object->setBasicFlexibleParcelIndicator($this->denormalizer->denormalize($data['BasicFlexibleParcelIndicator'], \ShipStream\Ups\Api\Model\InsuranceBasicFlexibleParcelIndicator::class, 'json', $context)); - unset($data['BasicFlexibleParcelIndicator']); - } - if (\array_key_exists('ExtendedFlexibleParcelIndicator', $data)) { - $object->setExtendedFlexibleParcelIndicator($this->denormalizer->denormalize($data['ExtendedFlexibleParcelIndicator'], \ShipStream\Ups\Api\Model\InsuranceExtendedFlexibleParcelIndicator::class, 'json', $context)); - unset($data['ExtendedFlexibleParcelIndicator']); - } - if (\array_key_exists('TimeInTransitFlexibleParcelIndicator', $data)) { - $object->setTimeInTransitFlexibleParcelIndicator($this->denormalizer->denormalize($data['TimeInTransitFlexibleParcelIndicator'], \ShipStream\Ups\Api\Model\InsuranceTimeInTransitFlexibleParcelIndicator::class, 'json', $context)); - unset($data['TimeInTransitFlexibleParcelIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('timeInTransitFlexibleParcelIndicator') && null !== $data->getTimeInTransitFlexibleParcelIndicator()) { + $dataArray['TimeInTransitFlexibleParcelIndicator'] = $this->normalizer->normalize($data->getTimeInTransitFlexibleParcelIndicator(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('basicFlexibleParcelIndicator') && null !== $object->getBasicFlexibleParcelIndicator()) { - $data['BasicFlexibleParcelIndicator'] = $this->normalizer->normalize($object->getBasicFlexibleParcelIndicator(), 'json', $context); - } - if ($object->isInitialized('extendedFlexibleParcelIndicator') && null !== $object->getExtendedFlexibleParcelIndicator()) { - $data['ExtendedFlexibleParcelIndicator'] = $this->normalizer->normalize($object->getExtendedFlexibleParcelIndicator(), 'json', $context); - } - if ($object->isInitialized('timeInTransitFlexibleParcelIndicator') && null !== $object->getTimeInTransitFlexibleParcelIndicator()) { - $data['TimeInTransitFlexibleParcelIndicator'] = $this->normalizer->normalize($object->getTimeInTransitFlexibleParcelIndicator(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageServiceOptionsInsuredValueNormalizer.php b/src/Api/Normalizer/PackageServiceOptionsInsuredValueNormalizer.php index d3edd6d6..9deb5f16 100644 --- a/src/Api/Normalizer/PackageServiceOptionsInsuredValueNormalizer.php +++ b/src/Api/Normalizer/PackageServiceOptionsInsuredValueNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageServiceOptionsInsuredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageServiceOptionsInsuredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class; + return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('currencyCode') && null !== $object->getCurrencyCode()) { - $data['CurrencyCode'] = $object->getCurrencyCode(); - } - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); + } + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PackageServiceOptionsInsuredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class; + $dataArray = []; + if ($data->isInitialized('currencyCode') && null !== $data->getCurrencyCode()) { + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('currencyCode') && null !== $object->getCurrencyCode()) { - $data['CurrencyCode'] = $object->getCurrencyCode(); - } - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageServiceOptionsInsuredValue::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageServiceOptionsNotificationEMailNormalizer.php b/src/Api/Normalizer/PackageServiceOptionsNotificationEMailNormalizer.php index 25bb8b93..bd481c62 100644 --- a/src/Api/Normalizer/PackageServiceOptionsNotificationEMailNormalizer.php +++ b/src/Api/Normalizer/PackageServiceOptionsNotificationEMailNormalizer.php @@ -5,226 +5,112 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageServiceOptionsNotificationEMailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageServiceOptionsNotificationEMailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Subject', $data)) { - $object->setSubject($data['Subject']); - unset($data['Subject']); - } - if (\array_key_exists('SubjectCode', $data)) { - $object->setSubjectCode($data['SubjectCode']); - unset($data['SubjectCode']); - } - if (\array_key_exists('EMailAddress', $data)) { - $values = []; - foreach ($data['EMailAddress'] as $value) { - $values[] = $value; - } - $object->setEMailAddress($values); - unset($data['EMailAddress']); - } - if (\array_key_exists('UndeliverableEMailAddress', $data)) { - $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); - unset($data['UndeliverableEMailAddress']); - } - if (\array_key_exists('FromEMailAddress', $data)) { - $object->setFromEMailAddress($data['FromEMailAddress']); - unset($data['FromEMailAddress']); - } - if (\array_key_exists('FromName', $data)) { - $object->setFromName($data['FromName']); - unset($data['FromName']); - } - if (\array_key_exists('Memo', $data)) { - $object->setMemo($data['Memo']); - unset($data['Memo']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['Subject'] = $object->getSubject(); - } - if ($object->isInitialized('subjectCode') && null !== $object->getSubjectCode()) { - $data['SubjectCode'] = $object->getSubjectCode(); - } + if (\array_key_exists('Subject', $data)) { + $object->setSubject($data['Subject']); + unset($data['Subject']); + } + if (\array_key_exists('SubjectCode', $data)) { + $object->setSubjectCode($data['SubjectCode']); + unset($data['SubjectCode']); + } + if (\array_key_exists('EMailAddress', $data)) { $values = []; - foreach ($object->getEMailAddress() as $value) { + foreach ($data['EMailAddress'] as $value) { $values[] = $value; } - $data['EMailAddress'] = $values; - if ($object->isInitialized('undeliverableEMailAddress') && null !== $object->getUndeliverableEMailAddress()) { - $data['UndeliverableEMailAddress'] = $object->getUndeliverableEMailAddress(); - } - if ($object->isInitialized('fromEMailAddress') && null !== $object->getFromEMailAddress()) { - $data['FromEMailAddress'] = $object->getFromEMailAddress(); - } - if ($object->isInitialized('fromName') && null !== $object->getFromName()) { - $data['FromName'] = $object->getFromName(); - } - if ($object->isInitialized('memo') && null !== $object->getMemo()) { - $data['Memo'] = $object->getMemo(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setEMailAddress($values); + unset($data['EMailAddress']); + } + if (\array_key_exists('UndeliverableEMailAddress', $data)) { + $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); + unset($data['UndeliverableEMailAddress']); + } + if (\array_key_exists('FromEMailAddress', $data)) { + $object->setFromEMailAddress($data['FromEMailAddress']); + unset($data['FromEMailAddress']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class => false]; + if (\array_key_exists('FromName', $data)) { + $object->setFromName($data['FromName']); + unset($data['FromName']); + } + if (\array_key_exists('Memo', $data)) { + $object->setMemo($data['Memo']); + unset($data['Memo']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PackageServiceOptionsNotificationEMailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Subject', $data)) { - $object->setSubject($data['Subject']); - unset($data['Subject']); - } - if (\array_key_exists('SubjectCode', $data)) { - $object->setSubjectCode($data['SubjectCode']); - unset($data['SubjectCode']); - } - if (\array_key_exists('EMailAddress', $data)) { - $values = []; - foreach ($data['EMailAddress'] as $value) { - $values[] = $value; - } - $object->setEMailAddress($values); - unset($data['EMailAddress']); - } - if (\array_key_exists('UndeliverableEMailAddress', $data)) { - $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); - unset($data['UndeliverableEMailAddress']); - } - if (\array_key_exists('FromEMailAddress', $data)) { - $object->setFromEMailAddress($data['FromEMailAddress']); - unset($data['FromEMailAddress']); - } - if (\array_key_exists('FromName', $data)) { - $object->setFromName($data['FromName']); - unset($data['FromName']); - } - if (\array_key_exists('Memo', $data)) { - $object->setMemo($data['Memo']); - unset($data['Memo']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('subject') && null !== $data->getSubject()) { + $dataArray['Subject'] = $data->getSubject(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['Subject'] = $object->getSubject(); - } - if ($object->isInitialized('subjectCode') && null !== $object->getSubjectCode()) { - $data['SubjectCode'] = $object->getSubjectCode(); - } - $values = []; - foreach ($object->getEMailAddress() as $value) { - $values[] = $value; - } - $data['EMailAddress'] = $values; - if ($object->isInitialized('undeliverableEMailAddress') && null !== $object->getUndeliverableEMailAddress()) { - $data['UndeliverableEMailAddress'] = $object->getUndeliverableEMailAddress(); - } - if ($object->isInitialized('fromEMailAddress') && null !== $object->getFromEMailAddress()) { - $data['FromEMailAddress'] = $object->getFromEMailAddress(); - } - if ($object->isInitialized('fromName') && null !== $object->getFromName()) { - $data['FromName'] = $object->getFromName(); - } - if ($object->isInitialized('memo') && null !== $object->getMemo()) { - $data['Memo'] = $object->getMemo(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('subjectCode') && null !== $data->getSubjectCode()) { + $dataArray['SubjectCode'] = $data->getSubjectCode(); + } + $values = []; + foreach ($data->getEMailAddress() as $value) { + $values[] = $value; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class => false]; + $dataArray['EMailAddress'] = $values; + if ($data->isInitialized('undeliverableEMailAddress') && null !== $data->getUndeliverableEMailAddress()) { + $dataArray['UndeliverableEMailAddress'] = $data->getUndeliverableEMailAddress(); } + if ($data->isInitialized('fromEMailAddress') && null !== $data->getFromEMailAddress()) { + $dataArray['FromEMailAddress'] = $data->getFromEMailAddress(); + } + if ($data->isInitialized('fromName') && null !== $data->getFromName()) { + $dataArray['FromName'] = $data->getFromName(); + } + if ($data->isInitialized('memo') && null !== $data->getMemo()) { + $dataArray['Memo'] = $data->getMemo(); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageServiceOptionsNotificationNormalizer.php b/src/Api/Normalizer/PackageServiceOptionsNotificationNormalizer.php index b3e004e9..6936f725 100644 --- a/src/Api/Normalizer/PackageServiceOptionsNotificationNormalizer.php +++ b/src/Api/Normalizer/PackageServiceOptionsNotificationNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageServiceOptionsNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageServiceOptionsNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class; + return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('NotificationCode', $data)) { - $object->setNotificationCode($data['NotificationCode']); - unset($data['NotificationCode']); - } - if (\array_key_exists('EMail', $data)) { - $object->setEMail($this->denormalizer->denormalize($data['EMail'], \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class, 'json', $context)); - unset($data['EMail']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['NotificationCode'] = $object->getNotificationCode(); - $data['EMail'] = $this->normalizer->normalize($object->getEMail(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class => false]; - } - } -} else { - class PackageServiceOptionsNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class; + if (\array_key_exists('NotificationCode', $data)) { + $object->setNotificationCode($data['NotificationCode']); + unset($data['NotificationCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class; + if (\array_key_exists('EMail', $data)) { + $object->setEMail($this->denormalizer->denormalize($data['EMail'], \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class, 'json', $context)); + unset($data['EMail']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsNotification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('NotificationCode', $data)) { - $object->setNotificationCode($data['NotificationCode']); - unset($data['NotificationCode']); - } - if (\array_key_exists('EMail', $data)) { - $object->setEMail($this->denormalizer->denormalize($data['EMail'], \ShipStream\Ups\Api\Model\PackageServiceOptionsNotificationEMail::class, 'json', $context)); - unset($data['EMail']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['NotificationCode'] = $object->getNotificationCode(); - $data['EMail'] = $this->normalizer->normalize($object->getEMail(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['NotificationCode'] = $data->getNotificationCode(); + $dataArray['EMail'] = $this->normalizer->normalize($data->getEMail(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageServiceOptionsNotification::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageServiceOptionsShipperDeclaredValueNormalizer.php b/src/Api/Normalizer/PackageServiceOptionsShipperDeclaredValueNormalizer.php index db05231f..cf425514 100644 --- a/src/Api/Normalizer/PackageServiceOptionsShipperDeclaredValueNormalizer.php +++ b/src/Api/Normalizer/PackageServiceOptionsShipperDeclaredValueNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageServiceOptionsShipperDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageServiceOptionsShipperDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class; + return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class => false]; - } - } -} else { - class PackageServiceOptionsShipperDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageSimpleRateNormalizer.php b/src/Api/Normalizer/PackageSimpleRateNormalizer.php index ceea62c0..54af4075 100644 --- a/src/Api/Normalizer/PackageSimpleRateNormalizer.php +++ b/src/Api/Normalizer/PackageSimpleRateNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageSimpleRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageSimpleRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageSimpleRate::class; + return $type === \ShipStream\Ups\Api\Model\PackageSimpleRate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageSimpleRate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageSimpleRate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageSimpleRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageSimpleRate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageSimpleRate::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PackageSimpleRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageSimpleRate::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageSimpleRate::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageSimpleRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageSimpleRate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageSimpleRate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageUPSPremierNormalizer.php b/src/Api/Normalizer/PackageUPSPremierNormalizer.php index 2b018a68..f91166e7 100644 --- a/src/Api/Normalizer/PackageUPSPremierNormalizer.php +++ b/src/Api/Normalizer/PackageUPSPremierNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageUPSPremierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageUPSPremierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageUPSPremier::class; + return $type === \ShipStream\Ups\Api\Model\PackageUPSPremier::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageUPSPremier::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageUPSPremier::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageUPSPremier(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Category', $data)) { - $object->setCategory($data['Category']); - unset($data['Category']); - } - if (\array_key_exists('SensorID', $data)) { - $object->setSensorID($data['SensorID']); - unset($data['SensorID']); - } - if (\array_key_exists('HandlingInstructions', $data)) { - $object->setHandlingInstructions($this->denormalizer->denormalize($data['HandlingInstructions'], \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class, 'json', $context)); - unset($data['HandlingInstructions']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageUPSPremier(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Category'] = $object->getCategory(); - $data['SensorID'] = $object->getSensorID(); - $data['HandlingInstructions'] = $this->normalizer->normalize($object->getHandlingInstructions(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Category', $data)) { + $object->setCategory($data['Category']); + unset($data['Category']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageUPSPremier::class => false]; + if (\array_key_exists('SensorID', $data)) { + $object->setSensorID($data['SensorID']); + unset($data['SensorID']); } - } -} else { - class PackageUPSPremierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageUPSPremier::class; + if (\array_key_exists('HandlingInstructions', $data)) { + $object->setHandlingInstructions($this->denormalizer->denormalize($data['HandlingInstructions'], \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class, 'json', $context)); + unset($data['HandlingInstructions']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageUPSPremier::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageUPSPremier(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Category', $data)) { - $object->setCategory($data['Category']); - unset($data['Category']); - } - if (\array_key_exists('SensorID', $data)) { - $object->setSensorID($data['SensorID']); - unset($data['SensorID']); - } - if (\array_key_exists('HandlingInstructions', $data)) { - $object->setHandlingInstructions($this->denormalizer->denormalize($data['HandlingInstructions'], \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class, 'json', $context)); - unset($data['HandlingInstructions']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Category'] = $object->getCategory(); - $data['SensorID'] = $object->getSensorID(); - $data['HandlingInstructions'] = $this->normalizer->normalize($object->getHandlingInstructions(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Category'] = $data->getCategory(); + $dataArray['SensorID'] = $data->getSensorID(); + $dataArray['HandlingInstructions'] = $this->normalizer->normalize($data->getHandlingInstructions(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageUPSPremier::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageUPSPremier::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackageWeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/PackageWeightUnitOfMeasurementNormalizer.php index 957510ed..75146480 100644 --- a/src/Api/Normalizer/PackageWeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/PackageWeightUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackageWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackageWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PackageWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackageWeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackingListHandlingUnitNormalizer.php b/src/Api/Normalizer/PackingListHandlingUnitNormalizer.php index 3deee18e..4398ddbe 100644 --- a/src/Api/Normalizer/PackingListHandlingUnitNormalizer.php +++ b/src/Api/Normalizer/PackingListHandlingUnitNormalizer.php @@ -5,216 +5,107 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackingListHandlingUnitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackingListHandlingUnitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackingListHandlingUnit(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Commodity', $data)) { - $values = []; - foreach ($data['Commodity'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class, 'json', $context); - } - $object->setCommodity($values); - unset($data['Commodity']); - } - if (\array_key_exists('SpecialInstructions', $data)) { - $object->setSpecialInstructions($data['SpecialInstructions']); - unset($data['SpecialInstructions']); - } - if (\array_key_exists('TotalNumberOfPieces', $data)) { - $object->setTotalNumberOfPieces($data['TotalNumberOfPieces']); - unset($data['TotalNumberOfPieces']); - } - if (\array_key_exists('TotalWeight', $data)) { - $object->setTotalWeight($data['TotalWeight']); - unset($data['TotalWeight']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PackingListHandlingUnit(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('commodity') && null !== $object->getCommodity()) { - $values = []; - foreach ($object->getCommodity() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Commodity'] = $values; - } - if ($object->isInitialized('specialInstructions') && null !== $object->getSpecialInstructions()) { - $data['SpecialInstructions'] = $object->getSpecialInstructions(); - } - if ($object->isInitialized('totalNumberOfPieces') && null !== $object->getTotalNumberOfPieces()) { - $data['TotalNumberOfPieces'] = $object->getTotalNumberOfPieces(); - } - if ($object->isInitialized('totalWeight') && null !== $object->getTotalWeight()) { - $data['TotalWeight'] = $object->getTotalWeight(); - } - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); + if (\array_key_exists('Commodity', $data)) { + $values = []; + foreach ($data['Commodity'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class, 'json', $context); } - if ($object->isInitialized('currencyCode') && null !== $object->getCurrencyCode()) { - $data['CurrencyCode'] = $object->getCurrencyCode(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setCommodity($values); + unset($data['Commodity']); + } + if (\array_key_exists('SpecialInstructions', $data)) { + $object->setSpecialInstructions($data['SpecialInstructions']); + unset($data['SpecialInstructions']); + } + if (\array_key_exists('TotalNumberOfPieces', $data)) { + $object->setTotalNumberOfPieces($data['TotalNumberOfPieces']); + unset($data['TotalNumberOfPieces']); + } + if (\array_key_exists('TotalWeight', $data)) { + $object->setTotalWeight($data['TotalWeight']); + unset($data['TotalWeight']); + } + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackingListHandlingUnit::class => false]; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class PackingListHandlingUnitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListHandlingUnit::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackingListHandlingUnit(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Commodity', $data)) { - $values = []; - foreach ($data['Commodity'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\HandlingUnitCommodity::class, 'json', $context); - } - $object->setCommodity($values); - unset($data['Commodity']); - } - if (\array_key_exists('SpecialInstructions', $data)) { - $object->setSpecialInstructions($data['SpecialInstructions']); - unset($data['SpecialInstructions']); - } - if (\array_key_exists('TotalNumberOfPieces', $data)) { - $object->setTotalNumberOfPieces($data['TotalNumberOfPieces']); - unset($data['TotalNumberOfPieces']); + $dataArray = []; + if ($data->isInitialized('commodity') && null !== $data->getCommodity()) { + $values = []; + foreach ($data->getCommodity() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - if (\array_key_exists('TotalWeight', $data)) { - $object->setTotalWeight($data['TotalWeight']); - unset($data['TotalWeight']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\HandlingUnitUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray['Commodity'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('commodity') && null !== $object->getCommodity()) { - $values = []; - foreach ($object->getCommodity() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Commodity'] = $values; - } - if ($object->isInitialized('specialInstructions') && null !== $object->getSpecialInstructions()) { - $data['SpecialInstructions'] = $object->getSpecialInstructions(); - } - if ($object->isInitialized('totalNumberOfPieces') && null !== $object->getTotalNumberOfPieces()) { - $data['TotalNumberOfPieces'] = $object->getTotalNumberOfPieces(); - } - if ($object->isInitialized('totalWeight') && null !== $object->getTotalWeight()) { - $data['TotalWeight'] = $object->getTotalWeight(); - } - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - } - if ($object->isInitialized('currencyCode') && null !== $object->getCurrencyCode()) { - $data['CurrencyCode'] = $object->getCurrencyCode(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('specialInstructions') && null !== $data->getSpecialInstructions()) { + $dataArray['SpecialInstructions'] = $data->getSpecialInstructions(); + } + if ($data->isInitialized('totalNumberOfPieces') && null !== $data->getTotalNumberOfPieces()) { + $dataArray['TotalNumberOfPieces'] = $data->getTotalNumberOfPieces(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackingListHandlingUnit::class => false]; + if ($data->isInitialized('totalWeight') && null !== $data->getTotalWeight()) { + $dataArray['TotalWeight'] = $data->getTotalWeight(); } + if ($data->isInitialized('unitOfMeasurement') && null !== $data->getUnitOfMeasurement()) { + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + } + if ($data->isInitialized('currencyCode') && null !== $data->getCurrencyCode()) { + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackingListHandlingUnit::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackingListInfoPackageAssociatedNormalizer.php b/src/Api/Normalizer/PackingListInfoPackageAssociatedNormalizer.php index 69ccf3fd..eaea7335 100644 --- a/src/Api/Normalizer/PackingListInfoPackageAssociatedNormalizer.php +++ b/src/Api/Normalizer/PackingListInfoPackageAssociatedNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackingListInfoPackageAssociatedNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackingListInfoPackageAssociatedNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class; + return $type === \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageNumber', $data)) { - $object->setPackageNumber($data['PackageNumber']); - unset($data['PackageNumber']); - } - if (\array_key_exists('ProductAmount', $data)) { - $object->setProductAmount($data['ProductAmount']); - unset($data['ProductAmount']); - } - if (\array_key_exists('ProductNote', $data)) { - $object->setProductNote($data['ProductNote']); - unset($data['ProductNote']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PackageNumber'] = $object->getPackageNumber(); - $data['ProductAmount'] = $object->getProductAmount(); - if ($object->isInitialized('productNote') && null !== $object->getProductNote()) { - $data['ProductNote'] = $object->getProductNote(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class => false]; + if (\array_key_exists('PackageNumber', $data)) { + $object->setPackageNumber($data['PackageNumber']); + unset($data['PackageNumber']); } - } -} else { - class PackingListInfoPackageAssociatedNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class; + if (\array_key_exists('ProductAmount', $data)) { + $object->setProductAmount($data['ProductAmount']); + unset($data['ProductAmount']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class; + if (\array_key_exists('ProductNote', $data)) { + $object->setProductNote($data['ProductNote']); + unset($data['ProductNote']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageNumber', $data)) { - $object->setPackageNumber($data['PackageNumber']); - unset($data['PackageNumber']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('ProductAmount', $data)) { - $object->setProductAmount($data['ProductAmount']); - unset($data['ProductAmount']); - } - if (\array_key_exists('ProductNote', $data)) { - $object->setProductNote($data['ProductNote']); - unset($data['ProductNote']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PackageNumber'] = $object->getPackageNumber(); - $data['ProductAmount'] = $object->getProductAmount(); - if ($object->isInitialized('productNote') && null !== $object->getProductNote()) { - $data['ProductNote'] = $object->getProductNote(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['PackageNumber'] = $data->getPackageNumber(); + $dataArray['ProductAmount'] = $data->getProductAmount(); + if ($data->isInitialized('productNote') && null !== $data->getProductNote()) { + $dataArray['ProductNote'] = $data->getProductNote(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackingListReferenceNormalizer.php b/src/Api/Normalizer/PackingListReferenceNormalizer.php index b547d594..61090e17 100644 --- a/src/Api/Normalizer/PackingListReferenceNormalizer.php +++ b/src/Api/Normalizer/PackingListReferenceNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackingListReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackingListReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackingListReference::class; + return $type === \ShipStream\Ups\Api\Model\PackingListReference::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListReference::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListReference::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackingListReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Label', $data)) { - $object->setLabel($data['Label']); - unset($data['Label']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PackingListReference(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('label') && null !== $object->getLabel()) { - $data['Label'] = $object->getLabel(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Label', $data)) { + $object->setLabel($data['Label']); + unset($data['Label']); + } + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackingListReference::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PackingListReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackingListReference::class; + $dataArray = []; + if ($data->isInitialized('label') && null !== $data->getLabel()) { + $dataArray['Label'] = $data->getLabel(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListReference::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackingListReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Label', $data)) { - $object->setLabel($data['Label']); - unset($data['Label']); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('label') && null !== $object->getLabel()) { - $data['Label'] = $object->getLabel(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackingListReference::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackingListReference::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackingListShipFromNormalizer.php b/src/Api/Normalizer/PackingListShipFromNormalizer.php index 6ab87604..59f457d1 100644 --- a/src/Api/Normalizer/PackingListShipFromNormalizer.php +++ b/src/Api/Normalizer/PackingListShipFromNormalizer.php @@ -5,196 +5,97 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackingListShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackingListShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackingListShipFrom::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListShipFrom::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackingListShipFrom(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('PhoneExtension', $data)) { - $object->setPhoneExtension($data['PhoneExtension']); - unset($data['PhoneExtension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\PackingListShipFrom::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListShipFrom::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PackingListShipFrom(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('phoneNumber') && null !== $object->getPhoneNumber()) { - $data['PhoneNumber'] = $object->getPhoneNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('phoneExtension') && null !== $object->getPhoneExtension()) { - $data['PhoneExtension'] = $object->getPhoneExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class, 'json', $context)); + unset($data['Address']); + } + if (\array_key_exists('PhoneNumber', $data)) { + $object->setPhoneNumber($data['PhoneNumber']); + unset($data['PhoneNumber']); + } + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackingListShipFrom::class => false]; + if (\array_key_exists('PhoneExtension', $data)) { + $object->setPhoneExtension($data['PhoneExtension']); + unset($data['PhoneExtension']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PackingListShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackingListShipFrom::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListShipFrom::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackingListShipFrom(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipShipFromAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('PhoneExtension', $data)) { - $object->setPhoneExtension($data['PhoneExtension']); - unset($data['PhoneExtension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Name'] = $data->getName(); + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('phoneNumber') && null !== $object->getPhoneNumber()) { - $data['PhoneNumber'] = $object->getPhoneNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('phoneExtension') && null !== $object->getPhoneExtension()) { - $data['PhoneExtension'] = $object->getPhoneExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('address') && null !== $data->getAddress()) { + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackingListShipFrom::class => false]; + if ($data->isInitialized('phoneNumber') && null !== $data->getPhoneNumber()) { + $dataArray['PhoneNumber'] = $data->getPhoneNumber(); } + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); + } + if ($data->isInitialized('phoneExtension') && null !== $data->getPhoneExtension()) { + $dataArray['PhoneExtension'] = $data->getPhoneExtension(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackingListShipFrom::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PackingListShipToNormalizer.php b/src/Api/Normalizer/PackingListShipToNormalizer.php index 9b3a287c..9b9c9b35 100644 --- a/src/Api/Normalizer/PackingListShipToNormalizer.php +++ b/src/Api/Normalizer/PackingListShipToNormalizer.php @@ -5,196 +5,97 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PackingListShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PackingListShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackingListShipTo::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListShipTo::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackingListShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('PhoneExtension', $data)) { - $object->setPhoneExtension($data['PhoneExtension']); - unset($data['PhoneExtension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\PackingListShipTo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListShipTo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PackingListShipTo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('phoneNumber') && null !== $object->getPhoneNumber()) { - $data['PhoneNumber'] = $object->getPhoneNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('phoneExtension') && null !== $object->getPhoneExtension()) { - $data['PhoneExtension'] = $object->getPhoneExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class, 'json', $context)); + unset($data['Address']); + } + if (\array_key_exists('PhoneNumber', $data)) { + $object->setPhoneNumber($data['PhoneNumber']); + unset($data['PhoneNumber']); + } + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackingListShipTo::class => false]; + if (\array_key_exists('PhoneExtension', $data)) { + $object->setPhoneExtension($data['PhoneExtension']); + unset($data['PhoneExtension']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PackingListShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PackingListShipTo::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PackingListShipTo::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PackingListShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('PhoneExtension', $data)) { - $object->setPhoneExtension($data['PhoneExtension']); - unset($data['PhoneExtension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Name'] = $data->getName(); + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - if ($object->isInitialized('phoneNumber') && null !== $object->getPhoneNumber()) { - $data['PhoneNumber'] = $object->getPhoneNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('phoneExtension') && null !== $object->getPhoneExtension()) { - $data['PhoneExtension'] = $object->getPhoneExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('address') && null !== $data->getAddress()) { + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PackingListShipTo::class => false]; + if ($data->isInitialized('phoneNumber') && null !== $data->getPhoneNumber()) { + $dataArray['PhoneNumber'] = $data->getPhoneNumber(); } + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); + } + if ($data->isInitialized('phoneExtension') && null !== $data->getPhoneExtension()) { + $dataArray['PhoneExtension'] = $data->getPhoneExtension(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PackingListShipTo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PalletInformationDimensionsNormalizer.php b/src/Api/Normalizer/PalletInformationDimensionsNormalizer.php index 3fdcc61b..2c0d909a 100644 --- a/src/Api/Normalizer/PalletInformationDimensionsNormalizer.php +++ b/src/Api/Normalizer/PalletInformationDimensionsNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PalletInformationDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PalletInformationDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PalletInformationDimensions::class; + return $type === \ShipStream\Ups\Api\Model\PalletInformationDimensions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PalletInformationDimensions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PalletInformationDimensions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PalletInformationDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PalletInformationDimensions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['Height'] = $object->getHeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PalletInformationDimensions::class => false]; + if (\array_key_exists('Length', $data)) { + $object->setLength($data['Length']); + unset($data['Length']); } - } -} else { - class PalletInformationDimensionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PalletInformationDimensions::class; + if (\array_key_exists('Width', $data)) { + $object->setWidth($data['Width']); + unset($data['Width']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PalletInformationDimensions::class; + if (\array_key_exists('Height', $data)) { + $object->setHeight($data['Height']); + unset($data['Height']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PalletInformationDimensions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\DimensionsUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Length', $data)) { - $object->setLength($data['Length']); - unset($data['Length']); - } - if (\array_key_exists('Width', $data)) { - $object->setWidth($data['Width']); - unset($data['Width']); - } - if (\array_key_exists('Height', $data)) { - $object->setHeight($data['Height']); - unset($data['Height']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Length'] = $object->getLength(); - $data['Width'] = $object->getWidth(); - $data['Height'] = $object->getHeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Length'] = $data->getLength(); + $dataArray['Width'] = $data->getWidth(); + $dataArray['Height'] = $data->getHeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PalletInformationDimensions::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PalletInformationDimensions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PayerAddressNormalizer.php b/src/Api/Normalizer/PayerAddressNormalizer.php index c0dfd44d..79180a5a 100644 --- a/src/Api/Normalizer/PayerAddressNormalizer.php +++ b/src/Api/Normalizer/PayerAddressNormalizer.php @@ -5,204 +5,101 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PayerAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PayerAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PayerAddress::class; + return $type === \ShipStream\Ups\Api\Model\PayerAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PayerAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PayerAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PayerAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PayerAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PayerAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('Town', $data)) { + $object->setTown($data['Town']); + unset($data['Town']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class PayerAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PayerAddress::class; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PayerAddress::class; + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PayerAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['Town'] = $data->getTown(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PayerAddress::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PayerAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PayerPhoneNormalizer.php b/src/Api/Normalizer/PayerPhoneNormalizer.php index 9374dc41..34bec162 100644 --- a/src/Api/Normalizer/PayerPhoneNormalizer.php +++ b/src/Api/Normalizer/PayerPhoneNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PayerPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PayerPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PayerPhone::class; + return $type === \ShipStream\Ups\Api\Model\PayerPhone::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PayerPhone::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PayerPhone::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PayerPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PayerPhone(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Extension', $data)) { + $object->setExtension($data['Extension']); + unset($data['Extension']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PayerPhone::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PayerPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PayerPhone::class; + $dataArray = []; + $dataArray['Number'] = $data->getNumber(); + if ($data->isInitialized('extension') && null !== $data->getExtension()) { + $dataArray['Extension'] = $data->getExtension(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PayerPhone::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PayerPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PayerPhone::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PayerPhone::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PaymentDetailsShipmentChargeNormalizer.php b/src/Api/Normalizer/PaymentDetailsShipmentChargeNormalizer.php index d09c20a2..01a09d91 100644 --- a/src/Api/Normalizer/PaymentDetailsShipmentChargeNormalizer.php +++ b/src/Api/Normalizer/PaymentDetailsShipmentChargeNormalizer.php @@ -5,182 +5,90 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PaymentDetailsShipmentChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PaymentDetailsShipmentChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class; + return $type === \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('BillShipper', $data)) { - $object->setBillShipper($this->denormalizer->denormalize($data['BillShipper'], \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class, 'json', $context)); - unset($data['BillShipper']); - } - if (\array_key_exists('BillReceiver', $data)) { - $object->setBillReceiver($this->denormalizer->denormalize($data['BillReceiver'], \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class, 'json', $context)); - unset($data['BillReceiver']); - } - if (\array_key_exists('BillThirdParty', $data)) { - $object->setBillThirdParty($this->denormalizer->denormalize($data['BillThirdParty'], \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class, 'json', $context)); - unset($data['BillThirdParty']); - } - if (\array_key_exists('ConsigneeBilledIndicator', $data)) { - $object->setConsigneeBilledIndicator($data['ConsigneeBilledIndicator']); - unset($data['ConsigneeBilledIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $object->getType(); - if ($object->isInitialized('billShipper') && null !== $object->getBillShipper()) { - $data['BillShipper'] = $this->normalizer->normalize($object->getBillShipper(), 'json', $context); - } - if ($object->isInitialized('billReceiver') && null !== $object->getBillReceiver()) { - $data['BillReceiver'] = $this->normalizer->normalize($object->getBillReceiver(), 'json', $context); - } - if ($object->isInitialized('billThirdParty') && null !== $object->getBillThirdParty()) { - $data['BillThirdParty'] = $this->normalizer->normalize($object->getBillThirdParty(), 'json', $context); - } - if ($object->isInitialized('consigneeBilledIndicator') && null !== $object->getConsigneeBilledIndicator()) { - $data['ConsigneeBilledIndicator'] = $object->getConsigneeBilledIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Type', $data)) { + $object->setType($data['Type']); + unset($data['Type']); + } + if (\array_key_exists('BillShipper', $data)) { + $object->setBillShipper($this->denormalizer->denormalize($data['BillShipper'], \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class, 'json', $context)); + unset($data['BillShipper']); + } + if (\array_key_exists('BillReceiver', $data)) { + $object->setBillReceiver($this->denormalizer->denormalize($data['BillReceiver'], \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class, 'json', $context)); + unset($data['BillReceiver']); + } + if (\array_key_exists('BillThirdParty', $data)) { + $object->setBillThirdParty($this->denormalizer->denormalize($data['BillThirdParty'], \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class, 'json', $context)); + unset($data['BillThirdParty']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class => false]; + if (\array_key_exists('ConsigneeBilledIndicator', $data)) { + $object->setConsigneeBilledIndicator($data['ConsigneeBilledIndicator']); + unset($data['ConsigneeBilledIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PaymentDetailsShipmentChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class; + $dataArray = []; + $dataArray['Type'] = $data->getType(); + if ($data->isInitialized('billShipper') && null !== $data->getBillShipper()) { + $dataArray['BillShipper'] = $this->normalizer->normalize($data->getBillShipper(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class; + if ($data->isInitialized('billReceiver') && null !== $data->getBillReceiver()) { + $dataArray['BillReceiver'] = $this->normalizer->normalize($data->getBillReceiver(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('BillShipper', $data)) { - $object->setBillShipper($this->denormalizer->denormalize($data['BillShipper'], \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class, 'json', $context)); - unset($data['BillShipper']); - } - if (\array_key_exists('BillReceiver', $data)) { - $object->setBillReceiver($this->denormalizer->denormalize($data['BillReceiver'], \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class, 'json', $context)); - unset($data['BillReceiver']); - } - if (\array_key_exists('BillThirdParty', $data)) { - $object->setBillThirdParty($this->denormalizer->denormalize($data['BillThirdParty'], \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class, 'json', $context)); - unset($data['BillThirdParty']); - } - if (\array_key_exists('ConsigneeBilledIndicator', $data)) { - $object->setConsigneeBilledIndicator($data['ConsigneeBilledIndicator']); - unset($data['ConsigneeBilledIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('billThirdParty') && null !== $data->getBillThirdParty()) { + $dataArray['BillThirdParty'] = $this->normalizer->normalize($data->getBillThirdParty(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $object->getType(); - if ($object->isInitialized('billShipper') && null !== $object->getBillShipper()) { - $data['BillShipper'] = $this->normalizer->normalize($object->getBillShipper(), 'json', $context); - } - if ($object->isInitialized('billReceiver') && null !== $object->getBillReceiver()) { - $data['BillReceiver'] = $this->normalizer->normalize($object->getBillReceiver(), 'json', $context); - } - if ($object->isInitialized('billThirdParty') && null !== $object->getBillThirdParty()) { - $data['BillThirdParty'] = $this->normalizer->normalize($object->getBillThirdParty(), 'json', $context); - } - if ($object->isInitialized('consigneeBilledIndicator') && null !== $object->getConsigneeBilledIndicator()) { - $data['ConsigneeBilledIndicator'] = $object->getConsigneeBilledIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('consigneeBilledIndicator') && null !== $data->getConsigneeBilledIndicator()) { + $dataArray['ConsigneeBilledIndicator'] = $data->getConsigneeBilledIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PaymentInformationNormalizer.php b/src/Api/Normalizer/PaymentInformationNormalizer.php index af7c1b1c..966f8412 100644 --- a/src/Api/Normalizer/PaymentInformationNormalizer.php +++ b/src/Api/Normalizer/PaymentInformationNormalizer.php @@ -5,200 +5,102 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PaymentInformation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentInformation::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PaymentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('amount', $data)) { - $object->setAmount($data['amount']); - unset($data['amount']); - } - if (\array_key_exists('currency', $data)) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } - if (\array_key_exists('id', $data)) { - $object->setId($data['id']); - unset($data['id']); - } - if (\array_key_exists('paid', $data)) { - $object->setPaid($data['paid']); - unset($data['paid']); - } - if (\array_key_exists('paymentMethod', $data)) { - $object->setPaymentMethod($data['paymentMethod']); - unset($data['paymentMethod']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\PaymentInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PaymentInformation(); + if (\array_key_exists('paid', $data) && \is_int($data['paid'])) { + $data['paid'] = (bool) $data['paid']; + } + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('amount') && null !== $object->getAmount()) { - $data['amount'] = $object->getAmount(); - } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); - } - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('paid') && null !== $object->getPaid()) { - $data['paid'] = $object->getPaid(); - } - if ($object->isInitialized('paymentMethod') && null !== $object->getPaymentMethod()) { - $data['paymentMethod'] = $object->getPaymentMethod(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('amount', $data)) { + $object->setAmount($data['amount']); + unset($data['amount']); + } + if (\array_key_exists('currency', $data)) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } + if (\array_key_exists('id', $data)) { + $object->setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('paid', $data)) { + $object->setPaid($data['paid']); + unset($data['paid']); + } + if (\array_key_exists('paymentMethod', $data)) { + $object->setPaymentMethod($data['paymentMethod']); + unset($data['paymentMethod']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PaymentInformation::class => false]; + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PaymentInformation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentInformation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PaymentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('amount', $data)) { - $object->setAmount($data['amount']); - unset($data['amount']); - } - if (\array_key_exists('currency', $data)) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } - if (\array_key_exists('id', $data)) { - $object->setId($data['id']); - unset($data['id']); - } - if (\array_key_exists('paid', $data)) { - $object->setPaid($data['paid']); - unset($data['paid']); - } - if (\array_key_exists('paymentMethod', $data)) { - $object->setPaymentMethod($data['paymentMethod']); - unset($data['paymentMethod']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('amount') && null !== $data->getAmount()) { + $dataArray['amount'] = $data->getAmount(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('amount') && null !== $object->getAmount()) { - $data['amount'] = $object->getAmount(); - } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); - } - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('paid') && null !== $object->getPaid()) { - $data['paid'] = $object->getPaid(); - } - if ($object->isInitialized('paymentMethod') && null !== $object->getPaymentMethod()) { - $data['paymentMethod'] = $object->getPaymentMethod(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('currency') && null !== $data->getCurrency()) { + $dataArray['currency'] = $data->getCurrency(); + } + if ($data->isInitialized('id') && null !== $data->getId()) { + $dataArray['id'] = $data->getId(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PaymentInformation::class => false]; + if ($data->isInitialized('paid') && null !== $data->getPaid()) { + $dataArray['paid'] = $data->getPaid(); } + if ($data->isInitialized('paymentMethod') && null !== $data->getPaymentMethod()) { + $dataArray['paymentMethod'] = $data->getPaymentMethod(); + } + if ($data->isInitialized('type') && null !== $data->getType()) { + $dataArray['type'] = $data->getType(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PaymentInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PaymentInformationPayerNormalizer.php b/src/Api/Normalizer/PaymentInformationPayerNormalizer.php index 273fc475..be01c5a8 100644 --- a/src/Api/Normalizer/PaymentInformationPayerNormalizer.php +++ b/src/Api/Normalizer/PaymentInformationPayerNormalizer.php @@ -5,206 +5,102 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PaymentInformationPayerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PaymentInformationPayerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PaymentInformationPayer::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentInformationPayer::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PaymentInformationPayer(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\PayerPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\PaymentInformationPayer::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentInformationPayer::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PaymentInformationPayer(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('shipperNumber') && null !== $object->getShipperNumber()) { - $data['ShipperNumber'] = $object->getShipperNumber(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class, 'json', $context)); + unset($data['Address']); + } + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\PayerPhone::class, 'json', $context)); + unset($data['Phone']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PaymentInformationPayer::class => false]; + if (\array_key_exists('FaxNumber', $data)) { + $object->setFaxNumber($data['FaxNumber']); + unset($data['FaxNumber']); } + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PaymentInformationPayerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PaymentInformationPayer::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentInformationPayer::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PaymentInformationPayer(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FreightShipPayerAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\PayerPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Name'] = $data->getName(); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + if ($data->isInitialized('shipperNumber') && null !== $data->getShipperNumber()) { + $dataArray['ShipperNumber'] = $data->getShipperNumber(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('shipperNumber') && null !== $object->getShipperNumber()) { - $data['ShipperNumber'] = $object->getShipperNumber(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PaymentInformationPayer::class => false]; + if ($data->isInitialized('phone') && null !== $data->getPhone()) { + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); } + if ($data->isInitialized('faxNumber') && null !== $data->getFaxNumber()) { + $dataArray['FaxNumber'] = $data->getFaxNumber(); + } + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PaymentInformationPayer::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PaymentInformationShipmentBillingOptionNormalizer.php b/src/Api/Normalizer/PaymentInformationShipmentBillingOptionNormalizer.php index a2e27159..c6068ad2 100644 --- a/src/Api/Normalizer/PaymentInformationShipmentBillingOptionNormalizer.php +++ b/src/Api/Normalizer/PaymentInformationShipmentBillingOptionNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PaymentInformationShipmentBillingOptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PaymentInformationShipmentBillingOptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class; + return $type === \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PaymentInformationShipmentBillingOptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PaymentInformationShipmentBillingOption::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PaymentInformationShipmentChargeNormalizer.php b/src/Api/Normalizer/PaymentInformationShipmentChargeNormalizer.php index 8e353ced..d4d39014 100644 --- a/src/Api/Normalizer/PaymentInformationShipmentChargeNormalizer.php +++ b/src/Api/Normalizer/PaymentInformationShipmentChargeNormalizer.php @@ -5,182 +5,90 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PaymentInformationShipmentChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PaymentInformationShipmentChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class; + return $type === \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('BillShipper', $data)) { - $object->setBillShipper($this->denormalizer->denormalize($data['BillShipper'], \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class, 'json', $context)); - unset($data['BillShipper']); - } - if (\array_key_exists('BillReceiver', $data)) { - $object->setBillReceiver($this->denormalizer->denormalize($data['BillReceiver'], \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class, 'json', $context)); - unset($data['BillReceiver']); - } - if (\array_key_exists('BillThirdParty', $data)) { - $object->setBillThirdParty($this->denormalizer->denormalize($data['BillThirdParty'], \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class, 'json', $context)); - unset($data['BillThirdParty']); - } - if (\array_key_exists('ConsigneeBilledIndicator', $data)) { - $object->setConsigneeBilledIndicator($data['ConsigneeBilledIndicator']); - unset($data['ConsigneeBilledIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $object->getType(); - if ($object->isInitialized('billShipper') && null !== $object->getBillShipper()) { - $data['BillShipper'] = $this->normalizer->normalize($object->getBillShipper(), 'json', $context); - } - if ($object->isInitialized('billReceiver') && null !== $object->getBillReceiver()) { - $data['BillReceiver'] = $this->normalizer->normalize($object->getBillReceiver(), 'json', $context); - } - if ($object->isInitialized('billThirdParty') && null !== $object->getBillThirdParty()) { - $data['BillThirdParty'] = $this->normalizer->normalize($object->getBillThirdParty(), 'json', $context); - } - if ($object->isInitialized('consigneeBilledIndicator') && null !== $object->getConsigneeBilledIndicator()) { - $data['ConsigneeBilledIndicator'] = $object->getConsigneeBilledIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Type', $data)) { + $object->setType($data['Type']); + unset($data['Type']); + } + if (\array_key_exists('BillShipper', $data)) { + $object->setBillShipper($this->denormalizer->denormalize($data['BillShipper'], \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class, 'json', $context)); + unset($data['BillShipper']); + } + if (\array_key_exists('BillReceiver', $data)) { + $object->setBillReceiver($this->denormalizer->denormalize($data['BillReceiver'], \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class, 'json', $context)); + unset($data['BillReceiver']); + } + if (\array_key_exists('BillThirdParty', $data)) { + $object->setBillThirdParty($this->denormalizer->denormalize($data['BillThirdParty'], \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class, 'json', $context)); + unset($data['BillThirdParty']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class => false]; + if (\array_key_exists('ConsigneeBilledIndicator', $data)) { + $object->setConsigneeBilledIndicator($data['ConsigneeBilledIndicator']); + unset($data['ConsigneeBilledIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PaymentInformationShipmentChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class; + $dataArray = []; + $dataArray['Type'] = $data->getType(); + if ($data->isInitialized('billShipper') && null !== $data->getBillShipper()) { + $dataArray['BillShipper'] = $this->normalizer->normalize($data->getBillShipper(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class; + if ($data->isInitialized('billReceiver') && null !== $data->getBillReceiver()) { + $dataArray['BillReceiver'] = $this->normalizer->normalize($data->getBillReceiver(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('BillShipper', $data)) { - $object->setBillShipper($this->denormalizer->denormalize($data['BillShipper'], \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class, 'json', $context)); - unset($data['BillShipper']); - } - if (\array_key_exists('BillReceiver', $data)) { - $object->setBillReceiver($this->denormalizer->denormalize($data['BillReceiver'], \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class, 'json', $context)); - unset($data['BillReceiver']); - } - if (\array_key_exists('BillThirdParty', $data)) { - $object->setBillThirdParty($this->denormalizer->denormalize($data['BillThirdParty'], \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class, 'json', $context)); - unset($data['BillThirdParty']); - } - if (\array_key_exists('ConsigneeBilledIndicator', $data)) { - $object->setConsigneeBilledIndicator($data['ConsigneeBilledIndicator']); - unset($data['ConsigneeBilledIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('billThirdParty') && null !== $data->getBillThirdParty()) { + $dataArray['BillThirdParty'] = $this->normalizer->normalize($data->getBillThirdParty(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $object->getType(); - if ($object->isInitialized('billShipper') && null !== $object->getBillShipper()) { - $data['BillShipper'] = $this->normalizer->normalize($object->getBillShipper(), 'json', $context); - } - if ($object->isInitialized('billReceiver') && null !== $object->getBillReceiver()) { - $data['BillReceiver'] = $this->normalizer->normalize($object->getBillReceiver(), 'json', $context); - } - if ($object->isInitialized('billThirdParty') && null !== $object->getBillThirdParty()) { - $data['BillThirdParty'] = $this->normalizer->normalize($object->getBillThirdParty(), 'json', $context); - } - if ($object->isInitialized('consigneeBilledIndicator') && null !== $object->getConsigneeBilledIndicator()) { - $data['ConsigneeBilledIndicator'] = $object->getConsigneeBilledIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('consigneeBilledIndicator') && null !== $data->getConsigneeBilledIndicator()) { + $dataArray['ConsigneeBilledIndicator'] = $data->getConsigneeBilledIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickUpPickUpDetailsNormalizer.php b/src/Api/Normalizer/PickUpPickUpDetailsNormalizer.php index 8a18fc1e..40b3f6a5 100644 --- a/src/Api/Normalizer/PickUpPickUpDetailsNormalizer.php +++ b/src/Api/Normalizer/PickUpPickUpDetailsNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickUpPickUpDetailsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickUpPickUpDetailsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class; + return $type === \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickUpPickUpDetails(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickUpTime', $data)) { - $object->setPickUpTime($data['PickUpTime']); - unset($data['PickUpTime']); - } - if (\array_key_exists('NoPickUpIndicator', $data)) { - $object->setNoPickUpIndicator($data['NoPickUpIndicator']); - unset($data['NoPickUpIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickUpPickUpDetails(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('pickUpTime') && null !== $object->getPickUpTime()) { - $data['PickUpTime'] = $object->getPickUpTime(); - } - $data['NoPickUpIndicator'] = $object->getNoPickUpIndicator(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickUpTime', $data)) { + $object->setPickUpTime($data['PickUpTime']); + unset($data['PickUpTime']); + } + if (\array_key_exists('NoPickUpIndicator', $data)) { + $object->setNoPickUpIndicator($data['NoPickUpIndicator']); + unset($data['NoPickUpIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickUpPickUpDetails::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PickUpPickUpDetailsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class; + $dataArray = []; + if ($data->isInitialized('pickUpTime') && null !== $data->getPickUpTime()) { + $dataArray['PickUpTime'] = $data->getPickUpTime(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickUpPickUpDetails(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickUpTime', $data)) { - $object->setPickUpTime($data['PickUpTime']); - unset($data['PickUpTime']); + $dataArray['NoPickUpIndicator'] = $data->getNoPickUpIndicator(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('NoPickUpIndicator', $data)) { - $object->setNoPickUpIndicator($data['NoPickUpIndicator']); - unset($data['NoPickUpIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('pickUpTime') && null !== $object->getPickUpTime()) { - $data['PickUpTime'] = $object->getPickUpTime(); - } - $data['NoPickUpIndicator'] = $object->getNoPickUpIndicator(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickUpPickUpDetails::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickUpPickUpDetails::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupAddressPhoneNormalizer.php b/src/Api/Normalizer/PickupAddressPhoneNormalizer.php index f4b23c34..01c4922a 100644 --- a/src/Api/Normalizer/PickupAddressPhoneNormalizer.php +++ b/src/Api/Normalizer/PickupAddressPhoneNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupAddressPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupAddressPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupAddressPhone::class; + return $type === \ShipStream\Ups\Api\Model\PickupAddressPhone::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupAddressPhone::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupAddressPhone::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupAddressPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupAddressPhone(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Extension', $data)) { + $object->setExtension($data['Extension']); + unset($data['Extension']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupAddressPhone::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PickupAddressPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupAddressPhone::class; + $dataArray = []; + $dataArray['Number'] = $data->getNumber(); + if ($data->isInitialized('extension') && null !== $data->getExtension()) { + $dataArray['Extension'] = $data->getExtension(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupAddressPhone::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupAddressPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupAddressPhone::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupAddressPhone::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCancelRequestNormalizer.php b/src/Api/Normalizer/PickupCancelRequestNormalizer.php index aada312d..dbcb85f1 100644 --- a/src/Api/Normalizer/PickupCancelRequestNormalizer.php +++ b/src/Api/Normalizer/PickupCancelRequestNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCancelRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCancelRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCancelRequest::class; + return $type === \ShipStream\Ups\Api\Model\PickupCancelRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCancelRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('CancelBy', $data)) { - $object->setCancelBy($data['CancelBy']); - unset($data['CancelBy']); - } - if (\array_key_exists('PRN', $data)) { - $object->setPRN($data['PRN']); - unset($data['PRN']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCancelRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['CancelBy'] = $object->getCancelBy(); - if ($object->isInitialized('pRN') && null !== $object->getPRN()) { - $data['PRN'] = $object->getPRN(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCancelRequest::class => false]; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class, 'json', $context)); + unset($data['Request']); } - } -} else { - class PickupCancelRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCancelRequest::class; + if (\array_key_exists('CancelBy', $data)) { + $object->setCancelBy($data['CancelBy']); + unset($data['CancelBy']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelRequest::class; + if (\array_key_exists('PRN', $data)) { + $object->setPRN($data['PRN']); + unset($data['PRN']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCancelRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class, 'json', $context)); - unset($data['Request']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('CancelBy', $data)) { - $object->setCancelBy($data['CancelBy']); - unset($data['CancelBy']); - } - if (\array_key_exists('PRN', $data)) { - $object->setPRN($data['PRN']); - unset($data['PRN']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['CancelBy'] = $object->getCancelBy(); - if ($object->isInitialized('pRN') && null !== $object->getPRN()) { - $data['PRN'] = $object->getPRN(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['CancelBy'] = $data->getCancelBy(); + if ($data->isInitialized('pRN') && null !== $data->getPRN()) { + $dataArray['PRN'] = $data->getPRN(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCancelRequest::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCancelRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCancelRequestRequestNormalizer.php b/src/Api/Normalizer/PickupCancelRequestRequestNormalizer.php index 582a0d6d..cf459901 100644 --- a/src/Api/Normalizer/PickupCancelRequestRequestNormalizer.php +++ b/src/Api/Normalizer/PickupCancelRequestRequestNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCancelRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCancelRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCancelRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCancelRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PickupCancelRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCancelRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCancelRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCancelResponseGWNStatusNormalizer.php b/src/Api/Normalizer/PickupCancelResponseGWNStatusNormalizer.php index 1c2da40b..301d8cfb 100644 --- a/src/Api/Normalizer/PickupCancelResponseGWNStatusNormalizer.php +++ b/src/Api/Normalizer/PickupCancelResponseGWNStatusNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCancelResponseGWNStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCancelResponseGWNStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class; + return $type === \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PickupCancelResponseGWNStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCancelResponseNormalizer.php b/src/Api/Normalizer/PickupCancelResponseNormalizer.php index 649faa5d..812842a0 100644 --- a/src/Api/Normalizer/PickupCancelResponseNormalizer.php +++ b/src/Api/Normalizer/PickupCancelResponseNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCancelResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCancelResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCancelResponse::class; + return $type === \ShipStream\Ups\Api\Model\PickupCancelResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCancelResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('PickupType', $data)) { - $object->setPickupType($data['PickupType']); - unset($data['PickupType']); - } - if (\array_key_exists('GWNStatus', $data)) { - $object->setGWNStatus($this->denormalizer->denormalize($data['GWNStatus'], \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class, 'json', $context)); - unset($data['GWNStatus']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCancelResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['PickupType'] = $object->getPickupType(); - if ($object->isInitialized('gWNStatus') && null !== $object->getGWNStatus()) { - $data['GWNStatus'] = $this->normalizer->normalize($object->getGWNStatus(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCancelResponse::class => false]; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class, 'json', $context)); + unset($data['Response']); } - } -} else { - class PickupCancelResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCancelResponse::class; + if (\array_key_exists('PickupType', $data)) { + $object->setPickupType($data['PickupType']); + unset($data['PickupType']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelResponse::class; + if (\array_key_exists('GWNStatus', $data)) { + $object->setGWNStatus($this->denormalizer->denormalize($data['GWNStatus'], \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class, 'json', $context)); + unset($data['GWNStatus']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCancelResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class, 'json', $context)); - unset($data['Response']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('PickupType', $data)) { - $object->setPickupType($data['PickupType']); - unset($data['PickupType']); - } - if (\array_key_exists('GWNStatus', $data)) { - $object->setGWNStatus($this->denormalizer->denormalize($data['GWNStatus'], \ShipStream\Ups\Api\Model\PickupCancelResponseGWNStatus::class, 'json', $context)); - unset($data['GWNStatus']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['PickupType'] = $object->getPickupType(); - if ($object->isInitialized('gWNStatus') && null !== $object->getGWNStatus()) { - $data['GWNStatus'] = $this->normalizer->normalize($object->getGWNStatus(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + $dataArray['PickupType'] = $data->getPickupType(); + if ($data->isInitialized('gWNStatus') && null !== $data->getGWNStatus()) { + $dataArray['GWNStatus'] = $this->normalizer->normalize($data->getGWNStatus(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCancelResponse::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCancelResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCancelResponseResponseNormalizer.php b/src/Api/Normalizer/PickupCancelResponseResponseNormalizer.php index a97d9d2e..97b43e16 100644 --- a/src/Api/Normalizer/PickupCancelResponseResponseNormalizer.php +++ b/src/Api/Normalizer/PickupCancelResponseResponseNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCancelResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCancelResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCancelResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCancelResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class => false]; + if (\array_key_exists('Alert', $data)) { + $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); + unset($data['Alert']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupCancelResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $dataArray['Alert'] = $this->normalizer->normalize($data->getAlert(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCancelResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCancelResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationRequestFreightOptionsNormalizer.php b/src/Api/Normalizer/PickupCreationRequestFreightOptionsNormalizer.php index e8192080..3bcc7cd1 100644 --- a/src/Api/Normalizer/PickupCreationRequestFreightOptionsNormalizer.php +++ b/src/Api/Normalizer/PickupCreationRequestFreightOptionsNormalizer.php @@ -5,182 +5,90 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationRequestFreightOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationRequestFreightOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('OriginServiceCenterCode', $data)) { - $object->setOriginServiceCenterCode($data['OriginServiceCenterCode']); - unset($data['OriginServiceCenterCode']); - } - if (\array_key_exists('OriginServiceCountryCode', $data)) { - $object->setOriginServiceCountryCode($data['OriginServiceCountryCode']); - unset($data['OriginServiceCountryCode']); - } - if (\array_key_exists('DestinationAddress', $data)) { - $object->setDestinationAddress($this->denormalizer->denormalize($data['DestinationAddress'], \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class, 'json', $context)); - unset($data['DestinationAddress']); - } - if (\array_key_exists('ShipmentDetail', $data)) { - $object->setShipmentDetail($this->denormalizer->denormalize($data['ShipmentDetail'], \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class, 'json', $context)); - unset($data['ShipmentDetail']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('originServiceCenterCode') && null !== $object->getOriginServiceCenterCode()) { - $data['OriginServiceCenterCode'] = $object->getOriginServiceCenterCode(); - } - if ($object->isInitialized('originServiceCountryCode') && null !== $object->getOriginServiceCountryCode()) { - $data['OriginServiceCountryCode'] = $object->getOriginServiceCountryCode(); - } - if ($object->isInitialized('destinationAddress') && null !== $object->getDestinationAddress()) { - $data['DestinationAddress'] = $this->normalizer->normalize($object->getDestinationAddress(), 'json', $context); - } - $data['ShipmentDetail'] = $this->normalizer->normalize($object->getShipmentDetail(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ShipmentServiceOptions', $data)) { + $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class, 'json', $context)); + unset($data['ShipmentServiceOptions']); + } + if (\array_key_exists('OriginServiceCenterCode', $data)) { + $object->setOriginServiceCenterCode($data['OriginServiceCenterCode']); + unset($data['OriginServiceCenterCode']); + } + if (\array_key_exists('OriginServiceCountryCode', $data)) { + $object->setOriginServiceCountryCode($data['OriginServiceCountryCode']); + unset($data['OriginServiceCountryCode']); + } + if (\array_key_exists('DestinationAddress', $data)) { + $object->setDestinationAddress($this->denormalizer->denormalize($data['DestinationAddress'], \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class, 'json', $context)); + unset($data['DestinationAddress']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class => false]; + if (\array_key_exists('ShipmentDetail', $data)) { + $object->setShipmentDetail($this->denormalizer->denormalize($data['ShipmentDetail'], \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class, 'json', $context)); + unset($data['ShipmentDetail']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupCreationRequestFreightOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class; + $dataArray = []; + if ($data->isInitialized('shipmentServiceOptions') && null !== $data->getShipmentServiceOptions()) { + $dataArray['ShipmentServiceOptions'] = $this->normalizer->normalize($data->getShipmentServiceOptions(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class; + if ($data->isInitialized('originServiceCenterCode') && null !== $data->getOriginServiceCenterCode()) { + $dataArray['OriginServiceCenterCode'] = $data->getOriginServiceCenterCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\FreightOptionsShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('OriginServiceCenterCode', $data)) { - $object->setOriginServiceCenterCode($data['OriginServiceCenterCode']); - unset($data['OriginServiceCenterCode']); - } - if (\array_key_exists('OriginServiceCountryCode', $data)) { - $object->setOriginServiceCountryCode($data['OriginServiceCountryCode']); - unset($data['OriginServiceCountryCode']); - } - if (\array_key_exists('DestinationAddress', $data)) { - $object->setDestinationAddress($this->denormalizer->denormalize($data['DestinationAddress'], \ShipStream\Ups\Api\Model\FreightOptionsDestinationAddress::class, 'json', $context)); - unset($data['DestinationAddress']); - } - if (\array_key_exists('ShipmentDetail', $data)) { - $object->setShipmentDetail($this->denormalizer->denormalize($data['ShipmentDetail'], \ShipStream\Ups\Api\Model\FreightOptionsShipmentDetail::class, 'json', $context)); - unset($data['ShipmentDetail']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('originServiceCountryCode') && null !== $data->getOriginServiceCountryCode()) { + $dataArray['OriginServiceCountryCode'] = $data->getOriginServiceCountryCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('originServiceCenterCode') && null !== $object->getOriginServiceCenterCode()) { - $data['OriginServiceCenterCode'] = $object->getOriginServiceCenterCode(); - } - if ($object->isInitialized('originServiceCountryCode') && null !== $object->getOriginServiceCountryCode()) { - $data['OriginServiceCountryCode'] = $object->getOriginServiceCountryCode(); - } - if ($object->isInitialized('destinationAddress') && null !== $object->getDestinationAddress()) { - $data['DestinationAddress'] = $this->normalizer->normalize($object->getDestinationAddress(), 'json', $context); - } - $data['ShipmentDetail'] = $this->normalizer->normalize($object->getShipmentDetail(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('destinationAddress') && null !== $data->getDestinationAddress()) { + $dataArray['DestinationAddress'] = $this->normalizer->normalize($data->getDestinationAddress(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class => false]; + $dataArray['ShipmentDetail'] = $this->normalizer->normalize($data->getShipmentDetail(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationRequestNormalizer.php b/src/Api/Normalizer/PickupCreationRequestNormalizer.php index 61d1a35c..eadeca2b 100644 --- a/src/Api/Normalizer/PickupCreationRequestNormalizer.php +++ b/src/Api/Normalizer/PickupCreationRequestNormalizer.php @@ -5,414 +5,206 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequest::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('RatePickupIndicator', $data)) { - $object->setRatePickupIndicator($data['RatePickupIndicator']); - unset($data['RatePickupIndicator']); - } - if (\array_key_exists('RateChartType', $data)) { - $object->setRateChartType($data['RateChartType']); - unset($data['RateChartType']); - } - if (\array_key_exists('TaxInformationIndicator', $data)) { - $object->setTaxInformationIndicator($data['TaxInformationIndicator']); - unset($data['TaxInformationIndicator']); - } - if (\array_key_exists('UserLevelDiscountIndicator', $data)) { - $object->setUserLevelDiscountIndicator($data['UserLevelDiscountIndicator']); - unset($data['UserLevelDiscountIndicator']); - } - if (\array_key_exists('Shipper', $data)) { - $object->setShipper($this->denormalizer->denormalize($data['Shipper'], \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class, 'json', $context)); - unset($data['Shipper']); - } - if (\array_key_exists('PickupDateInfo', $data)) { - $object->setPickupDateInfo($this->denormalizer->denormalize($data['PickupDateInfo'], \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class, 'json', $context)); - unset($data['PickupDateInfo']); - } - if (\array_key_exists('PickupAddress', $data)) { - $object->setPickupAddress($this->denormalizer->denormalize($data['PickupAddress'], \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class, 'json', $context)); - unset($data['PickupAddress']); - } - if (\array_key_exists('AlternateAddressIndicator', $data)) { - $object->setAlternateAddressIndicator($data['AlternateAddressIndicator']); - unset($data['AlternateAddressIndicator']); - } - if (\array_key_exists('PickupPiece', $data)) { - $values = []; - foreach ($data['PickupPiece'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class, 'json', $context); - } - $object->setPickupPiece($values); - unset($data['PickupPiece']); - } - if (\array_key_exists('TotalWeight', $data)) { - $object->setTotalWeight($this->denormalizer->denormalize($data['TotalWeight'], \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class, 'json', $context)); - unset($data['TotalWeight']); - } - if (\array_key_exists('OverweightIndicator', $data)) { - $object->setOverweightIndicator($data['OverweightIndicator']); - unset($data['OverweightIndicator']); - } - if (\array_key_exists('TrackingData', $data)) { - $values_1 = []; - foreach ($data['TrackingData'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class, 'json', $context); - } - $object->setTrackingData($values_1); - unset($data['TrackingData']); - } - if (\array_key_exists('TrackingDataWithReferenceNumber', $data)) { - $object->setTrackingDataWithReferenceNumber($this->denormalizer->denormalize($data['TrackingDataWithReferenceNumber'], \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class, 'json', $context)); - unset($data['TrackingDataWithReferenceNumber']); - } - if (\array_key_exists('PaymentMethod', $data)) { - $object->setPaymentMethod($data['PaymentMethod']); - unset($data['PaymentMethod']); - } - if (\array_key_exists('SpecialInstruction', $data)) { - $object->setSpecialInstruction($data['SpecialInstruction']); - unset($data['SpecialInstruction']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $object->setReferenceNumber($data['ReferenceNumber']); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('FreightOptions', $data)) { - $object->setFreightOptions($this->denormalizer->denormalize($data['FreightOptions'], \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class, 'json', $context)); - unset($data['FreightOptions']); - } - if (\array_key_exists('ServiceCategory', $data)) { - $object->setServiceCategory($data['ServiceCategory']); - unset($data['ServiceCategory']); - } - if (\array_key_exists('CashType', $data)) { - $object->setCashType($data['CashType']); - unset($data['CashType']); - } - if (\array_key_exists('ShippingLabelsAvailable', $data)) { - $object->setShippingLabelsAvailable($data['ShippingLabelsAvailable']); - unset($data['ShippingLabelsAvailable']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + return $type === \ShipStream\Ups\Api\Model\PickupCreationRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PickupCreationRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['RatePickupIndicator'] = $object->getRatePickupIndicator(); - if ($object->isInitialized('rateChartType') && null !== $object->getRateChartType()) { - $data['RateChartType'] = $object->getRateChartType(); - } - if ($object->isInitialized('taxInformationIndicator') && null !== $object->getTaxInformationIndicator()) { - $data['TaxInformationIndicator'] = $object->getTaxInformationIndicator(); - } - if ($object->isInitialized('userLevelDiscountIndicator') && null !== $object->getUserLevelDiscountIndicator()) { - $data['UserLevelDiscountIndicator'] = $object->getUserLevelDiscountIndicator(); - } - if ($object->isInitialized('shipper') && null !== $object->getShipper()) { - $data['Shipper'] = $this->normalizer->normalize($object->getShipper(), 'json', $context); - } - $data['PickupDateInfo'] = $this->normalizer->normalize($object->getPickupDateInfo(), 'json', $context); - $data['PickupAddress'] = $this->normalizer->normalize($object->getPickupAddress(), 'json', $context); - $data['AlternateAddressIndicator'] = $object->getAlternateAddressIndicator(); + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class, 'json', $context)); + unset($data['Request']); + } + if (\array_key_exists('RatePickupIndicator', $data)) { + $object->setRatePickupIndicator($data['RatePickupIndicator']); + unset($data['RatePickupIndicator']); + } + if (\array_key_exists('RateChartType', $data)) { + $object->setRateChartType($data['RateChartType']); + unset($data['RateChartType']); + } + if (\array_key_exists('TaxInformationIndicator', $data)) { + $object->setTaxInformationIndicator($data['TaxInformationIndicator']); + unset($data['TaxInformationIndicator']); + } + if (\array_key_exists('UserLevelDiscountIndicator', $data)) { + $object->setUserLevelDiscountIndicator($data['UserLevelDiscountIndicator']); + unset($data['UserLevelDiscountIndicator']); + } + if (\array_key_exists('Shipper', $data)) { + $object->setShipper($this->denormalizer->denormalize($data['Shipper'], \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class, 'json', $context)); + unset($data['Shipper']); + } + if (\array_key_exists('PickupDateInfo', $data)) { + $object->setPickupDateInfo($this->denormalizer->denormalize($data['PickupDateInfo'], \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class, 'json', $context)); + unset($data['PickupDateInfo']); + } + if (\array_key_exists('PickupAddress', $data)) { + $object->setPickupAddress($this->denormalizer->denormalize($data['PickupAddress'], \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class, 'json', $context)); + unset($data['PickupAddress']); + } + if (\array_key_exists('AlternateAddressIndicator', $data)) { + $object->setAlternateAddressIndicator($data['AlternateAddressIndicator']); + unset($data['AlternateAddressIndicator']); + } + if (\array_key_exists('PickupPiece', $data)) { $values = []; - foreach ($object->getPickupPiece() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PickupPiece'] = $values; - if ($object->isInitialized('totalWeight') && null !== $object->getTotalWeight()) { - $data['TotalWeight'] = $this->normalizer->normalize($object->getTotalWeight(), 'json', $context); - } - if ($object->isInitialized('overweightIndicator') && null !== $object->getOverweightIndicator()) { - $data['OverweightIndicator'] = $object->getOverweightIndicator(); - } - if ($object->isInitialized('trackingData') && null !== $object->getTrackingData()) { - $values_1 = []; - foreach ($object->getTrackingData() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['TrackingData'] = $values_1; + foreach ($data['PickupPiece'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class, 'json', $context); } - if ($object->isInitialized('trackingDataWithReferenceNumber') && null !== $object->getTrackingDataWithReferenceNumber()) { - $data['TrackingDataWithReferenceNumber'] = $this->normalizer->normalize($object->getTrackingDataWithReferenceNumber(), 'json', $context); - } - $data['PaymentMethod'] = $object->getPaymentMethod(); - if ($object->isInitialized('specialInstruction') && null !== $object->getSpecialInstruction()) { - $data['SpecialInstruction'] = $object->getSpecialInstruction(); - } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $data['ReferenceNumber'] = $object->getReferenceNumber(); - } - if ($object->isInitialized('freightOptions') && null !== $object->getFreightOptions()) { - $data['FreightOptions'] = $this->normalizer->normalize($object->getFreightOptions(), 'json', $context); - } - if ($object->isInitialized('serviceCategory') && null !== $object->getServiceCategory()) { - $data['ServiceCategory'] = $object->getServiceCategory(); - } - if ($object->isInitialized('cashType') && null !== $object->getCashType()) { - $data['CashType'] = $object->getCashType(); - } - if ($object->isInitialized('shippingLabelsAvailable') && null !== $object->getShippingLabelsAvailable()) { - $data['ShippingLabelsAvailable'] = $object->getShippingLabelsAvailable(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setPickupPiece($values); + unset($data['PickupPiece']); + } + if (\array_key_exists('TotalWeight', $data)) { + $object->setTotalWeight($this->denormalizer->denormalize($data['TotalWeight'], \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class, 'json', $context)); + unset($data['TotalWeight']); + } + if (\array_key_exists('OverweightIndicator', $data)) { + $object->setOverweightIndicator($data['OverweightIndicator']); + unset($data['OverweightIndicator']); + } + if (\array_key_exists('TrackingData', $data)) { + $values_1 = []; + foreach ($data['TrackingData'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class, 'json', $context); } - return $data; + $object->setTrackingData($values_1); + unset($data['TrackingData']); + } + if (\array_key_exists('TrackingDataWithReferenceNumber', $data)) { + $object->setTrackingDataWithReferenceNumber($this->denormalizer->denormalize($data['TrackingDataWithReferenceNumber'], \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class, 'json', $context)); + unset($data['TrackingDataWithReferenceNumber']); + } + if (\array_key_exists('PaymentMethod', $data)) { + $object->setPaymentMethod($data['PaymentMethod']); + unset($data['PaymentMethod']); + } + if (\array_key_exists('SpecialInstruction', $data)) { + $object->setSpecialInstruction($data['SpecialInstruction']); + unset($data['SpecialInstruction']); + } + if (\array_key_exists('ReferenceNumber', $data)) { + $object->setReferenceNumber($data['ReferenceNumber']); + unset($data['ReferenceNumber']); + } + if (\array_key_exists('FreightOptions', $data)) { + $object->setFreightOptions($this->denormalizer->denormalize($data['FreightOptions'], \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class, 'json', $context)); + unset($data['FreightOptions']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequest::class => false]; + if (\array_key_exists('ServiceCategory', $data)) { + $object->setServiceCategory($data['ServiceCategory']); + unset($data['ServiceCategory']); } + if (\array_key_exists('CashType', $data)) { + $object->setCashType($data['CashType']); + unset($data['CashType']); + } + if (\array_key_exists('ShippingLabelsAvailable', $data)) { + $object->setShippingLabelsAvailable($data['ShippingLabelsAvailable']); + unset($data['ShippingLabelsAvailable']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } -} else { - class PickupCreationRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('RatePickupIndicator', $data)) { - $object->setRatePickupIndicator($data['RatePickupIndicator']); - unset($data['RatePickupIndicator']); - } - if (\array_key_exists('RateChartType', $data)) { - $object->setRateChartType($data['RateChartType']); - unset($data['RateChartType']); - } - if (\array_key_exists('TaxInformationIndicator', $data)) { - $object->setTaxInformationIndicator($data['TaxInformationIndicator']); - unset($data['TaxInformationIndicator']); - } - if (\array_key_exists('UserLevelDiscountIndicator', $data)) { - $object->setUserLevelDiscountIndicator($data['UserLevelDiscountIndicator']); - unset($data['UserLevelDiscountIndicator']); - } - if (\array_key_exists('Shipper', $data)) { - $object->setShipper($this->denormalizer->denormalize($data['Shipper'], \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class, 'json', $context)); - unset($data['Shipper']); - } - if (\array_key_exists('PickupDateInfo', $data)) { - $object->setPickupDateInfo($this->denormalizer->denormalize($data['PickupDateInfo'], \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class, 'json', $context)); - unset($data['PickupDateInfo']); - } - if (\array_key_exists('PickupAddress', $data)) { - $object->setPickupAddress($this->denormalizer->denormalize($data['PickupAddress'], \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class, 'json', $context)); - unset($data['PickupAddress']); - } - if (\array_key_exists('AlternateAddressIndicator', $data)) { - $object->setAlternateAddressIndicator($data['AlternateAddressIndicator']); - unset($data['AlternateAddressIndicator']); - } - if (\array_key_exists('PickupPiece', $data)) { - $values = []; - foreach ($data['PickupPiece'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class, 'json', $context); - } - $object->setPickupPiece($values); - unset($data['PickupPiece']); - } - if (\array_key_exists('TotalWeight', $data)) { - $object->setTotalWeight($this->denormalizer->denormalize($data['TotalWeight'], \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class, 'json', $context)); - unset($data['TotalWeight']); - } - if (\array_key_exists('OverweightIndicator', $data)) { - $object->setOverweightIndicator($data['OverweightIndicator']); - unset($data['OverweightIndicator']); - } - if (\array_key_exists('TrackingData', $data)) { - $values_1 = []; - foreach ($data['TrackingData'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class, 'json', $context); - } - $object->setTrackingData($values_1); - unset($data['TrackingData']); - } - if (\array_key_exists('TrackingDataWithReferenceNumber', $data)) { - $object->setTrackingDataWithReferenceNumber($this->denormalizer->denormalize($data['TrackingDataWithReferenceNumber'], \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class, 'json', $context)); - unset($data['TrackingDataWithReferenceNumber']); - } - if (\array_key_exists('PaymentMethod', $data)) { - $object->setPaymentMethod($data['PaymentMethod']); - unset($data['PaymentMethod']); - } - if (\array_key_exists('SpecialInstruction', $data)) { - $object->setSpecialInstruction($data['SpecialInstruction']); - unset($data['SpecialInstruction']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $object->setReferenceNumber($data['ReferenceNumber']); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('FreightOptions', $data)) { - $object->setFreightOptions($this->denormalizer->denormalize($data['FreightOptions'], \ShipStream\Ups\Api\Model\PickupCreationRequestFreightOptions::class, 'json', $context)); - unset($data['FreightOptions']); - } - if (\array_key_exists('ServiceCategory', $data)) { - $object->setServiceCategory($data['ServiceCategory']); - unset($data['ServiceCategory']); - } - if (\array_key_exists('CashType', $data)) { - $object->setCashType($data['CashType']); - unset($data['CashType']); - } - if (\array_key_exists('ShippingLabelsAvailable', $data)) { - $object->setShippingLabelsAvailable($data['ShippingLabelsAvailable']); - unset($data['ShippingLabelsAvailable']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['RatePickupIndicator'] = $data->getRatePickupIndicator(); + if ($data->isInitialized('rateChartType') && null !== $data->getRateChartType()) { + $dataArray['RateChartType'] = $data->getRateChartType(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['RatePickupIndicator'] = $object->getRatePickupIndicator(); - if ($object->isInitialized('rateChartType') && null !== $object->getRateChartType()) { - $data['RateChartType'] = $object->getRateChartType(); - } - if ($object->isInitialized('taxInformationIndicator') && null !== $object->getTaxInformationIndicator()) { - $data['TaxInformationIndicator'] = $object->getTaxInformationIndicator(); - } - if ($object->isInitialized('userLevelDiscountIndicator') && null !== $object->getUserLevelDiscountIndicator()) { - $data['UserLevelDiscountIndicator'] = $object->getUserLevelDiscountIndicator(); - } - if ($object->isInitialized('shipper') && null !== $object->getShipper()) { - $data['Shipper'] = $this->normalizer->normalize($object->getShipper(), 'json', $context); - } - $data['PickupDateInfo'] = $this->normalizer->normalize($object->getPickupDateInfo(), 'json', $context); - $data['PickupAddress'] = $this->normalizer->normalize($object->getPickupAddress(), 'json', $context); - $data['AlternateAddressIndicator'] = $object->getAlternateAddressIndicator(); - $values = []; - foreach ($object->getPickupPiece() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PickupPiece'] = $values; - if ($object->isInitialized('totalWeight') && null !== $object->getTotalWeight()) { - $data['TotalWeight'] = $this->normalizer->normalize($object->getTotalWeight(), 'json', $context); - } - if ($object->isInitialized('overweightIndicator') && null !== $object->getOverweightIndicator()) { - $data['OverweightIndicator'] = $object->getOverweightIndicator(); - } - if ($object->isInitialized('trackingData') && null !== $object->getTrackingData()) { - $values_1 = []; - foreach ($object->getTrackingData() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['TrackingData'] = $values_1; - } - if ($object->isInitialized('trackingDataWithReferenceNumber') && null !== $object->getTrackingDataWithReferenceNumber()) { - $data['TrackingDataWithReferenceNumber'] = $this->normalizer->normalize($object->getTrackingDataWithReferenceNumber(), 'json', $context); - } - $data['PaymentMethod'] = $object->getPaymentMethod(); - if ($object->isInitialized('specialInstruction') && null !== $object->getSpecialInstruction()) { - $data['SpecialInstruction'] = $object->getSpecialInstruction(); - } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $data['ReferenceNumber'] = $object->getReferenceNumber(); - } - if ($object->isInitialized('freightOptions') && null !== $object->getFreightOptions()) { - $data['FreightOptions'] = $this->normalizer->normalize($object->getFreightOptions(), 'json', $context); - } - if ($object->isInitialized('serviceCategory') && null !== $object->getServiceCategory()) { - $data['ServiceCategory'] = $object->getServiceCategory(); - } - if ($object->isInitialized('cashType') && null !== $object->getCashType()) { - $data['CashType'] = $object->getCashType(); - } - if ($object->isInitialized('shippingLabelsAvailable') && null !== $object->getShippingLabelsAvailable()) { - $data['ShippingLabelsAvailable'] = $object->getShippingLabelsAvailable(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + if ($data->isInitialized('taxInformationIndicator') && null !== $data->getTaxInformationIndicator()) { + $dataArray['TaxInformationIndicator'] = $data->getTaxInformationIndicator(); + } + if ($data->isInitialized('userLevelDiscountIndicator') && null !== $data->getUserLevelDiscountIndicator()) { + $dataArray['UserLevelDiscountIndicator'] = $data->getUserLevelDiscountIndicator(); + } + if ($data->isInitialized('shipper') && null !== $data->getShipper()) { + $dataArray['Shipper'] = $this->normalizer->normalize($data->getShipper(), 'json', $context); + } + $dataArray['PickupDateInfo'] = $this->normalizer->normalize($data->getPickupDateInfo(), 'json', $context); + $dataArray['PickupAddress'] = $this->normalizer->normalize($data->getPickupAddress(), 'json', $context); + $dataArray['AlternateAddressIndicator'] = $data->getAlternateAddressIndicator(); + $values = []; + foreach ($data->getPickupPiece() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['PickupPiece'] = $values; + if ($data->isInitialized('totalWeight') && null !== $data->getTotalWeight()) { + $dataArray['TotalWeight'] = $this->normalizer->normalize($data->getTotalWeight(), 'json', $context); + } + if ($data->isInitialized('overweightIndicator') && null !== $data->getOverweightIndicator()) { + $dataArray['OverweightIndicator'] = $data->getOverweightIndicator(); + } + if ($data->isInitialized('trackingData') && null !== $data->getTrackingData()) { + $values_1 = []; + foreach ($data->getTrackingData() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['TrackingData'] = $values_1; + } + if ($data->isInitialized('trackingDataWithReferenceNumber') && null !== $data->getTrackingDataWithReferenceNumber()) { + $dataArray['TrackingDataWithReferenceNumber'] = $this->normalizer->normalize($data->getTrackingDataWithReferenceNumber(), 'json', $context); + } + $dataArray['PaymentMethod'] = $data->getPaymentMethod(); + if ($data->isInitialized('specialInstruction') && null !== $data->getSpecialInstruction()) { + $dataArray['SpecialInstruction'] = $data->getSpecialInstruction(); + } + if ($data->isInitialized('referenceNumber') && null !== $data->getReferenceNumber()) { + $dataArray['ReferenceNumber'] = $data->getReferenceNumber(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequest::class => false]; + if ($data->isInitialized('freightOptions') && null !== $data->getFreightOptions()) { + $dataArray['FreightOptions'] = $this->normalizer->normalize($data->getFreightOptions(), 'json', $context); } + if ($data->isInitialized('serviceCategory') && null !== $data->getServiceCategory()) { + $dataArray['ServiceCategory'] = $data->getServiceCategory(); + } + if ($data->isInitialized('cashType') && null !== $data->getCashType()) { + $dataArray['CashType'] = $data->getCashType(); + } + if ($data->isInitialized('shippingLabelsAvailable') && null !== $data->getShippingLabelsAvailable()) { + $dataArray['ShippingLabelsAvailable'] = $data->getShippingLabelsAvailable(); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationRequestPickupAddressNormalizer.php b/src/Api/Normalizer/PickupCreationRequestPickupAddressNormalizer.php index 8b5226e4..92fb8d45 100644 --- a/src/Api/Normalizer/PickupCreationRequestPickupAddressNormalizer.php +++ b/src/Api/Normalizer/PickupCreationRequestPickupAddressNormalizer.php @@ -5,286 +5,142 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationRequestPickupAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationRequestPickupAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('ContactName', $data)) { - $object->setContactName($data['ContactName']); - unset($data['ContactName']); - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('Room', $data)) { - $object->setRoom($data['Room']); - unset($data['Room']); - } - if (\array_key_exists('Floor', $data)) { - $object->setFloor($data['Floor']); - unset($data['Floor']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('Urbanization', $data)) { - $object->setUrbanization($data['Urbanization']); - unset($data['Urbanization']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialIndicator', $data)) { - $object->setResidentialIndicator($data['ResidentialIndicator']); - unset($data['ResidentialIndicator']); - } - if (\array_key_exists('PickupPoint', $data)) { - $object->setPickupPoint($data['PickupPoint']); - unset($data['PickupPoint']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\PickupAddressPhone::class, 'json', $context)); - unset($data['Phone']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CompanyName'] = $object->getCompanyName(); - $data['ContactName'] = $object->getContactName(); + if (\array_key_exists('CompanyName', $data)) { + $object->setCompanyName($data['CompanyName']); + unset($data['CompanyName']); + } + if (\array_key_exists('ContactName', $data)) { + $object->setContactName($data['ContactName']); + unset($data['ContactName']); + } + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - if ($object->isInitialized('room') && null !== $object->getRoom()) { - $data['Room'] = $object->getRoom(); - } - if ($object->isInitialized('floor') && null !== $object->getFloor()) { - $data['Floor'] = $object->getFloor(); - } - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['StateProvince'] = $object->getStateProvince(); - } - if ($object->isInitialized('urbanization') && null !== $object->getUrbanization()) { - $data['Urbanization'] = $object->getUrbanization(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - $data['ResidentialIndicator'] = $object->getResidentialIndicator(); - if ($object->isInitialized('pickupPoint') && null !== $object->getPickupPoint()) { - $data['PickupPoint'] = $object->getPickupPoint(); - } - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); + } + if (\array_key_exists('Room', $data)) { + $object->setRoom($data['Room']); + unset($data['Room']); + } + if (\array_key_exists('Floor', $data)) { + $object->setFloor($data['Floor']); + unset($data['Floor']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvince', $data)) { + $object->setStateProvince($data['StateProvince']); + unset($data['StateProvince']); + } + if (\array_key_exists('Urbanization', $data)) { + $object->setUrbanization($data['Urbanization']); + unset($data['Urbanization']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + if (\array_key_exists('ResidentialIndicator', $data)) { + $object->setResidentialIndicator($data['ResidentialIndicator']); + unset($data['ResidentialIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class => false]; + if (\array_key_exists('PickupPoint', $data)) { + $object->setPickupPoint($data['PickupPoint']); + unset($data['PickupPoint']); } + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\PickupAddressPhone::class, 'json', $context)); + unset($data['Phone']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class PickupCreationRequestPickupAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class; + $dataArray = []; + $dataArray['CompanyName'] = $data->getCompanyName(); + $dataArray['ContactName'] = $data->getContactName(); + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class; + $dataArray['AddressLine'] = $values; + if ($data->isInitialized('room') && null !== $data->getRoom()) { + $dataArray['Room'] = $data->getRoom(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CompanyName', $data)) { - $object->setCompanyName($data['CompanyName']); - unset($data['CompanyName']); - } - if (\array_key_exists('ContactName', $data)) { - $object->setContactName($data['ContactName']); - unset($data['ContactName']); - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('Room', $data)) { - $object->setRoom($data['Room']); - unset($data['Room']); - } - if (\array_key_exists('Floor', $data)) { - $object->setFloor($data['Floor']); - unset($data['Floor']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('Urbanization', $data)) { - $object->setUrbanization($data['Urbanization']); - unset($data['Urbanization']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialIndicator', $data)) { - $object->setResidentialIndicator($data['ResidentialIndicator']); - unset($data['ResidentialIndicator']); - } - if (\array_key_exists('PickupPoint', $data)) { - $object->setPickupPoint($data['PickupPoint']); - unset($data['PickupPoint']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\PickupAddressPhone::class, 'json', $context)); - unset($data['Phone']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('floor') && null !== $data->getFloor()) { + $dataArray['Floor'] = $data->getFloor(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CompanyName'] = $object->getCompanyName(); - $data['ContactName'] = $object->getContactName(); - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - if ($object->isInitialized('room') && null !== $object->getRoom()) { - $data['Room'] = $object->getRoom(); - } - if ($object->isInitialized('floor') && null !== $object->getFloor()) { - $data['Floor'] = $object->getFloor(); - } - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['StateProvince'] = $object->getStateProvince(); - } - if ($object->isInitialized('urbanization') && null !== $object->getUrbanization()) { - $data['Urbanization'] = $object->getUrbanization(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - $data['ResidentialIndicator'] = $object->getResidentialIndicator(); - if ($object->isInitialized('pickupPoint') && null !== $object->getPickupPoint()) { - $data['PickupPoint'] = $object->getPickupPoint(); - } - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvince') && null !== $data->getStateProvince()) { + $dataArray['StateProvince'] = $data->getStateProvince(); + } + if ($data->isInitialized('urbanization') && null !== $data->getUrbanization()) { + $dataArray['Urbanization'] = $data->getUrbanization(); + } + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + $dataArray['ResidentialIndicator'] = $data->getResidentialIndicator(); + if ($data->isInitialized('pickupPoint') && null !== $data->getPickupPoint()) { + $dataArray['PickupPoint'] = $data->getPickupPoint(); } + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationRequestPickupAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationRequestPickupDateInfoNormalizer.php b/src/Api/Normalizer/PickupCreationRequestPickupDateInfoNormalizer.php index 659e8898..da1be908 100644 --- a/src/Api/Normalizer/PickupCreationRequestPickupDateInfoNormalizer.php +++ b/src/Api/Normalizer/PickupCreationRequestPickupDateInfoNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationRequestPickupDateInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationRequestPickupDateInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CloseTime', $data)) { - $object->setCloseTime($data['CloseTime']); - unset($data['CloseTime']); - } - if (\array_key_exists('ReadyTime', $data)) { - $object->setReadyTime($data['ReadyTime']); - unset($data['ReadyTime']); - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CloseTime'] = $object->getCloseTime(); - $data['ReadyTime'] = $object->getReadyTime(); - $data['PickupDate'] = $object->getPickupDate(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CloseTime', $data)) { + $object->setCloseTime($data['CloseTime']); + unset($data['CloseTime']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class => false]; + if (\array_key_exists('ReadyTime', $data)) { + $object->setReadyTime($data['ReadyTime']); + unset($data['ReadyTime']); } - } -} else { - class PickupCreationRequestPickupDateInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class; + if (\array_key_exists('PickupDate', $data)) { + $object->setPickupDate($data['PickupDate']); + unset($data['PickupDate']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CloseTime', $data)) { - $object->setCloseTime($data['CloseTime']); - unset($data['CloseTime']); - } - if (\array_key_exists('ReadyTime', $data)) { - $object->setReadyTime($data['ReadyTime']); - unset($data['ReadyTime']); - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CloseTime'] = $object->getCloseTime(); - $data['ReadyTime'] = $object->getReadyTime(); - $data['PickupDate'] = $object->getPickupDate(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CloseTime'] = $data->getCloseTime(); + $dataArray['ReadyTime'] = $data->getReadyTime(); + $dataArray['PickupDate'] = $data->getPickupDate(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationRequestPickupDateInfo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationRequestPickupPieceNormalizer.php b/src/Api/Normalizer/PickupCreationRequestPickupPieceNormalizer.php index 3987dde4..98a3773d 100644 --- a/src/Api/Normalizer/PickupCreationRequestPickupPieceNormalizer.php +++ b/src/Api/Normalizer/PickupCreationRequestPickupPieceNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationRequestPickupPieceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationRequestPickupPieceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ServiceCode', $data)) { - $object->setServiceCode($data['ServiceCode']); - unset($data['ServiceCode']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('DestinationCountryCode', $data)) { - $object->setDestinationCountryCode($data['DestinationCountryCode']); - unset($data['DestinationCountryCode']); - } - if (\array_key_exists('ContainerCode', $data)) { - $object->setContainerCode($data['ContainerCode']); - unset($data['ContainerCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ServiceCode'] = $object->getServiceCode(); - $data['Quantity'] = $object->getQuantity(); - $data['DestinationCountryCode'] = $object->getDestinationCountryCode(); - $data['ContainerCode'] = $object->getContainerCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ServiceCode', $data)) { + $object->setServiceCode($data['ServiceCode']); + unset($data['ServiceCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class => false]; + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); } - } -} else { - class PickupCreationRequestPickupPieceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class; + if (\array_key_exists('DestinationCountryCode', $data)) { + $object->setDestinationCountryCode($data['DestinationCountryCode']); + unset($data['DestinationCountryCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class; + if (\array_key_exists('ContainerCode', $data)) { + $object->setContainerCode($data['ContainerCode']); + unset($data['ContainerCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ServiceCode', $data)) { - $object->setServiceCode($data['ServiceCode']); - unset($data['ServiceCode']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('DestinationCountryCode', $data)) { - $object->setDestinationCountryCode($data['DestinationCountryCode']); - unset($data['DestinationCountryCode']); - } - if (\array_key_exists('ContainerCode', $data)) { - $object->setContainerCode($data['ContainerCode']); - unset($data['ContainerCode']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ServiceCode'] = $object->getServiceCode(); - $data['Quantity'] = $object->getQuantity(); - $data['DestinationCountryCode'] = $object->getDestinationCountryCode(); - $data['ContainerCode'] = $object->getContainerCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ServiceCode'] = $data->getServiceCode(); + $dataArray['Quantity'] = $data->getQuantity(); + $dataArray['DestinationCountryCode'] = $data->getDestinationCountryCode(); + $dataArray['ContainerCode'] = $data->getContainerCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationRequestPickupPiece::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationRequestRequestNormalizer.php b/src/Api/Normalizer/PickupCreationRequestRequestNormalizer.php index ed1e9dce..380bfab7 100644 --- a/src/Api/Normalizer/PickupCreationRequestRequestNormalizer.php +++ b/src/Api/Normalizer/PickupCreationRequestRequestNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('SubVersion', $data)) { + $object->setSubVersion($data['SubVersion']); + unset($data['SubVersion']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PickupCreationRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('subVersion') && null !== $data->getSubVersion()) { + $dataArray['SubVersion'] = $data->getSubVersion(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationRequestShipperNormalizer.php b/src/Api/Normalizer/PickupCreationRequestShipperNormalizer.php index f055ffd8..ce5492ab 100644 --- a/src/Api/Normalizer/PickupCreationRequestShipperNormalizer.php +++ b/src/Api/Normalizer/PickupCreationRequestShipperNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationRequestShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationRequestShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestShipper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Account', $data)) { - $object->setAccount($this->denormalizer->denormalize($data['Account'], \ShipStream\Ups\Api\Model\ShipperAccount::class, 'json', $context)); - unset($data['Account']); - } - if (\array_key_exists('ChargeCard', $data)) { - $object->setChargeCard($this->denormalizer->denormalize($data['ChargeCard'], \ShipStream\Ups\Api\Model\ShipperChargeCard::class, 'json', $context)); - unset($data['ChargeCard']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestShipper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('account') && null !== $object->getAccount()) { - $data['Account'] = $this->normalizer->normalize($object->getAccount(), 'json', $context); - } - if ($object->isInitialized('chargeCard') && null !== $object->getChargeCard()) { - $data['ChargeCard'] = $this->normalizer->normalize($object->getChargeCard(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Account', $data)) { + $object->setAccount($this->denormalizer->denormalize($data['Account'], \ShipStream\Ups\Api\Model\ShipperAccount::class, 'json', $context)); + unset($data['Account']); + } + if (\array_key_exists('ChargeCard', $data)) { + $object->setChargeCard($this->denormalizer->denormalize($data['ChargeCard'], \ShipStream\Ups\Api\Model\ShipperChargeCard::class, 'json', $context)); + unset($data['ChargeCard']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PickupCreationRequestShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class; + $dataArray = []; + if ($data->isInitialized('account') && null !== $data->getAccount()) { + $dataArray['Account'] = $this->normalizer->normalize($data->getAccount(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestShipper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Account', $data)) { - $object->setAccount($this->denormalizer->denormalize($data['Account'], \ShipStream\Ups\Api\Model\ShipperAccount::class, 'json', $context)); - unset($data['Account']); - } - if (\array_key_exists('ChargeCard', $data)) { - $object->setChargeCard($this->denormalizer->denormalize($data['ChargeCard'], \ShipStream\Ups\Api\Model\ShipperChargeCard::class, 'json', $context)); - unset($data['ChargeCard']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('chargeCard') && null !== $data->getChargeCard()) { + $dataArray['ChargeCard'] = $this->normalizer->normalize($data->getChargeCard(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('account') && null !== $object->getAccount()) { - $data['Account'] = $this->normalizer->normalize($object->getAccount(), 'json', $context); - } - if ($object->isInitialized('chargeCard') && null !== $object->getChargeCard()) { - $data['ChargeCard'] = $this->normalizer->normalize($object->getChargeCard(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationRequestShipper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationRequestTotalWeightNormalizer.php b/src/Api/Normalizer/PickupCreationRequestTotalWeightNormalizer.php index 140fa35b..00351766 100644 --- a/src/Api/Normalizer/PickupCreationRequestTotalWeightNormalizer.php +++ b/src/Api/Normalizer/PickupCreationRequestTotalWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationRequestTotalWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationRequestTotalWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($data['UnitOfMeasurement']); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Weight'] = $object->getWeight(); - $data['UnitOfMeasurement'] = $object->getUnitOfMeasurement(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class => false]; - } - } -} else { - class PickupCreationRequestTotalWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($data['UnitOfMeasurement']); + unset($data['UnitOfMeasurement']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($data['UnitOfMeasurement']); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Weight'] = $object->getWeight(); - $data['UnitOfMeasurement'] = $object->getUnitOfMeasurement(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Weight'] = $data->getWeight(); + $dataArray['UnitOfMeasurement'] = $data->getUnitOfMeasurement(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationRequestTotalWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationRequestTrackingDataNormalizer.php b/src/Api/Normalizer/PickupCreationRequestTrackingDataNormalizer.php index af65beae..f7aa7b88 100644 --- a/src/Api/Normalizer/PickupCreationRequestTrackingDataNormalizer.php +++ b/src/Api/Normalizer/PickupCreationRequestTrackingDataNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationRequestTrackingDataNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationRequestTrackingDataNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $data['TrackingNumber'] = $object->getTrackingNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('TrackingNumber', $data)) { + $object->setTrackingNumber($data['TrackingNumber']); + unset($data['TrackingNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PickupCreationRequestTrackingDataNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class; + $dataArray = []; + if ($data->isInitialized('trackingNumber') && null !== $data->getTrackingNumber()) { + $dataArray['TrackingNumber'] = $data->getTrackingNumber(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $data['TrackingNumber'] = $object->getTrackingNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationRequestTrackingData::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationRequestTrackingDataWithReferenceNumberNormalizer.php b/src/Api/Normalizer/PickupCreationRequestTrackingDataWithReferenceNumberNormalizer.php index 6bb40fa3..a3fcc016 100644 --- a/src/Api/Normalizer/PickupCreationRequestTrackingDataWithReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/PickupCreationRequestTrackingDataWithReferenceNumberNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationRequestTrackingDataWithReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationRequestTrackingDataWithReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $values = []; - foreach ($data['ReferenceNumber'] as $value) { - $values[] = $value; - } - $object->setReferenceNumber($values); - unset($data['ReferenceNumber']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['TrackingNumber'] = $object->getTrackingNumber(); - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $values = []; - foreach ($object->getReferenceNumber() as $value) { - $values[] = $value; - } - $data['ReferenceNumber'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('TrackingNumber', $data)) { + $object->setTrackingNumber($data['TrackingNumber']); + unset($data['TrackingNumber']); + } + if (\array_key_exists('ReferenceNumber', $data)) { + $values = []; + foreach ($data['ReferenceNumber'] as $value) { + $values[] = $value; } - return $data; + $object->setReferenceNumber($values); + unset($data['ReferenceNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PickupCreationRequestTrackingDataWithReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class; + $dataArray = []; + $dataArray['TrackingNumber'] = $data->getTrackingNumber(); + if ($data->isInitialized('referenceNumber') && null !== $data->getReferenceNumber()) { + $values = []; + foreach ($data->getReferenceNumber() as $value) { + $values[] = $value; + } + $dataArray['ReferenceNumber'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('ReferenceNumber', $data)) { - $values = []; - foreach ($data['ReferenceNumber'] as $value) { - $values[] = $value; - } - $object->setReferenceNumber($values); - unset($data['ReferenceNumber']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['TrackingNumber'] = $object->getTrackingNumber(); - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $values = []; - foreach ($object->getReferenceNumber() as $value) { - $values[] = $value; - } - $data['ReferenceNumber'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationRequestTrackingDataWithReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationResponseNormalizer.php b/src/Api/Normalizer/PickupCreationResponseNormalizer.php index 934ca0d7..e2543261 100644 --- a/src/Api/Normalizer/PickupCreationResponseNormalizer.php +++ b/src/Api/Normalizer/PickupCreationResponseNormalizer.php @@ -5,192 +5,95 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationResponse::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('PRN', $data)) { - $object->setPRN($data['PRN']); - unset($data['PRN']); - } - if (\array_key_exists('WeekendServiceTerritory', $data)) { - $object->setWeekendServiceTerritory($this->denormalizer->denormalize($data['WeekendServiceTerritory'], \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class, 'json', $context)); - unset($data['WeekendServiceTerritory']); - } - if (\array_key_exists('WeekendServiceTerritoryIndicator', $data)) { - $object->setWeekendServiceTerritoryIndicator($data['WeekendServiceTerritoryIndicator']); - unset($data['WeekendServiceTerritoryIndicator']); - } - if (\array_key_exists('RateStatus', $data)) { - $object->setRateStatus($this->denormalizer->denormalize($data['RateStatus'], \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class, 'json', $context)); - unset($data['RateStatus']); - } - if (\array_key_exists('RateResult', $data)) { - $object->setRateResult($this->denormalizer->denormalize($data['RateResult'], \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class, 'json', $context)); - unset($data['RateResult']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('pRN') && null !== $object->getPRN()) { - $data['PRN'] = $object->getPRN(); - } - if ($object->isInitialized('weekendServiceTerritory') && null !== $object->getWeekendServiceTerritory()) { - $data['WeekendServiceTerritory'] = $this->normalizer->normalize($object->getWeekendServiceTerritory(), 'json', $context); - } - if ($object->isInitialized('weekendServiceTerritoryIndicator') && null !== $object->getWeekendServiceTerritoryIndicator()) { - $data['WeekendServiceTerritoryIndicator'] = $object->getWeekendServiceTerritoryIndicator(); - } - $data['RateStatus'] = $this->normalizer->normalize($object->getRateStatus(), 'json', $context); - if ($object->isInitialized('rateResult') && null !== $object->getRateResult()) { - $data['RateResult'] = $this->normalizer->normalize($object->getRateResult(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class, 'json', $context)); + unset($data['Response']); + } + if (\array_key_exists('PRN', $data)) { + $object->setPRN($data['PRN']); + unset($data['PRN']); + } + if (\array_key_exists('WeekendServiceTerritory', $data)) { + $object->setWeekendServiceTerritory($this->denormalizer->denormalize($data['WeekendServiceTerritory'], \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class, 'json', $context)); + unset($data['WeekendServiceTerritory']); + } + if (\array_key_exists('WeekendServiceTerritoryIndicator', $data)) { + $object->setWeekendServiceTerritoryIndicator($data['WeekendServiceTerritoryIndicator']); + unset($data['WeekendServiceTerritoryIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationResponse::class => false]; + if (\array_key_exists('RateStatus', $data)) { + $object->setRateStatus($this->denormalizer->denormalize($data['RateStatus'], \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class, 'json', $context)); + unset($data['RateStatus']); } + if (\array_key_exists('RateResult', $data)) { + $object->setRateResult($this->denormalizer->denormalize($data['RateResult'], \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class, 'json', $context)); + unset($data['RateResult']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupCreationResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationResponse::class; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + if ($data->isInitialized('pRN') && null !== $data->getPRN()) { + $dataArray['PRN'] = $data->getPRN(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponse::class; + if ($data->isInitialized('weekendServiceTerritory') && null !== $data->getWeekendServiceTerritory()) { + $dataArray['WeekendServiceTerritory'] = $this->normalizer->normalize($data->getWeekendServiceTerritory(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('PRN', $data)) { - $object->setPRN($data['PRN']); - unset($data['PRN']); - } - if (\array_key_exists('WeekendServiceTerritory', $data)) { - $object->setWeekendServiceTerritory($this->denormalizer->denormalize($data['WeekendServiceTerritory'], \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class, 'json', $context)); - unset($data['WeekendServiceTerritory']); - } - if (\array_key_exists('WeekendServiceTerritoryIndicator', $data)) { - $object->setWeekendServiceTerritoryIndicator($data['WeekendServiceTerritoryIndicator']); - unset($data['WeekendServiceTerritoryIndicator']); - } - if (\array_key_exists('RateStatus', $data)) { - $object->setRateStatus($this->denormalizer->denormalize($data['RateStatus'], \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class, 'json', $context)); - unset($data['RateStatus']); - } - if (\array_key_exists('RateResult', $data)) { - $object->setRateResult($this->denormalizer->denormalize($data['RateResult'], \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class, 'json', $context)); - unset($data['RateResult']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('weekendServiceTerritoryIndicator') && null !== $data->getWeekendServiceTerritoryIndicator()) { + $dataArray['WeekendServiceTerritoryIndicator'] = $data->getWeekendServiceTerritoryIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('pRN') && null !== $object->getPRN()) { - $data['PRN'] = $object->getPRN(); - } - if ($object->isInitialized('weekendServiceTerritory') && null !== $object->getWeekendServiceTerritory()) { - $data['WeekendServiceTerritory'] = $this->normalizer->normalize($object->getWeekendServiceTerritory(), 'json', $context); - } - if ($object->isInitialized('weekendServiceTerritoryIndicator') && null !== $object->getWeekendServiceTerritoryIndicator()) { - $data['WeekendServiceTerritoryIndicator'] = $object->getWeekendServiceTerritoryIndicator(); - } - $data['RateStatus'] = $this->normalizer->normalize($object->getRateStatus(), 'json', $context); - if ($object->isInitialized('rateResult') && null !== $object->getRateResult()) { - $data['RateResult'] = $this->normalizer->normalize($object->getRateResult(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + $dataArray['RateStatus'] = $this->normalizer->normalize($data->getRateStatus(), 'json', $context); + if ($data->isInitialized('rateResult') && null !== $data->getRateResult()) { + $dataArray['RateResult'] = $this->normalizer->normalize($data->getRateResult(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationResponse::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationResponseRateResultNormalizer.php b/src/Api/Normalizer/PickupCreationResponseRateResultNormalizer.php index eb6544c8..387f4f03 100644 --- a/src/Api/Normalizer/PickupCreationResponseRateResultNormalizer.php +++ b/src/Api/Normalizer/PickupCreationResponseRateResultNormalizer.php @@ -5,284 +5,141 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationResponseRateResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationResponseRateResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Disclaimer', $data)) { - $object->setDisclaimer($this->denormalizer->denormalize($data['Disclaimer'], \ShipStream\Ups\Api\Model\RateResultDisclaimer::class, 'json', $context)); - unset($data['Disclaimer']); - } - if (\array_key_exists('RateType', $data)) { - $object->setRateType($data['RateType']); - unset($data['RateType']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('ChargeDetail', $data)) { - $values = []; - foreach ($data['ChargeDetail'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RateResultChargeDetail::class, 'json', $context); - } - $object->setChargeDetail($values); - unset($data['ChargeDetail']); - } - if (\array_key_exists('TaxCharges', $data)) { - $values_1 = []; - foreach ($data['TaxCharges'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\RateResultTaxCharges::class, 'json', $context); - } - $object->setTaxCharges($values_1); - unset($data['TaxCharges']); - } - if (\array_key_exists('TotalTax', $data)) { - $object->setTotalTax($data['TotalTax']); - unset($data['TotalTax']); - } - if (\array_key_exists('GrandTotalOfAllCharge', $data)) { - $object->setGrandTotalOfAllCharge($data['GrandTotalOfAllCharge']); - unset($data['GrandTotalOfAllCharge']); - } - if (\array_key_exists('GrandTotalOfAllIncentedCharge', $data)) { - $object->setGrandTotalOfAllIncentedCharge($data['GrandTotalOfAllIncentedCharge']); - unset($data['GrandTotalOfAllIncentedCharge']); - } - if (\array_key_exists('PreTaxTotalCharge', $data)) { - $object->setPreTaxTotalCharge($data['PreTaxTotalCharge']); - unset($data['PreTaxTotalCharge']); - } - if (\array_key_exists('PreTaxTotalIncentedCharge', $data)) { - $object->setPreTaxTotalIncentedCharge($data['PreTaxTotalIncentedCharge']); - unset($data['PreTaxTotalIncentedCharge']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $data['Disclaimer'] = $this->normalizer->normalize($object->getDisclaimer(), 'json', $context); - } - if ($object->isInitialized('rateType') && null !== $object->getRateType()) { - $data['RateType'] = $object->getRateType(); - } - if ($object->isInitialized('currencyCode') && null !== $object->getCurrencyCode()) { - $data['CurrencyCode'] = $object->getCurrencyCode(); - } - if ($object->isInitialized('chargeDetail') && null !== $object->getChargeDetail()) { - $values = []; - foreach ($object->getChargeDetail() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ChargeDetail'] = $values; - } - if ($object->isInitialized('taxCharges') && null !== $object->getTaxCharges()) { - $values_1 = []; - foreach ($object->getTaxCharges() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['TaxCharges'] = $values_1; - } - if ($object->isInitialized('totalTax') && null !== $object->getTotalTax()) { - $data['TotalTax'] = $object->getTotalTax(); - } - $data['GrandTotalOfAllCharge'] = $object->getGrandTotalOfAllCharge(); - if ($object->isInitialized('grandTotalOfAllIncentedCharge') && null !== $object->getGrandTotalOfAllIncentedCharge()) { - $data['GrandTotalOfAllIncentedCharge'] = $object->getGrandTotalOfAllIncentedCharge(); - } - if ($object->isInitialized('preTaxTotalCharge') && null !== $object->getPreTaxTotalCharge()) { - $data['PreTaxTotalCharge'] = $object->getPreTaxTotalCharge(); - } - if ($object->isInitialized('preTaxTotalIncentedCharge') && null !== $object->getPreTaxTotalIncentedCharge()) { - $data['PreTaxTotalIncentedCharge'] = $object->getPreTaxTotalIncentedCharge(); + if (\array_key_exists('Disclaimer', $data)) { + $object->setDisclaimer($this->denormalizer->denormalize($data['Disclaimer'], \ShipStream\Ups\Api\Model\RateResultDisclaimer::class, 'json', $context)); + unset($data['Disclaimer']); + } + if (\array_key_exists('RateType', $data)) { + $object->setRateType($data['RateType']); + unset($data['RateType']); + } + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); + } + if (\array_key_exists('ChargeDetail', $data)) { + $values = []; + foreach ($data['ChargeDetail'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RateResultChargeDetail::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setChargeDetail($values); + unset($data['ChargeDetail']); + } + if (\array_key_exists('TaxCharges', $data)) { + $values_1 = []; + foreach ($data['TaxCharges'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\RateResultTaxCharges::class, 'json', $context); } - return $data; + $object->setTaxCharges($values_1); + unset($data['TaxCharges']); + } + if (\array_key_exists('TotalTax', $data)) { + $object->setTotalTax($data['TotalTax']); + unset($data['TotalTax']); + } + if (\array_key_exists('GrandTotalOfAllCharge', $data)) { + $object->setGrandTotalOfAllCharge($data['GrandTotalOfAllCharge']); + unset($data['GrandTotalOfAllCharge']); + } + if (\array_key_exists('GrandTotalOfAllIncentedCharge', $data)) { + $object->setGrandTotalOfAllIncentedCharge($data['GrandTotalOfAllIncentedCharge']); + unset($data['GrandTotalOfAllIncentedCharge']); + } + if (\array_key_exists('PreTaxTotalCharge', $data)) { + $object->setPreTaxTotalCharge($data['PreTaxTotalCharge']); + unset($data['PreTaxTotalCharge']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class => false]; + if (\array_key_exists('PreTaxTotalIncentedCharge', $data)) { + $object->setPreTaxTotalIncentedCharge($data['PreTaxTotalIncentedCharge']); + unset($data['PreTaxTotalIncentedCharge']); } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } -} else { - class PickupCreationResponseRateResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class; + $dataArray = []; + if ($data->isInitialized('disclaimer') && null !== $data->getDisclaimer()) { + $dataArray['Disclaimer'] = $this->normalizer->normalize($data->getDisclaimer(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class; + if ($data->isInitialized('rateType') && null !== $data->getRateType()) { + $dataArray['RateType'] = $data->getRateType(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationResponseRateResult(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Disclaimer', $data)) { - $object->setDisclaimer($this->denormalizer->denormalize($data['Disclaimer'], \ShipStream\Ups\Api\Model\RateResultDisclaimer::class, 'json', $context)); - unset($data['Disclaimer']); - } - if (\array_key_exists('RateType', $data)) { - $object->setRateType($data['RateType']); - unset($data['RateType']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('ChargeDetail', $data)) { - $values = []; - foreach ($data['ChargeDetail'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RateResultChargeDetail::class, 'json', $context); - } - $object->setChargeDetail($values); - unset($data['ChargeDetail']); - } - if (\array_key_exists('TaxCharges', $data)) { - $values_1 = []; - foreach ($data['TaxCharges'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\RateResultTaxCharges::class, 'json', $context); - } - $object->setTaxCharges($values_1); - unset($data['TaxCharges']); - } - if (\array_key_exists('TotalTax', $data)) { - $object->setTotalTax($data['TotalTax']); - unset($data['TotalTax']); - } - if (\array_key_exists('GrandTotalOfAllCharge', $data)) { - $object->setGrandTotalOfAllCharge($data['GrandTotalOfAllCharge']); - unset($data['GrandTotalOfAllCharge']); - } - if (\array_key_exists('GrandTotalOfAllIncentedCharge', $data)) { - $object->setGrandTotalOfAllIncentedCharge($data['GrandTotalOfAllIncentedCharge']); - unset($data['GrandTotalOfAllIncentedCharge']); - } - if (\array_key_exists('PreTaxTotalCharge', $data)) { - $object->setPreTaxTotalCharge($data['PreTaxTotalCharge']); - unset($data['PreTaxTotalCharge']); - } - if (\array_key_exists('PreTaxTotalIncentedCharge', $data)) { - $object->setPreTaxTotalIncentedCharge($data['PreTaxTotalIncentedCharge']); - unset($data['PreTaxTotalIncentedCharge']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + if ($data->isInitialized('currencyCode') && null !== $data->getCurrencyCode()) { + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $data['Disclaimer'] = $this->normalizer->normalize($object->getDisclaimer(), 'json', $context); + if ($data->isInitialized('chargeDetail') && null !== $data->getChargeDetail()) { + $values = []; + foreach ($data->getChargeDetail() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - if ($object->isInitialized('rateType') && null !== $object->getRateType()) { - $data['RateType'] = $object->getRateType(); - } - if ($object->isInitialized('currencyCode') && null !== $object->getCurrencyCode()) { - $data['CurrencyCode'] = $object->getCurrencyCode(); - } - if ($object->isInitialized('chargeDetail') && null !== $object->getChargeDetail()) { - $values = []; - foreach ($object->getChargeDetail() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ChargeDetail'] = $values; - } - if ($object->isInitialized('taxCharges') && null !== $object->getTaxCharges()) { - $values_1 = []; - foreach ($object->getTaxCharges() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['TaxCharges'] = $values_1; - } - if ($object->isInitialized('totalTax') && null !== $object->getTotalTax()) { - $data['TotalTax'] = $object->getTotalTax(); - } - $data['GrandTotalOfAllCharge'] = $object->getGrandTotalOfAllCharge(); - if ($object->isInitialized('grandTotalOfAllIncentedCharge') && null !== $object->getGrandTotalOfAllIncentedCharge()) { - $data['GrandTotalOfAllIncentedCharge'] = $object->getGrandTotalOfAllIncentedCharge(); - } - if ($object->isInitialized('preTaxTotalCharge') && null !== $object->getPreTaxTotalCharge()) { - $data['PreTaxTotalCharge'] = $object->getPreTaxTotalCharge(); - } - if ($object->isInitialized('preTaxTotalIncentedCharge') && null !== $object->getPreTaxTotalIncentedCharge()) { - $data['PreTaxTotalIncentedCharge'] = $object->getPreTaxTotalIncentedCharge(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $dataArray['ChargeDetail'] = $values; + } + if ($data->isInitialized('taxCharges') && null !== $data->getTaxCharges()) { + $values_1 = []; + foreach ($data->getTaxCharges() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['TaxCharges'] = $values_1; + } + if ($data->isInitialized('totalTax') && null !== $data->getTotalTax()) { + $dataArray['TotalTax'] = $data->getTotalTax(); + } + $dataArray['GrandTotalOfAllCharge'] = $data->getGrandTotalOfAllCharge(); + if ($data->isInitialized('grandTotalOfAllIncentedCharge') && null !== $data->getGrandTotalOfAllIncentedCharge()) { + $dataArray['GrandTotalOfAllIncentedCharge'] = $data->getGrandTotalOfAllIncentedCharge(); + } + if ($data->isInitialized('preTaxTotalCharge') && null !== $data->getPreTaxTotalCharge()) { + $dataArray['PreTaxTotalCharge'] = $data->getPreTaxTotalCharge(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class => false]; + if ($data->isInitialized('preTaxTotalIncentedCharge') && null !== $data->getPreTaxTotalIncentedCharge()) { + $dataArray['PreTaxTotalIncentedCharge'] = $data->getPreTaxTotalIncentedCharge(); } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationResponseRateResult::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationResponseRateStatusNormalizer.php b/src/Api/Normalizer/PickupCreationResponseRateStatusNormalizer.php index bfd3ea6e..9a80282d 100644 --- a/src/Api/Normalizer/PickupCreationResponseRateStatusNormalizer.php +++ b/src/Api/Normalizer/PickupCreationResponseRateStatusNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationResponseRateStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationResponseRateStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PickupCreationResponseRateStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationResponseRateStatus::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationResponseResponseNormalizer.php b/src/Api/Normalizer/PickupCreationResponseResponseNormalizer.php index a195ca6a..8baec16b 100644 --- a/src/Api/Normalizer/PickupCreationResponseResponseNormalizer.php +++ b/src/Api/Normalizer/PickupCreationResponseResponseNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class => false]; + if (\array_key_exists('Alert', $data)) { + $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); + unset($data['Alert']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupCreationResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $dataArray['Alert'] = $this->normalizer->normalize($data->getAlert(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupCreationResponseWeekendServiceTerritoryNormalizer.php b/src/Api/Normalizer/PickupCreationResponseWeekendServiceTerritoryNormalizer.php index 4b954afb..017bf045 100644 --- a/src/Api/Normalizer/PickupCreationResponseWeekendServiceTerritoryNormalizer.php +++ b/src/Api/Normalizer/PickupCreationResponseWeekendServiceTerritoryNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupCreationResponseWeekendServiceTerritoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupCreationResponseWeekendServiceTerritoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class; + return $type === \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SatWST', $data)) { - $object->setSatWST($data['SatWST']); - unset($data['SatWST']); - } - if (\array_key_exists('SunWST', $data)) { - $object->setSunWST($data['SunWST']); - unset($data['SunWST']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['SatWST'] = $object->getSatWST(); - $data['SunWST'] = $object->getSunWST(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class => false]; - } - } -} else { - class PickupCreationResponseWeekendServiceTerritoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class; + if (\array_key_exists('SatWST', $data)) { + $object->setSatWST($data['SatWST']); + unset($data['SatWST']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class; + if (\array_key_exists('SunWST', $data)) { + $object->setSunWST($data['SunWST']); + unset($data['SunWST']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SatWST', $data)) { - $object->setSatWST($data['SatWST']); - unset($data['SatWST']); - } - if (\array_key_exists('SunWST', $data)) { - $object->setSunWST($data['SunWST']); - unset($data['SunWST']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['SatWST'] = $object->getSatWST(); - $data['SunWST'] = $object->getSunWST(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['SatWST'] = $data->getSatWST(); + $dataArray['SunWST'] = $data->getSunWST(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupCreationResponseWeekendServiceTerritory::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupFacilitiesAddressNormalizer.php b/src/Api/Normalizer/PickupFacilitiesAddressNormalizer.php index 0f2df35e..5481e2e2 100644 --- a/src/Api/Normalizer/PickupFacilitiesAddressNormalizer.php +++ b/src/Api/Normalizer/PickupFacilitiesAddressNormalizer.php @@ -5,176 +5,87 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupFacilitiesAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupFacilitiesAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class; + return $type === \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupFacilitiesAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialIndicator', $data)) { - $object->setResidentialIndicator($data['ResidentialIndicator']); - unset($data['ResidentialIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupFacilitiesAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AddressLine'] = $object->getAddressLine(); - $data['City'] = $object->getCity(); - $data['StateProvince'] = $object->getStateProvince(); - $data['PostalCode'] = $object->getPostalCode(); - $data['CountryCode'] = $object->getCountryCode(); - $data['ResidentialIndicator'] = $object->getResidentialIndicator(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressLine', $data)) { + $object->setAddressLine($data['AddressLine']); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } - } -} else { - class PickupFacilitiesAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class; + if (\array_key_exists('StateProvince', $data)) { + $object->setStateProvince($data['StateProvince']); + unset($data['StateProvince']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupFacilitiesAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialIndicator', $data)) { - $object->setResidentialIndicator($data['ResidentialIndicator']); - unset($data['ResidentialIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AddressLine'] = $object->getAddressLine(); - $data['City'] = $object->getCity(); - $data['StateProvince'] = $object->getStateProvince(); - $data['PostalCode'] = $object->getPostalCode(); - $data['CountryCode'] = $object->getCountryCode(); - $data['ResidentialIndicator'] = $object->getResidentialIndicator(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + if (\array_key_exists('ResidentialIndicator', $data)) { + $object->setResidentialIndicator($data['ResidentialIndicator']); + unset($data['ResidentialIndicator']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['AddressLine'] = $data->getAddressLine(); + $dataArray['City'] = $data->getCity(); + $dataArray['StateProvince'] = $data->getStateProvince(); + $dataArray['PostalCode'] = $data->getPostalCode(); + $dataArray['CountryCode'] = $data->getCountryCode(); + $dataArray['ResidentialIndicator'] = $data->getResidentialIndicator(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupFacilitiesFacilityTimeDayOfWeekNormalizer.php b/src/Api/Normalizer/PickupFacilitiesFacilityTimeDayOfWeekNormalizer.php index bee990cf..44e75b86 100644 --- a/src/Api/Normalizer/PickupFacilitiesFacilityTimeDayOfWeekNormalizer.php +++ b/src/Api/Normalizer/PickupFacilitiesFacilityTimeDayOfWeekNormalizer.php @@ -5,202 +5,100 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupFacilitiesFacilityTimeDayOfWeekNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupFacilitiesFacilityTimeDayOfWeekNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Day', $data)) { - $object->setDay($data['Day']); - unset($data['Day']); - } - if (\array_key_exists('EarliestDropOfforPickup', $data)) { - $object->setEarliestDropOfforPickup($data['EarliestDropOfforPickup']); - unset($data['EarliestDropOfforPickup']); - } - if (\array_key_exists('LatestDropOfforPickup', $data)) { - $object->setLatestDropOfforPickup($data['LatestDropOfforPickup']); - unset($data['LatestDropOfforPickup']); - } - if (\array_key_exists('OpenHours', $data)) { - $object->setOpenHours($data['OpenHours']); - unset($data['OpenHours']); - } - if (\array_key_exists('CloseHours', $data)) { - $object->setCloseHours($data['CloseHours']); - unset($data['CloseHours']); - } - if (\array_key_exists('PrepTime', $data)) { - $object->setPrepTime($data['PrepTime']); - unset($data['PrepTime']); - } - if (\array_key_exists('LastDrop', $data)) { - $object->setLastDrop($data['LastDrop']); - unset($data['LastDrop']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Day'] = $object->getDay(); - if ($object->isInitialized('earliestDropOfforPickup') && null !== $object->getEarliestDropOfforPickup()) { - $data['EarliestDropOfforPickup'] = $object->getEarliestDropOfforPickup(); - } - if ($object->isInitialized('latestDropOfforPickup') && null !== $object->getLatestDropOfforPickup()) { - $data['LatestDropOfforPickup'] = $object->getLatestDropOfforPickup(); - } - $data['OpenHours'] = $object->getOpenHours(); - $data['CloseHours'] = $object->getCloseHours(); - if ($object->isInitialized('prepTime') && null !== $object->getPrepTime()) { - $data['PrepTime'] = $object->getPrepTime(); - } - if ($object->isInitialized('lastDrop') && null !== $object->getLastDrop()) { - $data['LastDrop'] = $object->getLastDrop(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Day', $data)) { + $object->setDay($data['Day']); + unset($data['Day']); + } + if (\array_key_exists('EarliestDropOfforPickup', $data)) { + $object->setEarliestDropOfforPickup($data['EarliestDropOfforPickup']); + unset($data['EarliestDropOfforPickup']); + } + if (\array_key_exists('LatestDropOfforPickup', $data)) { + $object->setLatestDropOfforPickup($data['LatestDropOfforPickup']); + unset($data['LatestDropOfforPickup']); + } + if (\array_key_exists('OpenHours', $data)) { + $object->setOpenHours($data['OpenHours']); + unset($data['OpenHours']); + } + if (\array_key_exists('CloseHours', $data)) { + $object->setCloseHours($data['CloseHours']); + unset($data['CloseHours']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class => false]; + if (\array_key_exists('PrepTime', $data)) { + $object->setPrepTime($data['PrepTime']); + unset($data['PrepTime']); } + if (\array_key_exists('LastDrop', $data)) { + $object->setLastDrop($data['LastDrop']); + unset($data['LastDrop']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupFacilitiesFacilityTimeDayOfWeekNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Day', $data)) { - $object->setDay($data['Day']); - unset($data['Day']); - } - if (\array_key_exists('EarliestDropOfforPickup', $data)) { - $object->setEarliestDropOfforPickup($data['EarliestDropOfforPickup']); - unset($data['EarliestDropOfforPickup']); - } - if (\array_key_exists('LatestDropOfforPickup', $data)) { - $object->setLatestDropOfforPickup($data['LatestDropOfforPickup']); - unset($data['LatestDropOfforPickup']); - } - if (\array_key_exists('OpenHours', $data)) { - $object->setOpenHours($data['OpenHours']); - unset($data['OpenHours']); - } - if (\array_key_exists('CloseHours', $data)) { - $object->setCloseHours($data['CloseHours']); - unset($data['CloseHours']); - } - if (\array_key_exists('PrepTime', $data)) { - $object->setPrepTime($data['PrepTime']); - unset($data['PrepTime']); - } - if (\array_key_exists('LastDrop', $data)) { - $object->setLastDrop($data['LastDrop']); - unset($data['LastDrop']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Day'] = $data->getDay(); + if ($data->isInitialized('earliestDropOfforPickup') && null !== $data->getEarliestDropOfforPickup()) { + $dataArray['EarliestDropOfforPickup'] = $data->getEarliestDropOfforPickup(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Day'] = $object->getDay(); - if ($object->isInitialized('earliestDropOfforPickup') && null !== $object->getEarliestDropOfforPickup()) { - $data['EarliestDropOfforPickup'] = $object->getEarliestDropOfforPickup(); - } - if ($object->isInitialized('latestDropOfforPickup') && null !== $object->getLatestDropOfforPickup()) { - $data['LatestDropOfforPickup'] = $object->getLatestDropOfforPickup(); - } - $data['OpenHours'] = $object->getOpenHours(); - $data['CloseHours'] = $object->getCloseHours(); - if ($object->isInitialized('prepTime') && null !== $object->getPrepTime()) { - $data['PrepTime'] = $object->getPrepTime(); - } - if ($object->isInitialized('lastDrop') && null !== $object->getLastDrop()) { - $data['LastDrop'] = $object->getLastDrop(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('latestDropOfforPickup') && null !== $data->getLatestDropOfforPickup()) { + $dataArray['LatestDropOfforPickup'] = $data->getLatestDropOfforPickup(); + } + $dataArray['OpenHours'] = $data->getOpenHours(); + $dataArray['CloseHours'] = $data->getCloseHours(); + if ($data->isInitialized('prepTime') && null !== $data->getPrepTime()) { + $dataArray['PrepTime'] = $data->getPrepTime(); + } + if ($data->isInitialized('lastDrop') && null !== $data->getLastDrop()) { + $dataArray['LastDrop'] = $data->getLastDrop(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupFacilitiesFacilityTimeNormalizer.php b/src/Api/Normalizer/PickupFacilitiesFacilityTimeNormalizer.php index a64fbf6f..0fe83dad 100644 --- a/src/Api/Normalizer/PickupFacilitiesFacilityTimeNormalizer.php +++ b/src/Api/Normalizer/PickupFacilitiesFacilityTimeNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupFacilitiesFacilityTimeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupFacilitiesFacilityTimeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class; + return $type === \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DayOfWeek', $data)) { - $object->setDayOfWeek($this->denormalizer->denormalize($data['DayOfWeek'], \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class, 'json', $context)); - unset($data['DayOfWeek']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['DayOfWeek'] = $this->normalizer->normalize($object->getDayOfWeek(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DayOfWeek', $data)) { + $object->setDayOfWeek($this->denormalizer->denormalize($data['DayOfWeek'], \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class, 'json', $context)); + unset($data['DayOfWeek']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PickupFacilitiesFacilityTimeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['DayOfWeek'] = $this->normalizer->normalize($data->getDayOfWeek(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('DayOfWeek', $data)) { - $object->setDayOfWeek($this->denormalizer->denormalize($data['DayOfWeek'], \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTimeDayOfWeek::class, 'json', $context)); - unset($data['DayOfWeek']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['DayOfWeek'] = $this->normalizer->normalize($object->getDayOfWeek(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupGetPoliticalDivision1ListRequestNormalizer.php b/src/Api/Normalizer/PickupGetPoliticalDivision1ListRequestNormalizer.php index ddda1505..ff983799 100644 --- a/src/Api/Normalizer/PickupGetPoliticalDivision1ListRequestNormalizer.php +++ b/src/Api/Normalizer/PickupGetPoliticalDivision1ListRequestNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetPoliticalDivision1ListRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupGetPoliticalDivision1ListRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class; + return $type === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class => false]; - } - } -} else { - class PickupGetPoliticalDivision1ListRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class, 'json', $context)); + unset($data['Request']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupGetPoliticalDivision1ListRequestRequestNormalizer.php b/src/Api/Normalizer/PickupGetPoliticalDivision1ListRequestRequestNormalizer.php index 970981c0..52a1f68f 100644 --- a/src/Api/Normalizer/PickupGetPoliticalDivision1ListRequestRequestNormalizer.php +++ b/src/Api/Normalizer/PickupGetPoliticalDivision1ListRequestRequestNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetPoliticalDivision1ListRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupGetPoliticalDivision1ListRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PickupGetPoliticalDivision1ListRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupGetPoliticalDivision1ListResponseNormalizer.php b/src/Api/Normalizer/PickupGetPoliticalDivision1ListResponseNormalizer.php index e47044f4..a4463f38 100644 --- a/src/Api/Normalizer/PickupGetPoliticalDivision1ListResponseNormalizer.php +++ b/src/Api/Normalizer/PickupGetPoliticalDivision1ListResponseNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetPoliticalDivision1ListResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupGetPoliticalDivision1ListResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class; + return $type === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $values = []; - foreach ($data['PoliticalDivision1'] as $value) { - $values[] = $value; - } - $object->setPoliticalDivision1($values); - unset($data['PoliticalDivision1']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('politicalDivision1') && null !== $object->getPoliticalDivision1()) { - $values = []; - foreach ($object->getPoliticalDivision1() as $value) { - $values[] = $value; - } - $data['PoliticalDivision1'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class, 'json', $context)); + unset($data['Response']); + } + if (\array_key_exists('PoliticalDivision1', $data)) { + $values = []; + foreach ($data['PoliticalDivision1'] as $value) { + $values[] = $value; } - return $data; + $object->setPoliticalDivision1($values); + unset($data['PoliticalDivision1']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PickupGetPoliticalDivision1ListResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + if ($data->isInitialized('politicalDivision1') && null !== $data->getPoliticalDivision1()) { + $values = []; + foreach ($data->getPoliticalDivision1() as $value) { + $values[] = $value; + } + $dataArray['PoliticalDivision1'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class, 'json', $context)); - unset($data['Response']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('PoliticalDivision1', $data)) { - $values = []; - foreach ($data['PoliticalDivision1'] as $value) { - $values[] = $value; - } - $object->setPoliticalDivision1($values); - unset($data['PoliticalDivision1']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('politicalDivision1') && null !== $object->getPoliticalDivision1()) { - $values = []; - foreach ($object->getPoliticalDivision1() as $value) { - $values[] = $value; - } - $data['PoliticalDivision1'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupGetPoliticalDivision1ListResponseResponseNormalizer.php b/src/Api/Normalizer/PickupGetPoliticalDivision1ListResponseResponseNormalizer.php index b80c0549..ec286539 100644 --- a/src/Api/Normalizer/PickupGetPoliticalDivision1ListResponseResponseNormalizer.php +++ b/src/Api/Normalizer/PickupGetPoliticalDivision1ListResponseResponseNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetPoliticalDivision1ListResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupGetPoliticalDivision1ListResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class => false]; + if (\array_key_exists('Alert', $data)) { + $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); + unset($data['Alert']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupGetPoliticalDivision1ListResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $dataArray['Alert'] = $this->normalizer->normalize($data->getAlert(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupGetPoliticalDivision1ListResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestDestinationAddressNormalizer.php b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestDestinationAddressNormalizer.php index 42758b52..ea561c49 100644 --- a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestDestinationAddressNormalizer.php +++ b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestDestinationAddressNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetServiceCenterFacilitiesRequestDestinationAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupGetServiceCenterFacilitiesRequestDestinationAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class; + return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['StateProvince'] = $object->getStateProvince(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvince', $data)) { + $object->setStateProvince($data['StateProvince']); + unset($data['StateProvince']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class => false]; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupGetServiceCenterFacilitiesRequestDestinationAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class; + $dataArray = []; + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class; + if ($data->isInitialized('stateProvince') && null !== $data->getStateProvince()) { + $dataArray['StateProvince'] = $data->getStateProvince(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['StateProvince'] = $object->getStateProvince(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestNormalizer.php b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestNormalizer.php index f2ca08e6..a006a799 100644 --- a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestNormalizer.php +++ b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestNormalizer.php @@ -5,204 +5,101 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetServiceCenterFacilitiesRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupGetServiceCenterFacilitiesRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class; + return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('PickupPiece', $data)) { - $values = []; - foreach ($data['PickupPiece'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class, 'json', $context); - } - $object->setPickupPiece($values); - unset($data['PickupPiece']); - } - if (\array_key_exists('OriginAddress', $data)) { - $object->setOriginAddress($this->denormalizer->denormalize($data['OriginAddress'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class, 'json', $context)); - unset($data['OriginAddress']); - } - if (\array_key_exists('DestinationAddress', $data)) { - $object->setDestinationAddress($this->denormalizer->denormalize($data['DestinationAddress'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class, 'json', $context)); - unset($data['DestinationAddress']); - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - if (\array_key_exists('ProximitySearchIndicator', $data)) { - $object->setProximitySearchIndicator($data['ProximitySearchIndicator']); - unset($data['ProximitySearchIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class, 'json', $context)); + unset($data['Request']); + } + if (\array_key_exists('PickupPiece', $data)) { $values = []; - foreach ($object->getPickupPiece() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PickupPiece'] = $values; - if ($object->isInitialized('originAddress') && null !== $object->getOriginAddress()) { - $data['OriginAddress'] = $this->normalizer->normalize($object->getOriginAddress(), 'json', $context); - } - if ($object->isInitialized('destinationAddress') && null !== $object->getDestinationAddress()) { - $data['DestinationAddress'] = $this->normalizer->normalize($object->getDestinationAddress(), 'json', $context); + foreach ($data['PickupPiece'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class, 'json', $context); } - $data['Locale'] = $object->getLocale(); - if ($object->isInitialized('proximitySearchIndicator') && null !== $object->getProximitySearchIndicator()) { - $data['ProximitySearchIndicator'] = $object->getProximitySearchIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setPickupPiece($values); + unset($data['PickupPiece']); + } + if (\array_key_exists('OriginAddress', $data)) { + $object->setOriginAddress($this->denormalizer->denormalize($data['OriginAddress'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class, 'json', $context)); + unset($data['OriginAddress']); + } + if (\array_key_exists('DestinationAddress', $data)) { + $object->setDestinationAddress($this->denormalizer->denormalize($data['DestinationAddress'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class, 'json', $context)); + unset($data['DestinationAddress']); + } + if (\array_key_exists('Locale', $data)) { + $object->setLocale($data['Locale']); + unset($data['Locale']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class => false]; + if (\array_key_exists('ProximitySearchIndicator', $data)) { + $object->setProximitySearchIndicator($data['ProximitySearchIndicator']); + unset($data['ProximitySearchIndicator']); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class PickupGetServiceCenterFacilitiesRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class; + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $values = []; + foreach ($data->getPickupPiece() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class; + $dataArray['PickupPiece'] = $values; + if ($data->isInitialized('originAddress') && null !== $data->getOriginAddress()) { + $dataArray['OriginAddress'] = $this->normalizer->normalize($data->getOriginAddress(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('PickupPiece', $data)) { - $values = []; - foreach ($data['PickupPiece'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class, 'json', $context); - } - $object->setPickupPiece($values); - unset($data['PickupPiece']); - } - if (\array_key_exists('OriginAddress', $data)) { - $object->setOriginAddress($this->denormalizer->denormalize($data['OriginAddress'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class, 'json', $context)); - unset($data['OriginAddress']); - } - if (\array_key_exists('DestinationAddress', $data)) { - $object->setDestinationAddress($this->denormalizer->denormalize($data['DestinationAddress'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestDestinationAddress::class, 'json', $context)); - unset($data['DestinationAddress']); - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - if (\array_key_exists('ProximitySearchIndicator', $data)) { - $object->setProximitySearchIndicator($data['ProximitySearchIndicator']); - unset($data['ProximitySearchIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('destinationAddress') && null !== $data->getDestinationAddress()) { + $dataArray['DestinationAddress'] = $this->normalizer->normalize($data->getDestinationAddress(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $values = []; - foreach ($object->getPickupPiece() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PickupPiece'] = $values; - if ($object->isInitialized('originAddress') && null !== $object->getOriginAddress()) { - $data['OriginAddress'] = $this->normalizer->normalize($object->getOriginAddress(), 'json', $context); - } - if ($object->isInitialized('destinationAddress') && null !== $object->getDestinationAddress()) { - $data['DestinationAddress'] = $this->normalizer->normalize($object->getDestinationAddress(), 'json', $context); - } - $data['Locale'] = $object->getLocale(); - if ($object->isInitialized('proximitySearchIndicator') && null !== $object->getProximitySearchIndicator()) { - $data['ProximitySearchIndicator'] = $object->getProximitySearchIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $dataArray['Locale'] = $data->getLocale(); + if ($data->isInitialized('proximitySearchIndicator') && null !== $data->getProximitySearchIndicator()) { + $dataArray['ProximitySearchIndicator'] = $data->getProximitySearchIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestOriginAddressNormalizer.php b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestOriginAddressNormalizer.php index 1829e3d6..0e2cc7c0 100644 --- a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestOriginAddressNormalizer.php +++ b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestOriginAddressNormalizer.php @@ -5,196 +5,97 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetServiceCenterFacilitiesRequestOriginAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupGetServiceCenterFacilitiesRequestOriginAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('StreetAddress', $data)) { - $object->setStreetAddress($data['StreetAddress']); - unset($data['StreetAddress']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('OriginSearchCriteria', $data)) { - $object->setOriginSearchCriteria($this->denormalizer->denormalize($data['OriginSearchCriteria'], \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class, 'json', $context)); - unset($data['OriginSearchCriteria']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('streetAddress') && null !== $object->getStreetAddress()) { - $data['StreetAddress'] = $object->getStreetAddress(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['StateProvince'] = $object->getStateProvince(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - if ($object->isInitialized('originSearchCriteria') && null !== $object->getOriginSearchCriteria()) { - $data['OriginSearchCriteria'] = $this->normalizer->normalize($object->getOriginSearchCriteria(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('StreetAddress', $data)) { + $object->setStreetAddress($data['StreetAddress']); + unset($data['StreetAddress']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvince', $data)) { + $object->setStateProvince($data['StateProvince']); + unset($data['StateProvince']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class => false]; + if (\array_key_exists('OriginSearchCriteria', $data)) { + $object->setOriginSearchCriteria($this->denormalizer->denormalize($data['OriginSearchCriteria'], \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class, 'json', $context)); + unset($data['OriginSearchCriteria']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupGetServiceCenterFacilitiesRequestOriginAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('StreetAddress', $data)) { - $object->setStreetAddress($data['StreetAddress']); - unset($data['StreetAddress']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('OriginSearchCriteria', $data)) { - $object->setOriginSearchCriteria($this->denormalizer->denormalize($data['OriginSearchCriteria'], \ShipStream\Ups\Api\Model\OriginAddressOriginSearchCriteria::class, 'json', $context)); - unset($data['OriginSearchCriteria']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('streetAddress') && null !== $data->getStreetAddress()) { + $dataArray['StreetAddress'] = $data->getStreetAddress(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('streetAddress') && null !== $object->getStreetAddress()) { - $data['StreetAddress'] = $object->getStreetAddress(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvince') && null !== $object->getStateProvince()) { - $data['StateProvince'] = $object->getStateProvince(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - if ($object->isInitialized('originSearchCriteria') && null !== $object->getOriginSearchCriteria()) { - $data['OriginSearchCriteria'] = $this->normalizer->normalize($object->getOriginSearchCriteria(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class => false]; + if ($data->isInitialized('stateProvince') && null !== $data->getStateProvince()) { + $dataArray['StateProvince'] = $data->getStateProvince(); } + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); + } + $dataArray['CountryCode'] = $data->getCountryCode(); + if ($data->isInitialized('originSearchCriteria') && null !== $data->getOriginSearchCriteria()) { + $dataArray['OriginSearchCriteria'] = $this->normalizer->normalize($data->getOriginSearchCriteria(), 'json', $context); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestOriginAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestPickupPieceNormalizer.php b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestPickupPieceNormalizer.php index 84fd1106..0b01244a 100644 --- a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestPickupPieceNormalizer.php +++ b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestPickupPieceNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetServiceCenterFacilitiesRequestPickupPieceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupGetServiceCenterFacilitiesRequestPickupPieceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class; + return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ServiceCode', $data)) { - $object->setServiceCode($data['ServiceCode']); - unset($data['ServiceCode']); - } - if (\array_key_exists('ContainerCode', $data)) { - $object->setContainerCode($data['ContainerCode']); - unset($data['ContainerCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ServiceCode'] = $object->getServiceCode(); - $data['ContainerCode'] = $object->getContainerCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class => false]; - } - } -} else { - class PickupGetServiceCenterFacilitiesRequestPickupPieceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class; + if (\array_key_exists('ServiceCode', $data)) { + $object->setServiceCode($data['ServiceCode']); + unset($data['ServiceCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class; + if (\array_key_exists('ContainerCode', $data)) { + $object->setContainerCode($data['ContainerCode']); + unset($data['ContainerCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ServiceCode', $data)) { - $object->setServiceCode($data['ServiceCode']); - unset($data['ServiceCode']); - } - if (\array_key_exists('ContainerCode', $data)) { - $object->setContainerCode($data['ContainerCode']); - unset($data['ContainerCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ServiceCode'] = $object->getServiceCode(); - $data['ContainerCode'] = $object->getContainerCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ServiceCode'] = $data->getServiceCode(); + $dataArray['ContainerCode'] = $data->getContainerCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestPickupPiece::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestRequestNormalizer.php b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestRequestNormalizer.php index e6f3ac7b..080c81c2 100644 --- a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestRequestNormalizer.php +++ b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesRequestRequestNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetServiceCenterFacilitiesRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupGetServiceCenterFacilitiesRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PickupGetServiceCenterFacilitiesRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesResponseNormalizer.php b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesResponseNormalizer.php index 6e107e42..4395c855 100644 --- a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesResponseNormalizer.php +++ b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesResponseNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetServiceCenterFacilitiesResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupGetServiceCenterFacilitiesResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class; + return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('ServiceCenterLocation', $data)) { - $object->setServiceCenterLocation($this->denormalizer->denormalize($data['ServiceCenterLocation'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class, 'json', $context)); - unset($data['ServiceCenterLocation']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['ServiceCenterLocation'] = $this->normalizer->normalize($object->getServiceCenterLocation(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class => false]; - } - } -} else { - class PickupGetServiceCenterFacilitiesResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class, 'json', $context)); + unset($data['Response']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class; + if (\array_key_exists('ServiceCenterLocation', $data)) { + $object->setServiceCenterLocation($this->denormalizer->denormalize($data['ServiceCenterLocation'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class, 'json', $context)); + unset($data['ServiceCenterLocation']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('ServiceCenterLocation', $data)) { - $object->setServiceCenterLocation($this->denormalizer->denormalize($data['ServiceCenterLocation'], \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class, 'json', $context)); - unset($data['ServiceCenterLocation']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['ServiceCenterLocation'] = $this->normalizer->normalize($object->getServiceCenterLocation(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + $dataArray['ServiceCenterLocation'] = $this->normalizer->normalize($data->getServiceCenterLocation(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesResponseResponseNormalizer.php b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesResponseResponseNormalizer.php index 186838b8..a2524b08 100644 --- a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesResponseResponseNormalizer.php +++ b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesResponseResponseNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetServiceCenterFacilitiesResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupGetServiceCenterFacilitiesResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class => false]; + if (\array_key_exists('Alert', $data)) { + $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); + unset($data['Alert']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupGetServiceCenterFacilitiesResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $dataArray['Alert'] = $this->normalizer->normalize($data->getAlert(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer.php b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer.php index 48b46a48..ed3cc18a 100644 --- a/src/Api/Normalizer/PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer.php +++ b/src/Api/Normalizer/PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer.php @@ -5,160 +5,79 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class; + return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DropOffFacilities', $data)) { - $values = []; - foreach ($data['DropOffFacilities'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class, 'json', $context); - } - $object->setDropOffFacilities($values); - unset($data['DropOffFacilities']); - } - if (\array_key_exists('PickupFacilities', $data)) { - $object->setPickupFacilities($this->denormalizer->denormalize($data['PickupFacilities'], \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class, 'json', $context)); - unset($data['PickupFacilities']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('dropOffFacilities') && null !== $object->getDropOffFacilities()) { - $values = []; - foreach ($object->getDropOffFacilities() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['DropOffFacilities'] = $values; - } - if ($object->isInitialized('pickupFacilities') && null !== $object->getPickupFacilities()) { - $data['PickupFacilities'] = $this->normalizer->normalize($object->getPickupFacilities(), 'json', $context); + if (\array_key_exists('DropOffFacilities', $data)) { + $values = []; + foreach ($data['DropOffFacilities'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class, 'json', $context); } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setDropOffFacilities($values); + unset($data['DropOffFacilities']); + } + if (\array_key_exists('PickupFacilities', $data)) { + $object->setPickupFacilities($this->denormalizer->denormalize($data['PickupFacilities'], \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class, 'json', $context)); + unset($data['PickupFacilities']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DropOffFacilities', $data)) { - $values = []; - foreach ($data['DropOffFacilities'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class, 'json', $context); - } - $object->setDropOffFacilities($values); - unset($data['DropOffFacilities']); - } - if (\array_key_exists('PickupFacilities', $data)) { - $object->setPickupFacilities($this->denormalizer->denormalize($data['PickupFacilities'], \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class, 'json', $context)); - unset($data['PickupFacilities']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + $dataArray = []; + if ($data->isInitialized('dropOffFacilities') && null !== $data->getDropOffFacilities()) { + $values = []; + foreach ($data->getDropOffFacilities() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['DropOffFacilities'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('dropOffFacilities') && null !== $object->getDropOffFacilities()) { - $values = []; - foreach ($object->getDropOffFacilities() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['DropOffFacilities'] = $values; - } - if ($object->isInitialized('pickupFacilities') && null !== $object->getPickupFacilities()) { - $data['PickupFacilities'] = $this->normalizer->normalize($object->getPickupFacilities(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('pickupFacilities') && null !== $data->getPickupFacilities()) { + $dataArray['PickupFacilities'] = $this->normalizer->normalize($data->getPickupFacilities(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupGetServiceCenterFacilitiesResponseServiceCenterLocation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupNotificationsEMailNotificationNormalizer.php b/src/Api/Normalizer/PickupNotificationsEMailNotificationNormalizer.php index ccafe80e..31fe25c9 100644 --- a/src/Api/Normalizer/PickupNotificationsEMailNotificationNormalizer.php +++ b/src/Api/Normalizer/PickupNotificationsEMailNotificationNormalizer.php @@ -5,160 +5,79 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupNotificationsEMailNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupNotificationsEMailNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class; + return $type === \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('EventType', $data)) { - $values = []; - foreach ($data['EventType'] as $value) { - $values[] = $value; - } - $object->setEventType($values); - unset($data['EventType']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('eventType') && null !== $object->getEventType()) { - $values = []; - foreach ($object->getEventType() as $value) { - $values[] = $value; - } - $data['EventType'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); + } + if (\array_key_exists('EventType', $data)) { + $values = []; + foreach ($data['EventType'] as $value) { + $values[] = $value; } - return $data; + $object->setEventType($values); + unset($data['EventType']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PickupNotificationsEMailNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class; + $dataArray = []; + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('EventType', $data)) { - $values = []; - foreach ($data['EventType'] as $value) { - $values[] = $value; - } - $object->setEventType($values); - unset($data['EventType']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + if ($data->isInitialized('eventType') && null !== $data->getEventType()) { + $values = []; + foreach ($data->getEventType() as $value) { + $values[] = $value; } - return $object; + $dataArray['EventType'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - if ($object->isInitialized('eventType') && null !== $object->getEventType()) { - $values = []; - foreach ($object->getEventType() as $value) { - $values[] = $value; - } - $data['EventType'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupNotificationsEMailNotification::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupPendingStatusRequestNormalizer.php b/src/Api/Normalizer/PickupPendingStatusRequestNormalizer.php index 8310fc3e..45594b87 100644 --- a/src/Api/Normalizer/PickupPendingStatusRequestNormalizer.php +++ b/src/Api/Normalizer/PickupPendingStatusRequestNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupPendingStatusRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupPendingStatusRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class; + return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('PickupType', $data)) { - $object->setPickupType($data['PickupType']); - unset($data['PickupType']); - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['PickupType'] = $object->getPickupType(); - $data['AccountNumber'] = $object->getAccountNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class, 'json', $context)); + unset($data['Request']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class => false]; + if (\array_key_exists('PickupType', $data)) { + $object->setPickupType($data['PickupType']); + unset($data['PickupType']); } - } -} else { - class PickupPendingStatusRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class; + if (\array_key_exists('AccountNumber', $data)) { + $object->setAccountNumber($data['AccountNumber']); + unset($data['AccountNumber']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('PickupType', $data)) { - $object->setPickupType($data['PickupType']); - unset($data['PickupType']); - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['PickupType'] = $object->getPickupType(); - $data['AccountNumber'] = $object->getAccountNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['PickupType'] = $data->getPickupType(); + $dataArray['AccountNumber'] = $data->getAccountNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupPendingStatusRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupPendingStatusRequestRequestNormalizer.php b/src/Api/Normalizer/PickupPendingStatusRequestRequestNormalizer.php index 31585f29..d146f8ec 100644 --- a/src/Api/Normalizer/PickupPendingStatusRequestRequestNormalizer.php +++ b/src/Api/Normalizer/PickupPendingStatusRequestRequestNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupPendingStatusRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupPendingStatusRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PickupPendingStatusRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupPendingStatusRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupPendingStatusResponseNormalizer.php b/src/Api/Normalizer/PickupPendingStatusResponseNormalizer.php index 4f365968..aa779b5b 100644 --- a/src/Api/Normalizer/PickupPendingStatusResponseNormalizer.php +++ b/src/Api/Normalizer/PickupPendingStatusResponseNormalizer.php @@ -5,152 +5,75 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupPendingStatusResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupPendingStatusResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class; + return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('PendingStatus', $data)) { - $values = []; - foreach ($data['PendingStatus'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class, 'json', $context); - } - $object->setPendingStatus($values); - unset($data['PendingStatus']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class, 'json', $context)); + unset($data['Response']); + } + if (\array_key_exists('PendingStatus', $data)) { $values = []; - foreach ($object->getPendingStatus() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['PendingStatus'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class, 'json', $context); } - $data['PendingStatus'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setPendingStatus($values); + unset($data['PendingStatus']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PickupPendingStatusResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + $values = []; + foreach ($data->getPendingStatus() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['PendingStatus'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('PendingStatus', $data)) { - $values = []; - foreach ($data['PendingStatus'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class, 'json', $context); - } - $object->setPendingStatus($values); - unset($data['PendingStatus']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $values = []; - foreach ($object->getPendingStatus() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PendingStatus'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupPendingStatusResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupPendingStatusResponsePendingStatusNormalizer.php b/src/Api/Normalizer/PickupPendingStatusResponsePendingStatusNormalizer.php index f3fd290a..3162c084 100644 --- a/src/Api/Normalizer/PickupPendingStatusResponsePendingStatusNormalizer.php +++ b/src/Api/Normalizer/PickupPendingStatusResponsePendingStatusNormalizer.php @@ -5,226 +5,112 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupPendingStatusResponsePendingStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupPendingStatusResponsePendingStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupType', $data)) { - $object->setPickupType($data['PickupType']); - unset($data['PickupType']); - } - if (\array_key_exists('ServiceDate', $data)) { - $object->setServiceDate($data['ServiceDate']); - unset($data['ServiceDate']); - } - if (\array_key_exists('PRN', $data)) { - $object->setPRN($data['PRN']); - unset($data['PRN']); - } - if (\array_key_exists('GWNStatusCode', $data)) { - $object->setGWNStatusCode($data['GWNStatusCode']); - unset($data['GWNStatusCode']); - } - if (\array_key_exists('OnCallStatusCode', $data)) { - $object->setOnCallStatusCode($data['OnCallStatusCode']); - unset($data['OnCallStatusCode']); - } - if (\array_key_exists('PickupStatusMessage', $data)) { - $object->setPickupStatusMessage($data['PickupStatusMessage']); - unset($data['PickupStatusMessage']); - } - if (\array_key_exists('BillingCode', $data)) { - $object->setBillingCode($data['BillingCode']); - unset($data['BillingCode']); - } - if (\array_key_exists('ContactName', $data)) { - $object->setContactName($data['ContactName']); - unset($data['ContactName']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $object->setReferenceNumber($data['ReferenceNumber']); - unset($data['ReferenceNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupType'] = $object->getPickupType(); - $data['ServiceDate'] = $object->getServiceDate(); - $data['PRN'] = $object->getPRN(); - if ($object->isInitialized('gWNStatusCode') && null !== $object->getGWNStatusCode()) { - $data['GWNStatusCode'] = $object->getGWNStatusCode(); - } - if ($object->isInitialized('onCallStatusCode') && null !== $object->getOnCallStatusCode()) { - $data['OnCallStatusCode'] = $object->getOnCallStatusCode(); - } - $data['PickupStatusMessage'] = $object->getPickupStatusMessage(); - if ($object->isInitialized('billingCode') && null !== $object->getBillingCode()) { - $data['BillingCode'] = $object->getBillingCode(); - } - if ($object->isInitialized('contactName') && null !== $object->getContactName()) { - $data['ContactName'] = $object->getContactName(); - } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $data['ReferenceNumber'] = $object->getReferenceNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupType', $data)) { + $object->setPickupType($data['PickupType']); + unset($data['PickupType']); + } + if (\array_key_exists('ServiceDate', $data)) { + $object->setServiceDate($data['ServiceDate']); + unset($data['ServiceDate']); + } + if (\array_key_exists('PRN', $data)) { + $object->setPRN($data['PRN']); + unset($data['PRN']); + } + if (\array_key_exists('GWNStatusCode', $data)) { + $object->setGWNStatusCode($data['GWNStatusCode']); + unset($data['GWNStatusCode']); + } + if (\array_key_exists('OnCallStatusCode', $data)) { + $object->setOnCallStatusCode($data['OnCallStatusCode']); + unset($data['OnCallStatusCode']); + } + if (\array_key_exists('PickupStatusMessage', $data)) { + $object->setPickupStatusMessage($data['PickupStatusMessage']); + unset($data['PickupStatusMessage']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class => false]; + if (\array_key_exists('BillingCode', $data)) { + $object->setBillingCode($data['BillingCode']); + unset($data['BillingCode']); } + if (\array_key_exists('ContactName', $data)) { + $object->setContactName($data['ContactName']); + unset($data['ContactName']); + } + if (\array_key_exists('ReferenceNumber', $data)) { + $object->setReferenceNumber($data['ReferenceNumber']); + unset($data['ReferenceNumber']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupPendingStatusResponsePendingStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupType', $data)) { - $object->setPickupType($data['PickupType']); - unset($data['PickupType']); - } - if (\array_key_exists('ServiceDate', $data)) { - $object->setServiceDate($data['ServiceDate']); - unset($data['ServiceDate']); - } - if (\array_key_exists('PRN', $data)) { - $object->setPRN($data['PRN']); - unset($data['PRN']); - } - if (\array_key_exists('GWNStatusCode', $data)) { - $object->setGWNStatusCode($data['GWNStatusCode']); - unset($data['GWNStatusCode']); - } - if (\array_key_exists('OnCallStatusCode', $data)) { - $object->setOnCallStatusCode($data['OnCallStatusCode']); - unset($data['OnCallStatusCode']); - } - if (\array_key_exists('PickupStatusMessage', $data)) { - $object->setPickupStatusMessage($data['PickupStatusMessage']); - unset($data['PickupStatusMessage']); - } - if (\array_key_exists('BillingCode', $data)) { - $object->setBillingCode($data['BillingCode']); - unset($data['BillingCode']); - } - if (\array_key_exists('ContactName', $data)) { - $object->setContactName($data['ContactName']); - unset($data['ContactName']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $object->setReferenceNumber($data['ReferenceNumber']); - unset($data['ReferenceNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['PickupType'] = $data->getPickupType(); + $dataArray['ServiceDate'] = $data->getServiceDate(); + $dataArray['PRN'] = $data->getPRN(); + if ($data->isInitialized('gWNStatusCode') && null !== $data->getGWNStatusCode()) { + $dataArray['GWNStatusCode'] = $data->getGWNStatusCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupType'] = $object->getPickupType(); - $data['ServiceDate'] = $object->getServiceDate(); - $data['PRN'] = $object->getPRN(); - if ($object->isInitialized('gWNStatusCode') && null !== $object->getGWNStatusCode()) { - $data['GWNStatusCode'] = $object->getGWNStatusCode(); - } - if ($object->isInitialized('onCallStatusCode') && null !== $object->getOnCallStatusCode()) { - $data['OnCallStatusCode'] = $object->getOnCallStatusCode(); - } - $data['PickupStatusMessage'] = $object->getPickupStatusMessage(); - if ($object->isInitialized('billingCode') && null !== $object->getBillingCode()) { - $data['BillingCode'] = $object->getBillingCode(); - } - if ($object->isInitialized('contactName') && null !== $object->getContactName()) { - $data['ContactName'] = $object->getContactName(); - } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $data['ReferenceNumber'] = $object->getReferenceNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('onCallStatusCode') && null !== $data->getOnCallStatusCode()) { + $dataArray['OnCallStatusCode'] = $data->getOnCallStatusCode(); + } + $dataArray['PickupStatusMessage'] = $data->getPickupStatusMessage(); + if ($data->isInitialized('billingCode') && null !== $data->getBillingCode()) { + $dataArray['BillingCode'] = $data->getBillingCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class => false]; + if ($data->isInitialized('contactName') && null !== $data->getContactName()) { + $dataArray['ContactName'] = $data->getContactName(); } + if ($data->isInitialized('referenceNumber') && null !== $data->getReferenceNumber()) { + $dataArray['ReferenceNumber'] = $data->getReferenceNumber(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupPendingStatusResponsePendingStatus::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupPendingStatusResponseResponseNormalizer.php b/src/Api/Normalizer/PickupPendingStatusResponseResponseNormalizer.php index 8f2f5533..03bfa8fd 100644 --- a/src/Api/Normalizer/PickupPendingStatusResponseResponseNormalizer.php +++ b/src/Api/Normalizer/PickupPendingStatusResponseResponseNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupPendingStatusResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupPendingStatusResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class => false]; + if (\array_key_exists('Alert', $data)) { + $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); + unset($data['Alert']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupPendingStatusResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $dataArray['Alert'] = $this->normalizer->normalize($data->getAlert(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupPendingStatusResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupRateRequestNormalizer.php b/src/Api/Normalizer/PickupRateRequestNormalizer.php index f497e954..80d18699 100644 --- a/src/Api/Normalizer/PickupRateRequestNormalizer.php +++ b/src/Api/Normalizer/PickupRateRequestNormalizer.php @@ -5,226 +5,112 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupRateRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupRateRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequest::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('ShipperAccount', $data)) { - $object->setShipperAccount($this->denormalizer->denormalize($data['ShipperAccount'], \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class, 'json', $context)); - unset($data['ShipperAccount']); - } - if (\array_key_exists('PickupAddress', $data)) { - $object->setPickupAddress($this->denormalizer->denormalize($data['PickupAddress'], \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class, 'json', $context)); - unset($data['PickupAddress']); - } - if (\array_key_exists('AlternateAddressIndicator', $data)) { - $object->setAlternateAddressIndicator($data['AlternateAddressIndicator']); - unset($data['AlternateAddressIndicator']); - } - if (\array_key_exists('ServiceDateOption', $data)) { - $object->setServiceDateOption($data['ServiceDateOption']); - unset($data['ServiceDateOption']); - } - if (\array_key_exists('PickupDateInfo', $data)) { - $object->setPickupDateInfo($this->denormalizer->denormalize($data['PickupDateInfo'], \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class, 'json', $context)); - unset($data['PickupDateInfo']); - } - if (\array_key_exists('RateChartType', $data)) { - $object->setRateChartType($data['RateChartType']); - unset($data['RateChartType']); - } - if (\array_key_exists('TaxInformationIndicator', $data)) { - $object->setTaxInformationIndicator($data['TaxInformationIndicator']); - unset($data['TaxInformationIndicator']); - } - if (\array_key_exists('UserLevelDiscountIndicator', $data)) { - $object->setUserLevelDiscountIndicator($data['UserLevelDiscountIndicator']); - unset($data['UserLevelDiscountIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\PickupRateRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PickupRateRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('shipperAccount') && null !== $object->getShipperAccount()) { - $data['ShipperAccount'] = $this->normalizer->normalize($object->getShipperAccount(), 'json', $context); - } - $data['PickupAddress'] = $this->normalizer->normalize($object->getPickupAddress(), 'json', $context); - $data['AlternateAddressIndicator'] = $object->getAlternateAddressIndicator(); - $data['ServiceDateOption'] = $object->getServiceDateOption(); - if ($object->isInitialized('pickupDateInfo') && null !== $object->getPickupDateInfo()) { - $data['PickupDateInfo'] = $this->normalizer->normalize($object->getPickupDateInfo(), 'json', $context); - } - if ($object->isInitialized('rateChartType') && null !== $object->getRateChartType()) { - $data['RateChartType'] = $object->getRateChartType(); - } - if ($object->isInitialized('taxInformationIndicator') && null !== $object->getTaxInformationIndicator()) { - $data['TaxInformationIndicator'] = $object->getTaxInformationIndicator(); - } - if ($object->isInitialized('userLevelDiscountIndicator') && null !== $object->getUserLevelDiscountIndicator()) { - $data['UserLevelDiscountIndicator'] = $object->getUserLevelDiscountIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class, 'json', $context)); + unset($data['Request']); + } + if (\array_key_exists('ShipperAccount', $data)) { + $object->setShipperAccount($this->denormalizer->denormalize($data['ShipperAccount'], \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class, 'json', $context)); + unset($data['ShipperAccount']); + } + if (\array_key_exists('PickupAddress', $data)) { + $object->setPickupAddress($this->denormalizer->denormalize($data['PickupAddress'], \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class, 'json', $context)); + unset($data['PickupAddress']); + } + if (\array_key_exists('AlternateAddressIndicator', $data)) { + $object->setAlternateAddressIndicator($data['AlternateAddressIndicator']); + unset($data['AlternateAddressIndicator']); + } + if (\array_key_exists('ServiceDateOption', $data)) { + $object->setServiceDateOption($data['ServiceDateOption']); + unset($data['ServiceDateOption']); + } + if (\array_key_exists('PickupDateInfo', $data)) { + $object->setPickupDateInfo($this->denormalizer->denormalize($data['PickupDateInfo'], \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class, 'json', $context)); + unset($data['PickupDateInfo']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateRequest::class => false]; + if (\array_key_exists('RateChartType', $data)) { + $object->setRateChartType($data['RateChartType']); + unset($data['RateChartType']); } + if (\array_key_exists('TaxInformationIndicator', $data)) { + $object->setTaxInformationIndicator($data['TaxInformationIndicator']); + unset($data['TaxInformationIndicator']); + } + if (\array_key_exists('UserLevelDiscountIndicator', $data)) { + $object->setUserLevelDiscountIndicator($data['UserLevelDiscountIndicator']); + unset($data['UserLevelDiscountIndicator']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupRateRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('ShipperAccount', $data)) { - $object->setShipperAccount($this->denormalizer->denormalize($data['ShipperAccount'], \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class, 'json', $context)); - unset($data['ShipperAccount']); - } - if (\array_key_exists('PickupAddress', $data)) { - $object->setPickupAddress($this->denormalizer->denormalize($data['PickupAddress'], \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class, 'json', $context)); - unset($data['PickupAddress']); - } - if (\array_key_exists('AlternateAddressIndicator', $data)) { - $object->setAlternateAddressIndicator($data['AlternateAddressIndicator']); - unset($data['AlternateAddressIndicator']); - } - if (\array_key_exists('ServiceDateOption', $data)) { - $object->setServiceDateOption($data['ServiceDateOption']); - unset($data['ServiceDateOption']); - } - if (\array_key_exists('PickupDateInfo', $data)) { - $object->setPickupDateInfo($this->denormalizer->denormalize($data['PickupDateInfo'], \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class, 'json', $context)); - unset($data['PickupDateInfo']); - } - if (\array_key_exists('RateChartType', $data)) { - $object->setRateChartType($data['RateChartType']); - unset($data['RateChartType']); - } - if (\array_key_exists('TaxInformationIndicator', $data)) { - $object->setTaxInformationIndicator($data['TaxInformationIndicator']); - unset($data['TaxInformationIndicator']); - } - if (\array_key_exists('UserLevelDiscountIndicator', $data)) { - $object->setUserLevelDiscountIndicator($data['UserLevelDiscountIndicator']); - unset($data['UserLevelDiscountIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + if ($data->isInitialized('shipperAccount') && null !== $data->getShipperAccount()) { + $dataArray['ShipperAccount'] = $this->normalizer->normalize($data->getShipperAccount(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('shipperAccount') && null !== $object->getShipperAccount()) { - $data['ShipperAccount'] = $this->normalizer->normalize($object->getShipperAccount(), 'json', $context); - } - $data['PickupAddress'] = $this->normalizer->normalize($object->getPickupAddress(), 'json', $context); - $data['AlternateAddressIndicator'] = $object->getAlternateAddressIndicator(); - $data['ServiceDateOption'] = $object->getServiceDateOption(); - if ($object->isInitialized('pickupDateInfo') && null !== $object->getPickupDateInfo()) { - $data['PickupDateInfo'] = $this->normalizer->normalize($object->getPickupDateInfo(), 'json', $context); - } - if ($object->isInitialized('rateChartType') && null !== $object->getRateChartType()) { - $data['RateChartType'] = $object->getRateChartType(); - } - if ($object->isInitialized('taxInformationIndicator') && null !== $object->getTaxInformationIndicator()) { - $data['TaxInformationIndicator'] = $object->getTaxInformationIndicator(); - } - if ($object->isInitialized('userLevelDiscountIndicator') && null !== $object->getUserLevelDiscountIndicator()) { - $data['UserLevelDiscountIndicator'] = $object->getUserLevelDiscountIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + $dataArray['PickupAddress'] = $this->normalizer->normalize($data->getPickupAddress(), 'json', $context); + $dataArray['AlternateAddressIndicator'] = $data->getAlternateAddressIndicator(); + $dataArray['ServiceDateOption'] = $data->getServiceDateOption(); + if ($data->isInitialized('pickupDateInfo') && null !== $data->getPickupDateInfo()) { + $dataArray['PickupDateInfo'] = $this->normalizer->normalize($data->getPickupDateInfo(), 'json', $context); + } + if ($data->isInitialized('rateChartType') && null !== $data->getRateChartType()) { + $dataArray['RateChartType'] = $data->getRateChartType(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateRequest::class => false]; + if ($data->isInitialized('taxInformationIndicator') && null !== $data->getTaxInformationIndicator()) { + $dataArray['TaxInformationIndicator'] = $data->getTaxInformationIndicator(); } + if ($data->isInitialized('userLevelDiscountIndicator') && null !== $data->getUserLevelDiscountIndicator()) { + $dataArray['UserLevelDiscountIndicator'] = $data->getUserLevelDiscountIndicator(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupRateRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupRateRequestPickupAddressNormalizer.php b/src/Api/Normalizer/PickupRateRequestPickupAddressNormalizer.php index 802cb643..f015a6f6 100644 --- a/src/Api/Normalizer/PickupRateRequestPickupAddressNormalizer.php +++ b/src/Api/Normalizer/PickupRateRequestPickupAddressNormalizer.php @@ -5,180 +5,89 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupRateRequestPickupAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupRateRequestPickupAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class; + return $type === \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialIndicator', $data)) { - $object->setResidentialIndicator($data['ResidentialIndicator']); - unset($data['ResidentialIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $data['AddressLine'] = $object->getAddressLine(); - } - $data['City'] = $object->getCity(); - $data['StateProvince'] = $object->getStateProvince(); - $data['PostalCode'] = $object->getPostalCode(); - $data['CountryCode'] = $object->getCountryCode(); - $data['ResidentialIndicator'] = $object->getResidentialIndicator(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressLine', $data)) { + $object->setAddressLine($data['AddressLine']); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } - } -} else { - class PickupRateRequestPickupAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class; + if (\array_key_exists('StateProvince', $data)) { + $object->setStateProvince($data['StateProvince']); + unset($data['StateProvince']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $object->setAddressLine($data['AddressLine']); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvince', $data)) { - $object->setStateProvince($data['StateProvince']); - unset($data['StateProvince']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialIndicator', $data)) { - $object->setResidentialIndicator($data['ResidentialIndicator']); - unset($data['ResidentialIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $data['AddressLine'] = $object->getAddressLine(); - } - $data['City'] = $object->getCity(); - $data['StateProvince'] = $object->getStateProvince(); - $data['PostalCode'] = $object->getPostalCode(); - $data['CountryCode'] = $object->getCountryCode(); - $data['ResidentialIndicator'] = $object->getResidentialIndicator(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + if (\array_key_exists('ResidentialIndicator', $data)) { + $object->setResidentialIndicator($data['ResidentialIndicator']); + unset($data['ResidentialIndicator']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('addressLine') && null !== $data->getAddressLine()) { + $dataArray['AddressLine'] = $data->getAddressLine(); } + $dataArray['City'] = $data->getCity(); + $dataArray['StateProvince'] = $data->getStateProvince(); + $dataArray['PostalCode'] = $data->getPostalCode(); + $dataArray['CountryCode'] = $data->getCountryCode(); + $dataArray['ResidentialIndicator'] = $data->getResidentialIndicator(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupRateRequestPickupAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupRateRequestPickupDateInfoNormalizer.php b/src/Api/Normalizer/PickupRateRequestPickupDateInfoNormalizer.php index 8de33a24..9042f92f 100644 --- a/src/Api/Normalizer/PickupRateRequestPickupDateInfoNormalizer.php +++ b/src/Api/Normalizer/PickupRateRequestPickupDateInfoNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupRateRequestPickupDateInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupRateRequestPickupDateInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class; + return $type === \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CloseTime', $data)) { - $object->setCloseTime($data['CloseTime']); - unset($data['CloseTime']); - } - if (\array_key_exists('ReadyTime', $data)) { - $object->setReadyTime($data['ReadyTime']); - unset($data['ReadyTime']); - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CloseTime'] = $object->getCloseTime(); - $data['ReadyTime'] = $object->getReadyTime(); - $data['PickupDate'] = $object->getPickupDate(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CloseTime', $data)) { + $object->setCloseTime($data['CloseTime']); + unset($data['CloseTime']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class => false]; + if (\array_key_exists('ReadyTime', $data)) { + $object->setReadyTime($data['ReadyTime']); + unset($data['ReadyTime']); } - } -} else { - class PickupRateRequestPickupDateInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class; + if (\array_key_exists('PickupDate', $data)) { + $object->setPickupDate($data['PickupDate']); + unset($data['PickupDate']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CloseTime', $data)) { - $object->setCloseTime($data['CloseTime']); - unset($data['CloseTime']); - } - if (\array_key_exists('ReadyTime', $data)) { - $object->setReadyTime($data['ReadyTime']); - unset($data['ReadyTime']); - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CloseTime'] = $object->getCloseTime(); - $data['ReadyTime'] = $object->getReadyTime(); - $data['PickupDate'] = $object->getPickupDate(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CloseTime'] = $data->getCloseTime(); + $dataArray['ReadyTime'] = $data->getReadyTime(); + $dataArray['PickupDate'] = $data->getPickupDate(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupRateRequestPickupDateInfo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupRateRequestRequestNormalizer.php b/src/Api/Normalizer/PickupRateRequestRequestNormalizer.php index 1202b9a7..32fb1449 100644 --- a/src/Api/Normalizer/PickupRateRequestRequestNormalizer.php +++ b/src/Api/Normalizer/PickupRateRequestRequestNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupRateRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupRateRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupRateRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); + } + if (\array_key_exists('SubVersion', $data)) { + $object->setSubVersion($data['SubVersion']); + unset($data['SubVersion']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateRequestRequest::class => false]; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupRateRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('requestOption') && null !== $data->getRequestOption()) { + $dataArray['RequestOption'] = $data->getRequestOption(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequestRequest::class; + if ($data->isInitialized('subVersion') && null !== $data->getSubVersion()) { + $dataArray['SubVersion'] = $data->getSubVersion(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupRateRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupRateRequestShipperAccountNormalizer.php b/src/Api/Normalizer/PickupRateRequestShipperAccountNormalizer.php index 6bce75b5..fa5ed5a9 100644 --- a/src/Api/Normalizer/PickupRateRequestShipperAccountNormalizer.php +++ b/src/Api/Normalizer/PickupRateRequestShipperAccountNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupRateRequestShipperAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupRateRequestShipperAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class; + return $type === \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('AccountCountryCode', $data)) { - $object->setAccountCountryCode($data['AccountCountryCode']); - unset($data['AccountCountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AccountNumber'] = $object->getAccountNumber(); - $data['AccountCountryCode'] = $object->getAccountCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class => false]; - } - } -} else { - class PickupRateRequestShipperAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class; + if (\array_key_exists('AccountNumber', $data)) { + $object->setAccountNumber($data['AccountNumber']); + unset($data['AccountNumber']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class; + if (\array_key_exists('AccountCountryCode', $data)) { + $object->setAccountCountryCode($data['AccountCountryCode']); + unset($data['AccountCountryCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('AccountCountryCode', $data)) { - $object->setAccountCountryCode($data['AccountCountryCode']); - unset($data['AccountCountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AccountNumber'] = $object->getAccountNumber(); - $data['AccountCountryCode'] = $object->getAccountCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['AccountNumber'] = $data->getAccountNumber(); + $dataArray['AccountCountryCode'] = $data->getAccountCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupRateRequestShipperAccount::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupRateResponseNormalizer.php b/src/Api/Normalizer/PickupRateResponseNormalizer.php index c1d6e3c7..01fbff8f 100644 --- a/src/Api/Normalizer/PickupRateResponseNormalizer.php +++ b/src/Api/Normalizer/PickupRateResponseNormalizer.php @@ -5,164 +5,81 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupRateResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupRateResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateResponse::class; + return $type === \ShipStream\Ups\Api\Model\PickupRateResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('RateResult', $data)) { - $object->setRateResult($this->denormalizer->denormalize($data['RateResult'], \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class, 'json', $context)); - unset($data['RateResult']); - } - if (\array_key_exists('WeekendServiceTerritoryIndicator', $data)) { - $object->setWeekendServiceTerritoryIndicator($data['WeekendServiceTerritoryIndicator']); - unset($data['WeekendServiceTerritoryIndicator']); - } - if (\array_key_exists('WeekendServiceTerritory', $data)) { - $object->setWeekendServiceTerritory($this->denormalizer->denormalize($data['WeekendServiceTerritory'], \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class, 'json', $context)); - unset($data['WeekendServiceTerritory']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupRateResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['RateResult'] = $this->normalizer->normalize($object->getRateResult(), 'json', $context); - if ($object->isInitialized('weekendServiceTerritoryIndicator') && null !== $object->getWeekendServiceTerritoryIndicator()) { - $data['WeekendServiceTerritoryIndicator'] = $object->getWeekendServiceTerritoryIndicator(); - } - if ($object->isInitialized('weekendServiceTerritory') && null !== $object->getWeekendServiceTerritory()) { - $data['WeekendServiceTerritory'] = $this->normalizer->normalize($object->getWeekendServiceTerritory(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class, 'json', $context)); + unset($data['Response']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateResponse::class => false]; + if (\array_key_exists('RateResult', $data)) { + $object->setRateResult($this->denormalizer->denormalize($data['RateResult'], \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class, 'json', $context)); + unset($data['RateResult']); } - } -} else { - class PickupRateResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateResponse::class; + if (\array_key_exists('WeekendServiceTerritoryIndicator', $data)) { + $object->setWeekendServiceTerritoryIndicator($data['WeekendServiceTerritoryIndicator']); + unset($data['WeekendServiceTerritoryIndicator']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateResponse::class; + if (\array_key_exists('WeekendServiceTerritory', $data)) { + $object->setWeekendServiceTerritory($this->denormalizer->denormalize($data['WeekendServiceTerritory'], \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class, 'json', $context)); + unset($data['WeekendServiceTerritory']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('RateResult', $data)) { - $object->setRateResult($this->denormalizer->denormalize($data['RateResult'], \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class, 'json', $context)); - unset($data['RateResult']); - } - if (\array_key_exists('WeekendServiceTerritoryIndicator', $data)) { - $object->setWeekendServiceTerritoryIndicator($data['WeekendServiceTerritoryIndicator']); - unset($data['WeekendServiceTerritoryIndicator']); - } - if (\array_key_exists('WeekendServiceTerritory', $data)) { - $object->setWeekendServiceTerritory($this->denormalizer->denormalize($data['WeekendServiceTerritory'], \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class, 'json', $context)); - unset($data['WeekendServiceTerritory']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['RateResult'] = $this->normalizer->normalize($object->getRateResult(), 'json', $context); - if ($object->isInitialized('weekendServiceTerritoryIndicator') && null !== $object->getWeekendServiceTerritoryIndicator()) { - $data['WeekendServiceTerritoryIndicator'] = $object->getWeekendServiceTerritoryIndicator(); - } - if ($object->isInitialized('weekendServiceTerritory') && null !== $object->getWeekendServiceTerritory()) { - $data['WeekendServiceTerritory'] = $this->normalizer->normalize($object->getWeekendServiceTerritory(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + $dataArray['RateResult'] = $this->normalizer->normalize($data->getRateResult(), 'json', $context); + if ($data->isInitialized('weekendServiceTerritoryIndicator') && null !== $data->getWeekendServiceTerritoryIndicator()) { + $dataArray['WeekendServiceTerritoryIndicator'] = $data->getWeekendServiceTerritoryIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateResponse::class => false]; + if ($data->isInitialized('weekendServiceTerritory') && null !== $data->getWeekendServiceTerritory()) { + $dataArray['WeekendServiceTerritory'] = $this->normalizer->normalize($data->getWeekendServiceTerritory(), 'json', $context); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupRateResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupRateResponseRateResultNormalizer.php b/src/Api/Normalizer/PickupRateResponseRateResultNormalizer.php index bfbd2bdf..823deffc 100644 --- a/src/Api/Normalizer/PickupRateResponseRateResultNormalizer.php +++ b/src/Api/Normalizer/PickupRateResponseRateResultNormalizer.php @@ -5,252 +5,125 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupRateResponseRateResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupRateResponseRateResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class; + return $type === \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateResponseRateResult(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Disclaimer', $data)) { - $object->setDisclaimer($this->denormalizer->denormalize($data['Disclaimer'], \ShipStream\Ups\Api\Model\RateResultDisclaimer::class, 'json', $context)); - unset($data['Disclaimer']); - } - if (\array_key_exists('RateType', $data)) { - $object->setRateType($data['RateType']); - unset($data['RateType']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('ChargeDetail', $data)) { - $object->setChargeDetail($this->denormalizer->denormalize($data['ChargeDetail'], \ShipStream\Ups\Api\Model\RateResultChargeDetail::class, 'json', $context)); - unset($data['ChargeDetail']); - } - if (\array_key_exists('TaxCharges', $data)) { - $object->setTaxCharges($this->denormalizer->denormalize($data['TaxCharges'], \ShipStream\Ups\Api\Model\RateResultTaxCharges::class, 'json', $context)); - unset($data['TaxCharges']); - } - if (\array_key_exists('TotalTax', $data)) { - $object->setTotalTax($data['TotalTax']); - unset($data['TotalTax']); - } - if (\array_key_exists('GrandTotalOfAllCharge', $data)) { - $object->setGrandTotalOfAllCharge($data['GrandTotalOfAllCharge']); - unset($data['GrandTotalOfAllCharge']); - } - if (\array_key_exists('GrandTotalOfAllIncentedCharge', $data)) { - $object->setGrandTotalOfAllIncentedCharge($data['GrandTotalOfAllIncentedCharge']); - unset($data['GrandTotalOfAllIncentedCharge']); - } - if (\array_key_exists('PreTaxTotalCharge', $data)) { - $object->setPreTaxTotalCharge($data['PreTaxTotalCharge']); - unset($data['PreTaxTotalCharge']); - } - if (\array_key_exists('PreTaxTotalIncentedCharge', $data)) { - $object->setPreTaxTotalIncentedCharge($data['PreTaxTotalIncentedCharge']); - unset($data['PreTaxTotalIncentedCharge']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupRateResponseRateResult(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $data['Disclaimer'] = $this->normalizer->normalize($object->getDisclaimer(), 'json', $context); - } - if ($object->isInitialized('rateType') && null !== $object->getRateType()) { - $data['RateType'] = $object->getRateType(); - } - $data['CurrencyCode'] = $object->getCurrencyCode(); - if ($object->isInitialized('chargeDetail') && null !== $object->getChargeDetail()) { - $data['ChargeDetail'] = $this->normalizer->normalize($object->getChargeDetail(), 'json', $context); - } - if ($object->isInitialized('taxCharges') && null !== $object->getTaxCharges()) { - $data['TaxCharges'] = $this->normalizer->normalize($object->getTaxCharges(), 'json', $context); - } - if ($object->isInitialized('totalTax') && null !== $object->getTotalTax()) { - $data['TotalTax'] = $object->getTotalTax(); - } - if ($object->isInitialized('grandTotalOfAllCharge') && null !== $object->getGrandTotalOfAllCharge()) { - $data['GrandTotalOfAllCharge'] = $object->getGrandTotalOfAllCharge(); - } - if ($object->isInitialized('grandTotalOfAllIncentedCharge') && null !== $object->getGrandTotalOfAllIncentedCharge()) { - $data['GrandTotalOfAllIncentedCharge'] = $object->getGrandTotalOfAllIncentedCharge(); - } - if ($object->isInitialized('preTaxTotalCharge') && null !== $object->getPreTaxTotalCharge()) { - $data['PreTaxTotalCharge'] = $object->getPreTaxTotalCharge(); - } - if ($object->isInitialized('preTaxTotalIncentedCharge') && null !== $object->getPreTaxTotalIncentedCharge()) { - $data['PreTaxTotalIncentedCharge'] = $object->getPreTaxTotalIncentedCharge(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Disclaimer', $data)) { + $object->setDisclaimer($this->denormalizer->denormalize($data['Disclaimer'], \ShipStream\Ups\Api\Model\RateResultDisclaimer::class, 'json', $context)); + unset($data['Disclaimer']); + } + if (\array_key_exists('RateType', $data)) { + $object->setRateType($data['RateType']); + unset($data['RateType']); + } + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); + } + if (\array_key_exists('ChargeDetail', $data)) { + $object->setChargeDetail($this->denormalizer->denormalize($data['ChargeDetail'], \ShipStream\Ups\Api\Model\RateResultChargeDetail::class, 'json', $context)); + unset($data['ChargeDetail']); + } + if (\array_key_exists('TaxCharges', $data)) { + $object->setTaxCharges($this->denormalizer->denormalize($data['TaxCharges'], \ShipStream\Ups\Api\Model\RateResultTaxCharges::class, 'json', $context)); + unset($data['TaxCharges']); + } + if (\array_key_exists('TotalTax', $data)) { + $object->setTotalTax($data['TotalTax']); + unset($data['TotalTax']); + } + if (\array_key_exists('GrandTotalOfAllCharge', $data)) { + $object->setGrandTotalOfAllCharge($data['GrandTotalOfAllCharge']); + unset($data['GrandTotalOfAllCharge']); + } + if (\array_key_exists('GrandTotalOfAllIncentedCharge', $data)) { + $object->setGrandTotalOfAllIncentedCharge($data['GrandTotalOfAllIncentedCharge']); + unset($data['GrandTotalOfAllIncentedCharge']); + } + if (\array_key_exists('PreTaxTotalCharge', $data)) { + $object->setPreTaxTotalCharge($data['PreTaxTotalCharge']); + unset($data['PreTaxTotalCharge']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class => false]; + if (\array_key_exists('PreTaxTotalIncentedCharge', $data)) { + $object->setPreTaxTotalIncentedCharge($data['PreTaxTotalIncentedCharge']); + unset($data['PreTaxTotalIncentedCharge']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PickupRateResponseRateResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class; + $dataArray = []; + if ($data->isInitialized('disclaimer') && null !== $data->getDisclaimer()) { + $dataArray['Disclaimer'] = $this->normalizer->normalize($data->getDisclaimer(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class; + if ($data->isInitialized('rateType') && null !== $data->getRateType()) { + $dataArray['RateType'] = $data->getRateType(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateResponseRateResult(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Disclaimer', $data)) { - $object->setDisclaimer($this->denormalizer->denormalize($data['Disclaimer'], \ShipStream\Ups\Api\Model\RateResultDisclaimer::class, 'json', $context)); - unset($data['Disclaimer']); - } - if (\array_key_exists('RateType', $data)) { - $object->setRateType($data['RateType']); - unset($data['RateType']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('ChargeDetail', $data)) { - $object->setChargeDetail($this->denormalizer->denormalize($data['ChargeDetail'], \ShipStream\Ups\Api\Model\RateResultChargeDetail::class, 'json', $context)); - unset($data['ChargeDetail']); - } - if (\array_key_exists('TaxCharges', $data)) { - $object->setTaxCharges($this->denormalizer->denormalize($data['TaxCharges'], \ShipStream\Ups\Api\Model\RateResultTaxCharges::class, 'json', $context)); - unset($data['TaxCharges']); - } - if (\array_key_exists('TotalTax', $data)) { - $object->setTotalTax($data['TotalTax']); - unset($data['TotalTax']); - } - if (\array_key_exists('GrandTotalOfAllCharge', $data)) { - $object->setGrandTotalOfAllCharge($data['GrandTotalOfAllCharge']); - unset($data['GrandTotalOfAllCharge']); - } - if (\array_key_exists('GrandTotalOfAllIncentedCharge', $data)) { - $object->setGrandTotalOfAllIncentedCharge($data['GrandTotalOfAllIncentedCharge']); - unset($data['GrandTotalOfAllIncentedCharge']); - } - if (\array_key_exists('PreTaxTotalCharge', $data)) { - $object->setPreTaxTotalCharge($data['PreTaxTotalCharge']); - unset($data['PreTaxTotalCharge']); - } - if (\array_key_exists('PreTaxTotalIncentedCharge', $data)) { - $object->setPreTaxTotalIncentedCharge($data['PreTaxTotalIncentedCharge']); - unset($data['PreTaxTotalIncentedCharge']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + if ($data->isInitialized('chargeDetail') && null !== $data->getChargeDetail()) { + $dataArray['ChargeDetail'] = $this->normalizer->normalize($data->getChargeDetail(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $data['Disclaimer'] = $this->normalizer->normalize($object->getDisclaimer(), 'json', $context); - } - if ($object->isInitialized('rateType') && null !== $object->getRateType()) { - $data['RateType'] = $object->getRateType(); - } - $data['CurrencyCode'] = $object->getCurrencyCode(); - if ($object->isInitialized('chargeDetail') && null !== $object->getChargeDetail()) { - $data['ChargeDetail'] = $this->normalizer->normalize($object->getChargeDetail(), 'json', $context); - } - if ($object->isInitialized('taxCharges') && null !== $object->getTaxCharges()) { - $data['TaxCharges'] = $this->normalizer->normalize($object->getTaxCharges(), 'json', $context); - } - if ($object->isInitialized('totalTax') && null !== $object->getTotalTax()) { - $data['TotalTax'] = $object->getTotalTax(); - } - if ($object->isInitialized('grandTotalOfAllCharge') && null !== $object->getGrandTotalOfAllCharge()) { - $data['GrandTotalOfAllCharge'] = $object->getGrandTotalOfAllCharge(); - } - if ($object->isInitialized('grandTotalOfAllIncentedCharge') && null !== $object->getGrandTotalOfAllIncentedCharge()) { - $data['GrandTotalOfAllIncentedCharge'] = $object->getGrandTotalOfAllIncentedCharge(); - } - if ($object->isInitialized('preTaxTotalCharge') && null !== $object->getPreTaxTotalCharge()) { - $data['PreTaxTotalCharge'] = $object->getPreTaxTotalCharge(); - } - if ($object->isInitialized('preTaxTotalIncentedCharge') && null !== $object->getPreTaxTotalIncentedCharge()) { - $data['PreTaxTotalIncentedCharge'] = $object->getPreTaxTotalIncentedCharge(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('taxCharges') && null !== $data->getTaxCharges()) { + $dataArray['TaxCharges'] = $this->normalizer->normalize($data->getTaxCharges(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class => false]; + if ($data->isInitialized('totalTax') && null !== $data->getTotalTax()) { + $dataArray['TotalTax'] = $data->getTotalTax(); } + if ($data->isInitialized('grandTotalOfAllCharge') && null !== $data->getGrandTotalOfAllCharge()) { + $dataArray['GrandTotalOfAllCharge'] = $data->getGrandTotalOfAllCharge(); + } + if ($data->isInitialized('grandTotalOfAllIncentedCharge') && null !== $data->getGrandTotalOfAllIncentedCharge()) { + $dataArray['GrandTotalOfAllIncentedCharge'] = $data->getGrandTotalOfAllIncentedCharge(); + } + if ($data->isInitialized('preTaxTotalCharge') && null !== $data->getPreTaxTotalCharge()) { + $dataArray['PreTaxTotalCharge'] = $data->getPreTaxTotalCharge(); + } + if ($data->isInitialized('preTaxTotalIncentedCharge') && null !== $data->getPreTaxTotalIncentedCharge()) { + $dataArray['PreTaxTotalIncentedCharge'] = $data->getPreTaxTotalIncentedCharge(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupRateResponseRateResult::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupRateResponseResponseNormalizer.php b/src/Api/Normalizer/PickupRateResponseResponseNormalizer.php index 420f186a..89e66be5 100644 --- a/src/Api/Normalizer/PickupRateResponseResponseNormalizer.php +++ b/src/Api/Normalizer/PickupRateResponseResponseNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupRateResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupRateResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupRateResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); + } + if (\array_key_exists('Alert', $data)) { + $values = []; + foreach ($data['Alert'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); } - return $data; + $object->setAlert($values); + unset($data['Alert']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateResponseResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PickupRateResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $values = []; + foreach ($data->getAlert() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Alert'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupRateResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupRateResponseWeekendServiceTerritoryNormalizer.php b/src/Api/Normalizer/PickupRateResponseWeekendServiceTerritoryNormalizer.php index a9b33f79..ecc10269 100644 --- a/src/Api/Normalizer/PickupRateResponseWeekendServiceTerritoryNormalizer.php +++ b/src/Api/Normalizer/PickupRateResponseWeekendServiceTerritoryNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupRateResponseWeekendServiceTerritoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupRateResponseWeekendServiceTerritoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class; + return $type === \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SatWST', $data)) { - $object->setSatWST($data['SatWST']); - unset($data['SatWST']); - } - if (\array_key_exists('SunWST', $data)) { - $object->setSunWST($data['SunWST']); - unset($data['SunWST']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['SatWST'] = $object->getSatWST(); - $data['SunWST'] = $object->getSunWST(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class => false]; - } - } -} else { - class PickupRateResponseWeekendServiceTerritoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class; + if (\array_key_exists('SatWST', $data)) { + $object->setSatWST($data['SatWST']); + unset($data['SatWST']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class; + if (\array_key_exists('SunWST', $data)) { + $object->setSunWST($data['SunWST']); + unset($data['SunWST']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SatWST', $data)) { - $object->setSatWST($data['SatWST']); - unset($data['SatWST']); - } - if (\array_key_exists('SunWST', $data)) { - $object->setSunWST($data['SunWST']); - unset($data['SunWST']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['SatWST'] = $object->getSatWST(); - $data['SunWST'] = $object->getSunWST(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['SatWST'] = $data->getSatWST(); + $dataArray['SunWST'] = $data->getSunWST(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupRateResponseWeekendServiceTerritory::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupRequestPOMNormalizer.php b/src/Api/Normalizer/PickupRequestPOMNormalizer.php index ee8d2df1..deda1892 100644 --- a/src/Api/Normalizer/PickupRequestPOMNormalizer.php +++ b/src/Api/Normalizer/PickupRequestPOMNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupRequestPOMNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupRequestPOMNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRequestPOM::class; + return $type === \ShipStream\Ups\Api\Model\PickupRequestPOM::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRequestPOM::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRequestPOM::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRequestPOM(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('POMNumber', $data)) { - $object->setPOMNumber($data['POMNumber']); - unset($data['POMNumber']); - } - if (\array_key_exists('POMNumberType', $data)) { - $object->setPOMNumberType($data['POMNumberType']); - unset($data['POMNumberType']); - } - if (\array_key_exists('PickupNotifications', $data)) { - $object->setPickupNotifications($this->denormalizer->denormalize($data['PickupNotifications'], \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class, 'json', $context)); - unset($data['PickupNotifications']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupRequestPOM(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['POMNumber'] = $object->getPOMNumber(); - $data['POMNumberType'] = $object->getPOMNumberType(); - $data['PickupNotifications'] = $this->normalizer->normalize($object->getPickupNotifications(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('POMNumber', $data)) { + $object->setPOMNumber($data['POMNumber']); + unset($data['POMNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRequestPOM::class => false]; + if (\array_key_exists('POMNumberType', $data)) { + $object->setPOMNumberType($data['POMNumberType']); + unset($data['POMNumberType']); } - } -} else { - class PickupRequestPOMNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRequestPOM::class; + if (\array_key_exists('PickupNotifications', $data)) { + $object->setPickupNotifications($this->denormalizer->denormalize($data['PickupNotifications'], \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class, 'json', $context)); + unset($data['PickupNotifications']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRequestPOM::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRequestPOM(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('POMNumber', $data)) { - $object->setPOMNumber($data['POMNumber']); - unset($data['POMNumber']); - } - if (\array_key_exists('POMNumberType', $data)) { - $object->setPOMNumberType($data['POMNumberType']); - unset($data['POMNumberType']); - } - if (\array_key_exists('PickupNotifications', $data)) { - $object->setPickupNotifications($this->denormalizer->denormalize($data['PickupNotifications'], \ShipStream\Ups\Api\Model\FreightShipPOMPickupNotifications::class, 'json', $context)); - unset($data['PickupNotifications']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['POMNumber'] = $object->getPOMNumber(); - $data['POMNumberType'] = $object->getPOMNumberType(); - $data['PickupNotifications'] = $this->normalizer->normalize($object->getPickupNotifications(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['POMNumber'] = $data->getPOMNumber(); + $dataArray['POMNumberType'] = $data->getPOMNumberType(); + $dataArray['PickupNotifications'] = $this->normalizer->normalize($data->getPickupNotifications(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRequestPOM::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupRequestPOM::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PickupRequestRequesterNormalizer.php b/src/Api/Normalizer/PickupRequestRequesterNormalizer.php index 3a85673e..ec9a626f 100644 --- a/src/Api/Normalizer/PickupRequestRequesterNormalizer.php +++ b/src/Api/Normalizer/PickupRequestRequesterNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupRequestRequesterNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PickupRequestRequesterNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRequestRequester::class; + return $type === \ShipStream\Ups\Api\Model\PickupRequestRequester::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRequestRequester::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRequestRequester::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRequestRequester(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ThirdPartyIndicator', $data)) { - $object->setThirdPartyIndicator($data['ThirdPartyIndicator']); - unset($data['ThirdPartyIndicator']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\RequesterPhone::class, 'json', $context)); - unset($data['Phone']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PickupRequestRequester(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('thirdPartyIndicator') && null !== $object->getThirdPartyIndicator()) { - $data['ThirdPartyIndicator'] = $object->getThirdPartyIndicator(); - } - $data['AttentionName'] = $object->getAttentionName(); - $data['EMailAddress'] = $object->getEMailAddress(); - $data['Name'] = $object->getName(); - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ThirdPartyIndicator', $data)) { + $object->setThirdPartyIndicator($data['ThirdPartyIndicator']); + unset($data['ThirdPartyIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRequestRequester::class => false]; + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); } - } -} else { - class PickupRequestRequesterNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PickupRequestRequester::class; + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PickupRequestRequester::class; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PickupRequestRequester(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ThirdPartyIndicator', $data)) { - $object->setThirdPartyIndicator($data['ThirdPartyIndicator']); - unset($data['ThirdPartyIndicator']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\RequesterPhone::class, 'json', $context)); - unset($data['Phone']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\RequesterPhone::class, 'json', $context)); + unset($data['Phone']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('thirdPartyIndicator') && null !== $object->getThirdPartyIndicator()) { - $data['ThirdPartyIndicator'] = $object->getThirdPartyIndicator(); - } - $data['AttentionName'] = $object->getAttentionName(); - $data['EMailAddress'] = $object->getEMailAddress(); - $data['Name'] = $object->getName(); - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PickupRequestRequester::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('thirdPartyIndicator') && null !== $data->getThirdPartyIndicator()) { + $dataArray['ThirdPartyIndicator'] = $data->getThirdPartyIndicator(); + } + $dataArray['AttentionName'] = $data->getAttentionName(); + $dataArray['EMailAddress'] = $data->getEMailAddress(); + $dataArray['Name'] = $data->getName(); + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PickupRequestRequester::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PostalCodeListPostalCodeNormalizer.php b/src/Api/Normalizer/PostalCodeListPostalCodeNormalizer.php index 190e6044..dc86f177 100644 --- a/src/Api/Normalizer/PostalCodeListPostalCodeNormalizer.php +++ b/src/Api/Normalizer/PostalCodeListPostalCodeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PostalCodeListPostalCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PostalCodeListPostalCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class; + return $type === \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PostalCodeListPostalCode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PrimaryPostalCode', $data)) { - $object->setPrimaryPostalCode($data['PrimaryPostalCode']); - unset($data['PrimaryPostalCode']); - } - if (\array_key_exists('SecondaryPostalCode', $data)) { - $object->setSecondaryPostalCode($data['SecondaryPostalCode']); - unset($data['SecondaryPostalCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PostalCodeListPostalCode(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PrimaryPostalCode'] = $object->getPrimaryPostalCode(); - if ($object->isInitialized('secondaryPostalCode') && null !== $object->getSecondaryPostalCode()) { - $data['SecondaryPostalCode'] = $object->getSecondaryPostalCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PrimaryPostalCode', $data)) { + $object->setPrimaryPostalCode($data['PrimaryPostalCode']); + unset($data['PrimaryPostalCode']); + } + if (\array_key_exists('SecondaryPostalCode', $data)) { + $object->setSecondaryPostalCode($data['SecondaryPostalCode']); + unset($data['SecondaryPostalCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PostalCodeListPostalCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class; + $dataArray = []; + $dataArray['PrimaryPostalCode'] = $data->getPrimaryPostalCode(); + if ($data->isInitialized('secondaryPostalCode') && null !== $data->getSecondaryPostalCode()) { + $dataArray['SecondaryPostalCode'] = $data->getSecondaryPostalCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PostalCodeListPostalCode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PrimaryPostalCode', $data)) { - $object->setPrimaryPostalCode($data['PrimaryPostalCode']); - unset($data['PrimaryPostalCode']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('SecondaryPostalCode', $data)) { - $object->setSecondaryPostalCode($data['SecondaryPostalCode']); - unset($data['SecondaryPostalCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PrimaryPostalCode'] = $object->getPrimaryPostalCode(); - if ($object->isInitialized('secondaryPostalCode') && null !== $object->getSecondaryPostalCode()) { - $data['SecondaryPostalCode'] = $object->getSecondaryPostalCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PostalCodeListPostalCode::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PreAlertNotificationEMailMessageNormalizer.php b/src/Api/Normalizer/PreAlertNotificationEMailMessageNormalizer.php index fce0023d..9bb83652 100644 --- a/src/Api/Normalizer/PreAlertNotificationEMailMessageNormalizer.php +++ b/src/Api/Normalizer/PreAlertNotificationEMailMessageNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreAlertNotificationEMailMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PreAlertNotificationEMailMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class; + return $type === \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('UndeliverableEMailAddress', $data)) { - $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); - unset($data['UndeliverableEMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['EMailAddress'] = $object->getEMailAddress(); - if ($object->isInitialized('undeliverableEMailAddress') && null !== $object->getUndeliverableEMailAddress()) { - $data['UndeliverableEMailAddress'] = $object->getUndeliverableEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); + } + if (\array_key_exists('UndeliverableEMailAddress', $data)) { + $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); + unset($data['UndeliverableEMailAddress']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PreAlertNotificationEMailMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class; + $dataArray = []; + $dataArray['EMailAddress'] = $data->getEMailAddress(); + if ($data->isInitialized('undeliverableEMailAddress') && null !== $data->getUndeliverableEMailAddress()) { + $dataArray['UndeliverableEMailAddress'] = $data->getUndeliverableEMailAddress(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('UndeliverableEMailAddress', $data)) { - $object->setUndeliverableEMailAddress($data['UndeliverableEMailAddress']); - unset($data['UndeliverableEMailAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['EMailAddress'] = $object->getEMailAddress(); - if ($object->isInitialized('undeliverableEMailAddress') && null !== $object->getUndeliverableEMailAddress()) { - $data['UndeliverableEMailAddress'] = $object->getUndeliverableEMailAddress(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PreAlertNotificationLocaleNormalizer.php b/src/Api/Normalizer/PreAlertNotificationLocaleNormalizer.php index 6853c58f..5866924c 100644 --- a/src/Api/Normalizer/PreAlertNotificationLocaleNormalizer.php +++ b/src/Api/Normalizer/PreAlertNotificationLocaleNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreAlertNotificationLocaleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PreAlertNotificationLocaleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class; + return $type === \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreAlertNotificationLocale(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Language', $data)) { - $object->setLanguage($data['Language']); - unset($data['Language']); - } - if (\array_key_exists('Dialect', $data)) { - $object->setDialect($data['Dialect']); - unset($data['Dialect']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PreAlertNotificationLocale(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Language'] = $object->getLanguage(); - $data['Dialect'] = $object->getDialect(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class => false]; - } - } -} else { - class PreAlertNotificationLocaleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class; + if (\array_key_exists('Language', $data)) { + $object->setLanguage($data['Language']); + unset($data['Language']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class; + if (\array_key_exists('Dialect', $data)) { + $object->setDialect($data['Dialect']); + unset($data['Dialect']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreAlertNotificationLocale(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Language', $data)) { - $object->setLanguage($data['Language']); - unset($data['Language']); - } - if (\array_key_exists('Dialect', $data)) { - $object->setDialect($data['Dialect']); - unset($data['Dialect']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Language'] = $object->getLanguage(); - $data['Dialect'] = $object->getDialect(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Language'] = $data->getLanguage(); + $dataArray['Dialect'] = $data->getDialect(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PreAlertNotificationTextMessageNormalizer.php b/src/Api/Normalizer/PreAlertNotificationTextMessageNormalizer.php index 28f3232d..b6b72b62 100644 --- a/src/Api/Normalizer/PreAlertNotificationTextMessageNormalizer.php +++ b/src/Api/Normalizer/PreAlertNotificationTextMessageNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreAlertNotificationTextMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PreAlertNotificationTextMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class; + return $type === \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PhoneNumber'] = $object->getPhoneNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PhoneNumber', $data)) { + $object->setPhoneNumber($data['PhoneNumber']); + unset($data['PhoneNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PreAlertNotificationTextMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PhoneNumber'] = $data->getPhoneNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PhoneNumber'] = $object->getPhoneNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PreAlertNotificationVoiceMessageNormalizer.php b/src/Api/Normalizer/PreAlertNotificationVoiceMessageNormalizer.php index 615fd530..d6e4c14e 100644 --- a/src/Api/Normalizer/PreAlertNotificationVoiceMessageNormalizer.php +++ b/src/Api/Normalizer/PreAlertNotificationVoiceMessageNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreAlertNotificationVoiceMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PreAlertNotificationVoiceMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class; + return $type === \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PhoneNumber'] = $object->getPhoneNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PhoneNumber', $data)) { + $object->setPhoneNumber($data['PhoneNumber']); + unset($data['PhoneNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PreAlertNotificationVoiceMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['PhoneNumber'] = $data->getPhoneNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('PhoneNumber', $data)) { - $object->setPhoneNumber($data['PhoneNumber']); - unset($data['PhoneNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PhoneNumber'] = $object->getPhoneNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PreNotificationPackageChemicalRecordNormalizer.php b/src/Api/Normalizer/PreNotificationPackageChemicalRecordNormalizer.php index 701462e0..94135c66 100644 --- a/src/Api/Normalizer/PreNotificationPackageChemicalRecordNormalizer.php +++ b/src/Api/Normalizer/PreNotificationPackageChemicalRecordNormalizer.php @@ -5,420 +5,209 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreNotificationPackageChemicalRecordNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PreNotificationPackageChemicalRecordNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ReportableQuantity', $data)) { - $object->setReportableQuantity($data['ReportableQuantity']); - unset($data['ReportableQuantity']); - } - if (\array_key_exists('ClassDivisionNumber', $data)) { - $object->setClassDivisionNumber($data['ClassDivisionNumber']); - unset($data['ClassDivisionNumber']); - } - if (\array_key_exists('SubRiskClass', $data)) { - $object->setSubRiskClass($data['SubRiskClass']); - unset($data['SubRiskClass']); - } - if (\array_key_exists('IDNumber', $data)) { - $object->setIDNumber($data['IDNumber']); - unset($data['IDNumber']); - } - if (\array_key_exists('PackagingGroupType', $data)) { - $object->setPackagingGroupType($data['PackagingGroupType']); - unset($data['PackagingGroupType']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('UOM', $data)) { - $object->setUOM($data['UOM']); - unset($data['UOM']); - } - if (\array_key_exists('PackagingInstructionCode', $data)) { - $object->setPackagingInstructionCode($data['PackagingInstructionCode']); - unset($data['PackagingInstructionCode']); - } - if (\array_key_exists('EmergencyPhone', $data)) { - $object->setEmergencyPhone($data['EmergencyPhone']); - unset($data['EmergencyPhone']); - } - if (\array_key_exists('EmergencyContact', $data)) { - $object->setEmergencyContact($data['EmergencyContact']); - unset($data['EmergencyContact']); - } - if (\array_key_exists('ProperShippingName', $data)) { - $object->setProperShippingName($data['ProperShippingName']); - unset($data['ProperShippingName']); - } - if (\array_key_exists('TechnicalName', $data)) { - $object->setTechnicalName($data['TechnicalName']); - unset($data['TechnicalName']); - } - if (\array_key_exists('AdditionalDescription', $data)) { - $object->setAdditionalDescription($data['AdditionalDescription']); - unset($data['AdditionalDescription']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($data['PackagingType']); - unset($data['PackagingType']); - } - if (\array_key_exists('HazardLabelRequired', $data)) { - $object->setHazardLabelRequired($data['HazardLabelRequired']); - unset($data['HazardLabelRequired']); - } - if (\array_key_exists('PackagingTypeQuantity', $data)) { - $object->setPackagingTypeQuantity($data['PackagingTypeQuantity']); - unset($data['PackagingTypeQuantity']); - } - if (\array_key_exists('CommodityRegulatedLevelCode', $data)) { - $object->setCommodityRegulatedLevelCode($data['CommodityRegulatedLevelCode']); - unset($data['CommodityRegulatedLevelCode']); - } - if (\array_key_exists('TransportCategory', $data)) { - $object->setTransportCategory($data['TransportCategory']); - unset($data['TransportCategory']); - } - if (\array_key_exists('TunnelRestrictionCode', $data)) { - $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); - unset($data['TunnelRestrictionCode']); - } - if (\array_key_exists('QValue', $data)) { - $object->setQValue($data['QValue']); - unset($data['QValue']); - } - if (\array_key_exists('OverPackedIndicator', $data)) { - $object->setOverPackedIndicator($data['OverPackedIndicator']); - unset($data['OverPackedIndicator']); - } - if (\array_key_exists('AllPackedInOneIndicator', $data)) { - $object->setAllPackedInOneIndicator($data['AllPackedInOneIndicator']); - unset($data['AllPackedInOneIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('reportableQuantity') && null !== $object->getReportableQuantity()) { - $data['ReportableQuantity'] = $object->getReportableQuantity(); - } - if ($object->isInitialized('classDivisionNumber') && null !== $object->getClassDivisionNumber()) { - $data['ClassDivisionNumber'] = $object->getClassDivisionNumber(); - } - if ($object->isInitialized('subRiskClass') && null !== $object->getSubRiskClass()) { - $data['SubRiskClass'] = $object->getSubRiskClass(); - } - if ($object->isInitialized('iDNumber') && null !== $object->getIDNumber()) { - $data['IDNumber'] = $object->getIDNumber(); - } - if ($object->isInitialized('packagingGroupType') && null !== $object->getPackagingGroupType()) { - $data['PackagingGroupType'] = $object->getPackagingGroupType(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['Quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('uOM') && null !== $object->getUOM()) { - $data['UOM'] = $object->getUOM(); - } - if ($object->isInitialized('packagingInstructionCode') && null !== $object->getPackagingInstructionCode()) { - $data['PackagingInstructionCode'] = $object->getPackagingInstructionCode(); - } - if ($object->isInitialized('emergencyPhone') && null !== $object->getEmergencyPhone()) { - $data['EmergencyPhone'] = $object->getEmergencyPhone(); - } - if ($object->isInitialized('emergencyContact') && null !== $object->getEmergencyContact()) { - $data['EmergencyContact'] = $object->getEmergencyContact(); - } - if ($object->isInitialized('properShippingName') && null !== $object->getProperShippingName()) { - $data['ProperShippingName'] = $object->getProperShippingName(); - } - if ($object->isInitialized('technicalName') && null !== $object->getTechnicalName()) { - $data['TechnicalName'] = $object->getTechnicalName(); - } - if ($object->isInitialized('additionalDescription') && null !== $object->getAdditionalDescription()) { - $data['AdditionalDescription'] = $object->getAdditionalDescription(); - } - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $object->getPackagingType(); - } - if ($object->isInitialized('hazardLabelRequired') && null !== $object->getHazardLabelRequired()) { - $data['HazardLabelRequired'] = $object->getHazardLabelRequired(); - } - if ($object->isInitialized('packagingTypeQuantity') && null !== $object->getPackagingTypeQuantity()) { - $data['PackagingTypeQuantity'] = $object->getPackagingTypeQuantity(); - } - $data['CommodityRegulatedLevelCode'] = $object->getCommodityRegulatedLevelCode(); - if ($object->isInitialized('transportCategory') && null !== $object->getTransportCategory()) { - $data['TransportCategory'] = $object->getTransportCategory(); - } - if ($object->isInitialized('tunnelRestrictionCode') && null !== $object->getTunnelRestrictionCode()) { - $data['TunnelRestrictionCode'] = $object->getTunnelRestrictionCode(); - } - if ($object->isInitialized('qValue') && null !== $object->getQValue()) { - $data['QValue'] = $object->getQValue(); - } - if ($object->isInitialized('overPackedIndicator') && null !== $object->getOverPackedIndicator()) { - $data['OverPackedIndicator'] = $object->getOverPackedIndicator(); - } - if ($object->isInitialized('allPackedInOneIndicator') && null !== $object->getAllPackedInOneIndicator()) { - $data['AllPackedInOneIndicator'] = $object->getAllPackedInOneIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ReportableQuantity', $data)) { + $object->setReportableQuantity($data['ReportableQuantity']); + unset($data['ReportableQuantity']); + } + if (\array_key_exists('ClassDivisionNumber', $data)) { + $object->setClassDivisionNumber($data['ClassDivisionNumber']); + unset($data['ClassDivisionNumber']); + } + if (\array_key_exists('SubRiskClass', $data)) { + $object->setSubRiskClass($data['SubRiskClass']); + unset($data['SubRiskClass']); + } + if (\array_key_exists('IDNumber', $data)) { + $object->setIDNumber($data['IDNumber']); + unset($data['IDNumber']); + } + if (\array_key_exists('PackagingGroupType', $data)) { + $object->setPackagingGroupType($data['PackagingGroupType']); + unset($data['PackagingGroupType']); + } + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); + } + if (\array_key_exists('UOM', $data)) { + $object->setUOM($data['UOM']); + unset($data['UOM']); + } + if (\array_key_exists('PackagingInstructionCode', $data)) { + $object->setPackagingInstructionCode($data['PackagingInstructionCode']); + unset($data['PackagingInstructionCode']); + } + if (\array_key_exists('EmergencyPhone', $data)) { + $object->setEmergencyPhone($data['EmergencyPhone']); + unset($data['EmergencyPhone']); + } + if (\array_key_exists('EmergencyContact', $data)) { + $object->setEmergencyContact($data['EmergencyContact']); + unset($data['EmergencyContact']); + } + if (\array_key_exists('ProperShippingName', $data)) { + $object->setProperShippingName($data['ProperShippingName']); + unset($data['ProperShippingName']); + } + if (\array_key_exists('TechnicalName', $data)) { + $object->setTechnicalName($data['TechnicalName']); + unset($data['TechnicalName']); + } + if (\array_key_exists('AdditionalDescription', $data)) { + $object->setAdditionalDescription($data['AdditionalDescription']); + unset($data['AdditionalDescription']); + } + if (\array_key_exists('PackagingType', $data)) { + $object->setPackagingType($data['PackagingType']); + unset($data['PackagingType']); + } + if (\array_key_exists('HazardLabelRequired', $data)) { + $object->setHazardLabelRequired($data['HazardLabelRequired']); + unset($data['HazardLabelRequired']); + } + if (\array_key_exists('PackagingTypeQuantity', $data)) { + $object->setPackagingTypeQuantity($data['PackagingTypeQuantity']); + unset($data['PackagingTypeQuantity']); + } + if (\array_key_exists('CommodityRegulatedLevelCode', $data)) { + $object->setCommodityRegulatedLevelCode($data['CommodityRegulatedLevelCode']); + unset($data['CommodityRegulatedLevelCode']); + } + if (\array_key_exists('TransportCategory', $data)) { + $object->setTransportCategory($data['TransportCategory']); + unset($data['TransportCategory']); + } + if (\array_key_exists('TunnelRestrictionCode', $data)) { + $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); + unset($data['TunnelRestrictionCode']); + } + if (\array_key_exists('QValue', $data)) { + $object->setQValue($data['QValue']); + unset($data['QValue']); + } + if (\array_key_exists('OverPackedIndicator', $data)) { + $object->setOverPackedIndicator($data['OverPackedIndicator']); + unset($data['OverPackedIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class => false]; + if (\array_key_exists('AllPackedInOneIndicator', $data)) { + $object->setAllPackedInOneIndicator($data['AllPackedInOneIndicator']); + unset($data['AllPackedInOneIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PreNotificationPackageChemicalRecordNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ReportableQuantity', $data)) { - $object->setReportableQuantity($data['ReportableQuantity']); - unset($data['ReportableQuantity']); - } - if (\array_key_exists('ClassDivisionNumber', $data)) { - $object->setClassDivisionNumber($data['ClassDivisionNumber']); - unset($data['ClassDivisionNumber']); - } - if (\array_key_exists('SubRiskClass', $data)) { - $object->setSubRiskClass($data['SubRiskClass']); - unset($data['SubRiskClass']); - } - if (\array_key_exists('IDNumber', $data)) { - $object->setIDNumber($data['IDNumber']); - unset($data['IDNumber']); - } - if (\array_key_exists('PackagingGroupType', $data)) { - $object->setPackagingGroupType($data['PackagingGroupType']); - unset($data['PackagingGroupType']); - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('UOM', $data)) { - $object->setUOM($data['UOM']); - unset($data['UOM']); - } - if (\array_key_exists('PackagingInstructionCode', $data)) { - $object->setPackagingInstructionCode($data['PackagingInstructionCode']); - unset($data['PackagingInstructionCode']); - } - if (\array_key_exists('EmergencyPhone', $data)) { - $object->setEmergencyPhone($data['EmergencyPhone']); - unset($data['EmergencyPhone']); - } - if (\array_key_exists('EmergencyContact', $data)) { - $object->setEmergencyContact($data['EmergencyContact']); - unset($data['EmergencyContact']); - } - if (\array_key_exists('ProperShippingName', $data)) { - $object->setProperShippingName($data['ProperShippingName']); - unset($data['ProperShippingName']); - } - if (\array_key_exists('TechnicalName', $data)) { - $object->setTechnicalName($data['TechnicalName']); - unset($data['TechnicalName']); - } - if (\array_key_exists('AdditionalDescription', $data)) { - $object->setAdditionalDescription($data['AdditionalDescription']); - unset($data['AdditionalDescription']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($data['PackagingType']); - unset($data['PackagingType']); - } - if (\array_key_exists('HazardLabelRequired', $data)) { - $object->setHazardLabelRequired($data['HazardLabelRequired']); - unset($data['HazardLabelRequired']); - } - if (\array_key_exists('PackagingTypeQuantity', $data)) { - $object->setPackagingTypeQuantity($data['PackagingTypeQuantity']); - unset($data['PackagingTypeQuantity']); - } - if (\array_key_exists('CommodityRegulatedLevelCode', $data)) { - $object->setCommodityRegulatedLevelCode($data['CommodityRegulatedLevelCode']); - unset($data['CommodityRegulatedLevelCode']); - } - if (\array_key_exists('TransportCategory', $data)) { - $object->setTransportCategory($data['TransportCategory']); - unset($data['TransportCategory']); - } - if (\array_key_exists('TunnelRestrictionCode', $data)) { - $object->setTunnelRestrictionCode($data['TunnelRestrictionCode']); - unset($data['TunnelRestrictionCode']); - } - if (\array_key_exists('QValue', $data)) { - $object->setQValue($data['QValue']); - unset($data['QValue']); - } - if (\array_key_exists('OverPackedIndicator', $data)) { - $object->setOverPackedIndicator($data['OverPackedIndicator']); - unset($data['OverPackedIndicator']); - } - if (\array_key_exists('AllPackedInOneIndicator', $data)) { - $object->setAllPackedInOneIndicator($data['AllPackedInOneIndicator']); - unset($data['AllPackedInOneIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('reportableQuantity') && null !== $data->getReportableQuantity()) { + $dataArray['ReportableQuantity'] = $data->getReportableQuantity(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('reportableQuantity') && null !== $object->getReportableQuantity()) { - $data['ReportableQuantity'] = $object->getReportableQuantity(); - } - if ($object->isInitialized('classDivisionNumber') && null !== $object->getClassDivisionNumber()) { - $data['ClassDivisionNumber'] = $object->getClassDivisionNumber(); - } - if ($object->isInitialized('subRiskClass') && null !== $object->getSubRiskClass()) { - $data['SubRiskClass'] = $object->getSubRiskClass(); - } - if ($object->isInitialized('iDNumber') && null !== $object->getIDNumber()) { - $data['IDNumber'] = $object->getIDNumber(); - } - if ($object->isInitialized('packagingGroupType') && null !== $object->getPackagingGroupType()) { - $data['PackagingGroupType'] = $object->getPackagingGroupType(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['Quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('uOM') && null !== $object->getUOM()) { - $data['UOM'] = $object->getUOM(); - } - if ($object->isInitialized('packagingInstructionCode') && null !== $object->getPackagingInstructionCode()) { - $data['PackagingInstructionCode'] = $object->getPackagingInstructionCode(); - } - if ($object->isInitialized('emergencyPhone') && null !== $object->getEmergencyPhone()) { - $data['EmergencyPhone'] = $object->getEmergencyPhone(); - } - if ($object->isInitialized('emergencyContact') && null !== $object->getEmergencyContact()) { - $data['EmergencyContact'] = $object->getEmergencyContact(); - } - if ($object->isInitialized('properShippingName') && null !== $object->getProperShippingName()) { - $data['ProperShippingName'] = $object->getProperShippingName(); - } - if ($object->isInitialized('technicalName') && null !== $object->getTechnicalName()) { - $data['TechnicalName'] = $object->getTechnicalName(); - } - if ($object->isInitialized('additionalDescription') && null !== $object->getAdditionalDescription()) { - $data['AdditionalDescription'] = $object->getAdditionalDescription(); - } - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $object->getPackagingType(); - } - if ($object->isInitialized('hazardLabelRequired') && null !== $object->getHazardLabelRequired()) { - $data['HazardLabelRequired'] = $object->getHazardLabelRequired(); - } - if ($object->isInitialized('packagingTypeQuantity') && null !== $object->getPackagingTypeQuantity()) { - $data['PackagingTypeQuantity'] = $object->getPackagingTypeQuantity(); - } - $data['CommodityRegulatedLevelCode'] = $object->getCommodityRegulatedLevelCode(); - if ($object->isInitialized('transportCategory') && null !== $object->getTransportCategory()) { - $data['TransportCategory'] = $object->getTransportCategory(); - } - if ($object->isInitialized('tunnelRestrictionCode') && null !== $object->getTunnelRestrictionCode()) { - $data['TunnelRestrictionCode'] = $object->getTunnelRestrictionCode(); - } - if ($object->isInitialized('qValue') && null !== $object->getQValue()) { - $data['QValue'] = $object->getQValue(); - } - if ($object->isInitialized('overPackedIndicator') && null !== $object->getOverPackedIndicator()) { - $data['OverPackedIndicator'] = $object->getOverPackedIndicator(); - } - if ($object->isInitialized('allPackedInOneIndicator') && null !== $object->getAllPackedInOneIndicator()) { - $data['AllPackedInOneIndicator'] = $object->getAllPackedInOneIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('classDivisionNumber') && null !== $data->getClassDivisionNumber()) { + $dataArray['ClassDivisionNumber'] = $data->getClassDivisionNumber(); + } + if ($data->isInitialized('subRiskClass') && null !== $data->getSubRiskClass()) { + $dataArray['SubRiskClass'] = $data->getSubRiskClass(); + } + if ($data->isInitialized('iDNumber') && null !== $data->getIDNumber()) { + $dataArray['IDNumber'] = $data->getIDNumber(); + } + if ($data->isInitialized('packagingGroupType') && null !== $data->getPackagingGroupType()) { + $dataArray['PackagingGroupType'] = $data->getPackagingGroupType(); + } + if ($data->isInitialized('quantity') && null !== $data->getQuantity()) { + $dataArray['Quantity'] = $data->getQuantity(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class => false]; + if ($data->isInitialized('uOM') && null !== $data->getUOM()) { + $dataArray['UOM'] = $data->getUOM(); } + if ($data->isInitialized('packagingInstructionCode') && null !== $data->getPackagingInstructionCode()) { + $dataArray['PackagingInstructionCode'] = $data->getPackagingInstructionCode(); + } + if ($data->isInitialized('emergencyPhone') && null !== $data->getEmergencyPhone()) { + $dataArray['EmergencyPhone'] = $data->getEmergencyPhone(); + } + if ($data->isInitialized('emergencyContact') && null !== $data->getEmergencyContact()) { + $dataArray['EmergencyContact'] = $data->getEmergencyContact(); + } + if ($data->isInitialized('properShippingName') && null !== $data->getProperShippingName()) { + $dataArray['ProperShippingName'] = $data->getProperShippingName(); + } + if ($data->isInitialized('technicalName') && null !== $data->getTechnicalName()) { + $dataArray['TechnicalName'] = $data->getTechnicalName(); + } + if ($data->isInitialized('additionalDescription') && null !== $data->getAdditionalDescription()) { + $dataArray['AdditionalDescription'] = $data->getAdditionalDescription(); + } + if ($data->isInitialized('packagingType') && null !== $data->getPackagingType()) { + $dataArray['PackagingType'] = $data->getPackagingType(); + } + if ($data->isInitialized('hazardLabelRequired') && null !== $data->getHazardLabelRequired()) { + $dataArray['HazardLabelRequired'] = $data->getHazardLabelRequired(); + } + if ($data->isInitialized('packagingTypeQuantity') && null !== $data->getPackagingTypeQuantity()) { + $dataArray['PackagingTypeQuantity'] = $data->getPackagingTypeQuantity(); + } + $dataArray['CommodityRegulatedLevelCode'] = $data->getCommodityRegulatedLevelCode(); + if ($data->isInitialized('transportCategory') && null !== $data->getTransportCategory()) { + $dataArray['TransportCategory'] = $data->getTransportCategory(); + } + if ($data->isInitialized('tunnelRestrictionCode') && null !== $data->getTunnelRestrictionCode()) { + $dataArray['TunnelRestrictionCode'] = $data->getTunnelRestrictionCode(); + } + if ($data->isInitialized('qValue') && null !== $data->getQValue()) { + $dataArray['QValue'] = $data->getQValue(); + } + if ($data->isInitialized('overPackedIndicator') && null !== $data->getOverPackedIndicator()) { + $dataArray['OverPackedIndicator'] = $data->getOverPackedIndicator(); + } + if ($data->isInitialized('allPackedInOneIndicator') && null !== $data->getAllPackedInOneIndicator()) { + $dataArray['AllPackedInOneIndicator'] = $data->getAllPackedInOneIndicator(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PreNotificationRequestNormalizer.php b/src/Api/Normalizer/PreNotificationRequestNormalizer.php index 11c8a2dc..c53dc327 100644 --- a/src/Api/Normalizer/PreNotificationRequestNormalizer.php +++ b/src/Api/Normalizer/PreNotificationRequestNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreNotificationRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PreNotificationRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationRequest::class; + return $type === \ShipStream\Ups\Api\Model\PreNotificationRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('Shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class, 'json', $context)); - unset($data['Shipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PreNotificationRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['Shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationRequest::class => false]; - } - } -} else { - class PreNotificationRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationRequest::class; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class, 'json', $context)); + unset($data['Request']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationRequest::class; + if (\array_key_exists('Shipment', $data)) { + $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class, 'json', $context)); + unset($data['Shipment']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('Shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class, 'json', $context)); - unset($data['Shipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['Shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['Shipment'] = $this->normalizer->normalize($data->getShipment(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PreNotificationRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PreNotificationRequestRequestNormalizer.php b/src/Api/Normalizer/PreNotificationRequestRequestNormalizer.php index 79c6b067..4cceaa8a 100644 --- a/src/Api/Normalizer/PreNotificationRequestRequestNormalizer.php +++ b/src/Api/Normalizer/PreNotificationRequestRequestNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreNotificationRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PreNotificationRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PreNotificationRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PreNotificationRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PreNotificationRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PreNotificationRequestShipmentNormalizer.php b/src/Api/Normalizer/PreNotificationRequestShipmentNormalizer.php index bb560e74..47ebf8a9 100644 --- a/src/Api/Normalizer/PreNotificationRequestShipmentNormalizer.php +++ b/src/Api/Normalizer/PreNotificationRequestShipmentNormalizer.php @@ -5,212 +5,105 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreNotificationRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PreNotificationRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class; + return $type === \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationRequestShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('ShipmentIdentificationNumber', $data)) { - $object->setShipmentIdentificationNumber($data['ShipmentIdentificationNumber']); - unset($data['ShipmentIdentificationNumber']); - } - if (\array_key_exists('ShipToAddress', $data)) { - $object->setShipToAddress($this->denormalizer->denormalize($data['ShipToAddress'], \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class, 'json', $context)); - unset($data['ShipToAddress']); - } - if (\array_key_exists('ShipFromAddress', $data)) { - $object->setShipFromAddress($this->denormalizer->denormalize($data['ShipFromAddress'], \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class, 'json', $context)); - unset($data['ShipFromAddress']); - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('Package', $data)) { - $values = []; - foreach ($data['Package'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class, 'json', $context); - } - $object->setPackage($values); - unset($data['Package']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PreNotificationRequestShipment(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['ShipmentIdentificationNumber'] = $object->getShipmentIdentificationNumber(); - $data['ShipToAddress'] = $this->normalizer->normalize($object->getShipToAddress(), 'json', $context); - $data['ShipFromAddress'] = $this->normalizer->normalize($object->getShipFromAddress(), 'json', $context); - $data['PickupDate'] = $object->getPickupDate(); - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - $data['RegulationSet'] = $object->getRegulationSet(); - $values = []; - foreach ($object->getPackage() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Package'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class => false]; + if (\array_key_exists('ShipmentIdentificationNumber', $data)) { + $object->setShipmentIdentificationNumber($data['ShipmentIdentificationNumber']); + unset($data['ShipmentIdentificationNumber']); } - } -} else { - class PreNotificationRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class; + if (\array_key_exists('ShipToAddress', $data)) { + $object->setShipToAddress($this->denormalizer->denormalize($data['ShipToAddress'], \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class, 'json', $context)); + unset($data['ShipToAddress']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class; + if (\array_key_exists('ShipFromAddress', $data)) { + $object->setShipFromAddress($this->denormalizer->denormalize($data['ShipFromAddress'], \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class, 'json', $context)); + unset($data['ShipFromAddress']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationRequestShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('ShipmentIdentificationNumber', $data)) { - $object->setShipmentIdentificationNumber($data['ShipmentIdentificationNumber']); - unset($data['ShipmentIdentificationNumber']); - } - if (\array_key_exists('ShipToAddress', $data)) { - $object->setShipToAddress($this->denormalizer->denormalize($data['ShipToAddress'], \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class, 'json', $context)); - unset($data['ShipToAddress']); - } - if (\array_key_exists('ShipFromAddress', $data)) { - $object->setShipFromAddress($this->denormalizer->denormalize($data['ShipFromAddress'], \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class, 'json', $context)); - unset($data['ShipFromAddress']); - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('Package', $data)) { - $values = []; - foreach ($data['Package'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class, 'json', $context); - } - $object->setPackage($values); - unset($data['Package']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if (\array_key_exists('PickupDate', $data)) { + $object->setPickupDate($data['PickupDate']); + unset($data['PickupDate']); + } + if (\array_key_exists('Service', $data)) { + $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); + unset($data['Service']); + } + if (\array_key_exists('RegulationSet', $data)) { + $object->setRegulationSet($data['RegulationSet']); + unset($data['RegulationSet']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['ShipmentIdentificationNumber'] = $object->getShipmentIdentificationNumber(); - $data['ShipToAddress'] = $this->normalizer->normalize($object->getShipToAddress(), 'json', $context); - $data['ShipFromAddress'] = $this->normalizer->normalize($object->getShipFromAddress(), 'json', $context); - $data['PickupDate'] = $object->getPickupDate(); - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - $data['RegulationSet'] = $object->getRegulationSet(); + if (\array_key_exists('Package', $data)) { $values = []; - foreach ($object->getPackage() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['Package'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class, 'json', $context); } - $data['Package'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + $object->setPackage($values); + unset($data['Package']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + $dataArray['ShipmentIdentificationNumber'] = $data->getShipmentIdentificationNumber(); + $dataArray['ShipToAddress'] = $this->normalizer->normalize($data->getShipToAddress(), 'json', $context); + $dataArray['ShipFromAddress'] = $this->normalizer->normalize($data->getShipFromAddress(), 'json', $context); + $dataArray['PickupDate'] = $data->getPickupDate(); + $dataArray['Service'] = $this->normalizer->normalize($data->getService(), 'json', $context); + $dataArray['RegulationSet'] = $data->getRegulationSet(); + $values = []; + foreach ($data->getPackage() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Package'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PreNotificationRequestShipment::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PreNotificationResponseNormalizer.php b/src/Api/Normalizer/PreNotificationResponseNormalizer.php index 5514c8d8..a069f81f 100644 --- a/src/Api/Normalizer/PreNotificationResponseNormalizer.php +++ b/src/Api/Normalizer/PreNotificationResponseNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreNotificationResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PreNotificationResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationResponse::class; + return $type === \ShipStream\Ups\Api\Model\PreNotificationResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PreNotificationResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class, 'json', $context)); + unset($data['Response']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationResponse::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PreNotificationResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationResponse(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PreNotificationResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PreNotificationResponseResponseNormalizer.php b/src/Api/Normalizer/PreNotificationResponseResponseNormalizer.php index 9558f212..577088ab 100644 --- a/src/Api/Normalizer/PreNotificationResponseResponseNormalizer.php +++ b/src/Api/Normalizer/PreNotificationResponseResponseNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreNotificationResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PreNotificationResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PreNotificationResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); + } + if (\array_key_exists('Alert', $data)) { + $values = []; + foreach ($data['Alert'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); } - return $data; + $object->setAlert($values); + unset($data['Alert']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PreNotificationResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $values = []; + foreach ($data->getAlert() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Alert'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PreNotificationResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PreNotificationShipmentPackageNormalizer.php b/src/Api/Normalizer/PreNotificationShipmentPackageNormalizer.php index 515e249f..efded8d6 100644 --- a/src/Api/Normalizer/PreNotificationShipmentPackageNormalizer.php +++ b/src/Api/Normalizer/PreNotificationShipmentPackageNormalizer.php @@ -5,204 +5,101 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreNotificationShipmentPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PreNotificationShipmentPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class; + return $type === \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('PackageWeight', $data)) { - $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\PackagePackageWeight::class, 'json', $context)); - unset($data['PackageWeight']); - } - if (\array_key_exists('TransportationMode', $data)) { - $object->setTransportationMode($data['TransportationMode']); - unset($data['TransportationMode']); - } - if (\array_key_exists('VoidIndicator', $data)) { - $object->setVoidIndicator($data['VoidIndicator']); - unset($data['VoidIndicator']); - } - if (\array_key_exists('PackagePoints', $data)) { - $object->setPackagePoints($data['PackagePoints']); - unset($data['PackagePoints']); - } - if (\array_key_exists('ChemicalRecord', $data)) { - $values = []; - foreach ($data['ChemicalRecord'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class, 'json', $context); - } - $object->setChemicalRecord($values); - unset($data['ChemicalRecord']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['TrackingNumber'] = $object->getTrackingNumber(); - $data['PackageWeight'] = $this->normalizer->normalize($object->getPackageWeight(), 'json', $context); - if ($object->isInitialized('transportationMode') && null !== $object->getTransportationMode()) { - $data['TransportationMode'] = $object->getTransportationMode(); - } - if ($object->isInitialized('voidIndicator') && null !== $object->getVoidIndicator()) { - $data['VoidIndicator'] = $object->getVoidIndicator(); - } - if ($object->isInitialized('packagePoints') && null !== $object->getPackagePoints()) { - $data['PackagePoints'] = $object->getPackagePoints(); - } + if (\array_key_exists('TrackingNumber', $data)) { + $object->setTrackingNumber($data['TrackingNumber']); + unset($data['TrackingNumber']); + } + if (\array_key_exists('PackageWeight', $data)) { + $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\PackagePackageWeight::class, 'json', $context)); + unset($data['PackageWeight']); + } + if (\array_key_exists('TransportationMode', $data)) { + $object->setTransportationMode($data['TransportationMode']); + unset($data['TransportationMode']); + } + if (\array_key_exists('VoidIndicator', $data)) { + $object->setVoidIndicator($data['VoidIndicator']); + unset($data['VoidIndicator']); + } + if (\array_key_exists('PackagePoints', $data)) { + $object->setPackagePoints($data['PackagePoints']); + unset($data['PackagePoints']); + } + if (\array_key_exists('ChemicalRecord', $data)) { $values = []; - foreach ($object->getChemicalRecord() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['ChemicalRecord'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class, 'json', $context); } - $data['ChemicalRecord'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setChemicalRecord($values); + unset($data['ChemicalRecord']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PreNotificationShipmentPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class; + $dataArray = []; + $dataArray['TrackingNumber'] = $data->getTrackingNumber(); + $dataArray['PackageWeight'] = $this->normalizer->normalize($data->getPackageWeight(), 'json', $context); + if ($data->isInitialized('transportationMode') && null !== $data->getTransportationMode()) { + $dataArray['TransportationMode'] = $data->getTransportationMode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class; + if ($data->isInitialized('voidIndicator') && null !== $data->getVoidIndicator()) { + $dataArray['VoidIndicator'] = $data->getVoidIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationShipmentPackage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('PackageWeight', $data)) { - $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\PackagePackageWeight::class, 'json', $context)); - unset($data['PackageWeight']); - } - if (\array_key_exists('TransportationMode', $data)) { - $object->setTransportationMode($data['TransportationMode']); - unset($data['TransportationMode']); - } - if (\array_key_exists('VoidIndicator', $data)) { - $object->setVoidIndicator($data['VoidIndicator']); - unset($data['VoidIndicator']); - } - if (\array_key_exists('PackagePoints', $data)) { - $object->setPackagePoints($data['PackagePoints']); - unset($data['PackagePoints']); - } - if (\array_key_exists('ChemicalRecord', $data)) { - $values = []; - foreach ($data['ChemicalRecord'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PreNotificationPackageChemicalRecord::class, 'json', $context); - } - $object->setChemicalRecord($values); - unset($data['ChemicalRecord']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('packagePoints') && null !== $data->getPackagePoints()) { + $dataArray['PackagePoints'] = $data->getPackagePoints(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['TrackingNumber'] = $object->getTrackingNumber(); - $data['PackageWeight'] = $this->normalizer->normalize($object->getPackageWeight(), 'json', $context); - if ($object->isInitialized('transportationMode') && null !== $object->getTransportationMode()) { - $data['TransportationMode'] = $object->getTransportationMode(); - } - if ($object->isInitialized('voidIndicator') && null !== $object->getVoidIndicator()) { - $data['VoidIndicator'] = $object->getVoidIndicator(); - } - if ($object->isInitialized('packagePoints') && null !== $object->getPackagePoints()) { - $data['PackagePoints'] = $object->getPackagePoints(); - } - $values = []; - foreach ($object->getChemicalRecord() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ChemicalRecord'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $values = []; + foreach ($data->getChemicalRecord() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class => false]; + $dataArray['ChemicalRecord'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PreNotificationShipmentPackage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PreNotificationShipmentShipFromAddressNormalizer.php b/src/Api/Normalizer/PreNotificationShipmentShipFromAddressNormalizer.php index a7fa0084..f1d29208 100644 --- a/src/Api/Normalizer/PreNotificationShipmentShipFromAddressNormalizer.php +++ b/src/Api/Normalizer/PreNotificationShipmentShipFromAddressNormalizer.php @@ -5,194 +5,96 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreNotificationShipmentShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PreNotificationShipmentShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class; + return $type === \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PreNotificationShipmentShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class; + $dataArray['AddressLine'] = $values; + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PreNotificationShipmentShipFromAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PreNotificationShipmentShipToAddressNormalizer.php b/src/Api/Normalizer/PreNotificationShipmentShipToAddressNormalizer.php index 7ff87b4b..e09b0887 100644 --- a/src/Api/Normalizer/PreNotificationShipmentShipToAddressNormalizer.php +++ b/src/Api/Normalizer/PreNotificationShipmentShipToAddressNormalizer.php @@ -5,194 +5,96 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreNotificationShipmentShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PreNotificationShipmentShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class; + return $type === \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PreNotificationShipmentShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class; + $dataArray['AddressLine'] = $values; + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PreNotificationShipmentShipToAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PrivateNetworkListPrivateNetworkNormalizer.php b/src/Api/Normalizer/PrivateNetworkListPrivateNetworkNormalizer.php index c0a375de..974f8301 100644 --- a/src/Api/Normalizer/PrivateNetworkListPrivateNetworkNormalizer.php +++ b/src/Api/Normalizer/PrivateNetworkListPrivateNetworkNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PrivateNetworkListPrivateNetworkNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PrivateNetworkListPrivateNetworkNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class; + return $type === \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('NetworkID', $data)) { - $object->setNetworkID($data['NetworkID']); - unset($data['NetworkID']); - } - if (\array_key_exists('NetworkDescription', $data)) { - $object->setNetworkDescription($data['NetworkDescription']); - unset($data['NetworkDescription']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['NetworkID'] = $object->getNetworkID(); - $data['NetworkDescription'] = $object->getNetworkDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class => false]; - } - } -} else { - class PrivateNetworkListPrivateNetworkNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class; + if (\array_key_exists('NetworkID', $data)) { + $object->setNetworkID($data['NetworkID']); + unset($data['NetworkID']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class; + if (\array_key_exists('NetworkDescription', $data)) { + $object->setNetworkDescription($data['NetworkDescription']); + unset($data['NetworkDescription']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('NetworkID', $data)) { - $object->setNetworkID($data['NetworkID']); - unset($data['NetworkID']); - } - if (\array_key_exists('NetworkDescription', $data)) { - $object->setNetworkDescription($data['NetworkDescription']); - unset($data['NetworkDescription']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['NetworkID'] = $object->getNetworkID(); - $data['NetworkDescription'] = $object->getNetworkDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['NetworkID'] = $data->getNetworkID(); + $dataArray['NetworkDescription'] = $data->getNetworkDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PrivateNetworkListPrivateNetwork::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ProducerAddressNormalizer.php b/src/Api/Normalizer/ProducerAddressNormalizer.php index e51e7a4b..3a88082a 100644 --- a/src/Api/Normalizer/ProducerAddressNormalizer.php +++ b/src/Api/Normalizer/ProducerAddressNormalizer.php @@ -5,204 +5,101 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ProducerAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ProducerAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProducerAddress::class; + return $type === \ShipStream\Ups\Api\Model\ProducerAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProducerAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProducerAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProducerAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ProducerAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProducerAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('Town', $data)) { + $object->setTown($data['Town']); + unset($data['Town']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class ProducerAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProducerAddress::class; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProducerAddress::class; + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProducerAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['Town'] = $data->getTown(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProducerAddress::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ProducerAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ProducerPhoneNormalizer.php b/src/Api/Normalizer/ProducerPhoneNormalizer.php index b3b48b35..a2d858aa 100644 --- a/src/Api/Normalizer/ProducerPhoneNormalizer.php +++ b/src/Api/Normalizer/ProducerPhoneNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ProducerPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ProducerPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProducerPhone::class; + return $type === \ShipStream\Ups\Api\Model\ProducerPhone::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProducerPhone::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProducerPhone::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProducerPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ProducerPhone(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Extension', $data)) { + $object->setExtension($data['Extension']); + unset($data['Extension']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProducerPhone::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ProducerPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProducerPhone::class; + $dataArray = []; + $dataArray['Number'] = $data->getNumber(); + if ($data->isInitialized('extension') && null !== $data->getExtension()) { + $dataArray['Extension'] = $data->getExtension(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProducerPhone::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProducerPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProducerPhone::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ProducerPhone::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ProductEEIInformationNormalizer.php b/src/Api/Normalizer/ProductEEIInformationNormalizer.php index 175c9317..69b5f24d 100644 --- a/src/Api/Normalizer/ProductEEIInformationNormalizer.php +++ b/src/Api/Normalizer/ProductEEIInformationNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ProductEEIInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ProductEEIInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductEEIInformation::class; + return $type === \ShipStream\Ups\Api\Model\ProductEEIInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductEEIInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductEEIInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductEEIInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ExportInformation', $data)) { - $object->setExportInformation($data['ExportInformation']); - unset($data['ExportInformation']); - } - if (\array_key_exists('License', $data)) { - $object->setLicense($this->denormalizer->denormalize($data['License'], \ShipStream\Ups\Api\Model\EEIInformationLicense::class, 'json', $context)); - unset($data['License']); - } - if (\array_key_exists('DDTCInformation', $data)) { - $object->setDDTCInformation($this->denormalizer->denormalize($data['DDTCInformation'], \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class, 'json', $context)); - unset($data['DDTCInformation']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ProductEEIInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('exportInformation') && null !== $object->getExportInformation()) { - $data['ExportInformation'] = $object->getExportInformation(); - } - if ($object->isInitialized('license') && null !== $object->getLicense()) { - $data['License'] = $this->normalizer->normalize($object->getLicense(), 'json', $context); - } - if ($object->isInitialized('dDTCInformation') && null !== $object->getDDTCInformation()) { - $data['DDTCInformation'] = $this->normalizer->normalize($object->getDDTCInformation(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ExportInformation', $data)) { + $object->setExportInformation($data['ExportInformation']); + unset($data['ExportInformation']); + } + if (\array_key_exists('License', $data)) { + $object->setLicense($this->denormalizer->denormalize($data['License'], \ShipStream\Ups\Api\Model\EEIInformationLicense::class, 'json', $context)); + unset($data['License']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductEEIInformation::class => false]; + if (\array_key_exists('DDTCInformation', $data)) { + $object->setDDTCInformation($this->denormalizer->denormalize($data['DDTCInformation'], \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class, 'json', $context)); + unset($data['DDTCInformation']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ProductEEIInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductEEIInformation::class; + $dataArray = []; + if ($data->isInitialized('exportInformation') && null !== $data->getExportInformation()) { + $dataArray['ExportInformation'] = $data->getExportInformation(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductEEIInformation::class; + if ($data->isInitialized('license') && null !== $data->getLicense()) { + $dataArray['License'] = $this->normalizer->normalize($data->getLicense(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductEEIInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ExportInformation', $data)) { - $object->setExportInformation($data['ExportInformation']); - unset($data['ExportInformation']); - } - if (\array_key_exists('License', $data)) { - $object->setLicense($this->denormalizer->denormalize($data['License'], \ShipStream\Ups\Api\Model\EEIInformationLicense::class, 'json', $context)); - unset($data['License']); - } - if (\array_key_exists('DDTCInformation', $data)) { - $object->setDDTCInformation($this->denormalizer->denormalize($data['DDTCInformation'], \ShipStream\Ups\Api\Model\EEIInformationDDTCInformation::class, 'json', $context)); - unset($data['DDTCInformation']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('dDTCInformation') && null !== $data->getDDTCInformation()) { + $dataArray['DDTCInformation'] = $this->normalizer->normalize($data->getDDTCInformation(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('exportInformation') && null !== $object->getExportInformation()) { - $data['ExportInformation'] = $object->getExportInformation(); - } - if ($object->isInitialized('license') && null !== $object->getLicense()) { - $data['License'] = $this->normalizer->normalize($object->getLicense(), 'json', $context); - } - if ($object->isInitialized('dDTCInformation') && null !== $object->getDDTCInformation()) { - $data['DDTCInformation'] = $this->normalizer->normalize($object->getDDTCInformation(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductEEIInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ProductEEIInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ProductExcludeFromFormNormalizer.php b/src/Api/Normalizer/ProductExcludeFromFormNormalizer.php index 6eaf081f..e8a51f31 100644 --- a/src/Api/Normalizer/ProductExcludeFromFormNormalizer.php +++ b/src/Api/Normalizer/ProductExcludeFromFormNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ProductExcludeFromFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ProductExcludeFromFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class; + return $type === \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductExcludeFromForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FormType', $data)) { - $values = []; - foreach ($data['FormType'] as $value) { - $values[] = $value; - } - $object->setFormType($values); - unset($data['FormType']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ProductExcludeFromForm(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('FormType', $data)) { $values = []; - foreach ($object->getFormType() as $value) { + foreach ($data['FormType'] as $value) { $values[] = $value; } - $data['FormType'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setFormType($values); + unset($data['FormType']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductExcludeFromForm::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class ProductExcludeFromFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductExcludeFromForm::class; + $dataArray = []; + $values = []; + foreach ($data->getFormType() as $value) { + $values[] = $value; } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + $dataArray['FormType'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - $object = new \ShipStream\Ups\Api\Model\ProductExcludeFromForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FormType', $data)) { - $values = []; - foreach ($data['FormType'] as $value) { - $values[] = $value; - } - $object->setFormType($values); - unset($data['FormType']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getFormType() as $value) { - $values[] = $value; - } - $data['FormType'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductExcludeFromForm::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ProductExcludeFromForm::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ProductNetCostDateRangeNormalizer.php b/src/Api/Normalizer/ProductNetCostDateRangeNormalizer.php index 06a06cc7..5c10b271 100644 --- a/src/Api/Normalizer/ProductNetCostDateRangeNormalizer.php +++ b/src/Api/Normalizer/ProductNetCostDateRangeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ProductNetCostDateRangeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ProductNetCostDateRangeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class; + return $type === \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductNetCostDateRange(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BeginDate', $data)) { - $object->setBeginDate($data['BeginDate']); - unset($data['BeginDate']); - } - if (\array_key_exists('EndDate', $data)) { - $object->setEndDate($data['EndDate']); - unset($data['EndDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ProductNetCostDateRange(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['BeginDate'] = $object->getBeginDate(); - $data['EndDate'] = $object->getEndDate(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductNetCostDateRange::class => false]; - } - } -} else { - class ProductNetCostDateRangeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class; + if (\array_key_exists('BeginDate', $data)) { + $object->setBeginDate($data['BeginDate']); + unset($data['BeginDate']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductNetCostDateRange::class; + if (\array_key_exists('EndDate', $data)) { + $object->setEndDate($data['EndDate']); + unset($data['EndDate']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductNetCostDateRange(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BeginDate', $data)) { - $object->setBeginDate($data['BeginDate']); - unset($data['BeginDate']); - } - if (\array_key_exists('EndDate', $data)) { - $object->setEndDate($data['EndDate']); - unset($data['EndDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['BeginDate'] = $object->getBeginDate(); - $data['EndDate'] = $object->getEndDate(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['BeginDate'] = $data->getBeginDate(); + $dataArray['EndDate'] = $data->getEndDate(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductNetCostDateRange::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ProductNetCostDateRange::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ProductPackingListInfoNormalizer.php b/src/Api/Normalizer/ProductPackingListInfoNormalizer.php index 8d67bb6d..1c91e39c 100644 --- a/src/Api/Normalizer/ProductPackingListInfoNormalizer.php +++ b/src/Api/Normalizer/ProductPackingListInfoNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ProductPackingListInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ProductPackingListInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductPackingListInfo::class; + return $type === \ShipStream\Ups\Api\Model\ProductPackingListInfo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductPackingListInfo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductPackingListInfo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductPackingListInfo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageAssociated', $data)) { - $values = []; - foreach ($data['PackageAssociated'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class, 'json', $context); - } - $object->setPackageAssociated($values); - unset($data['PackageAssociated']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ProductPackingListInfo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('PackageAssociated', $data)) { $values = []; - foreach ($object->getPackageAssociated() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['PackageAssociated'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class, 'json', $context); } - $data['PackageAssociated'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setPackageAssociated($values); + unset($data['PackageAssociated']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductPackingListInfo::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class ProductPackingListInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductPackingListInfo::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductPackingListInfo::class; + $dataArray = []; + $values = []; + foreach ($data->getPackageAssociated() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['PackageAssociated'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductPackingListInfo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageAssociated', $data)) { - $values = []; - foreach ($data['PackageAssociated'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackingListInfoPackageAssociated::class, 'json', $context); - } - $object->setPackageAssociated($values); - unset($data['PackageAssociated']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getPackageAssociated() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PackageAssociated'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductPackingListInfo::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ProductPackingListInfo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ProductProductWeightNormalizer.php b/src/Api/Normalizer/ProductProductWeightNormalizer.php index 12f2c88a..bca72857 100644 --- a/src/Api/Normalizer/ProductProductWeightNormalizer.php +++ b/src/Api/Normalizer/ProductProductWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ProductProductWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ProductProductWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductProductWeight::class; + return $type === \ShipStream\Ups\Api\Model\ProductProductWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductProductWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductProductWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductProductWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ProductProductWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductProductWeight::class => false]; - } - } -} else { - class ProductProductWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductProductWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductProductWeight::class; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductProductWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Weight'] = $data->getWeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductProductWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ProductProductWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ProductScheduleBNormalizer.php b/src/Api/Normalizer/ProductScheduleBNormalizer.php index 2af841a4..e349088b 100644 --- a/src/Api/Normalizer/ProductScheduleBNormalizer.php +++ b/src/Api/Normalizer/ProductScheduleBNormalizer.php @@ -5,182 +5,90 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ProductScheduleBNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ProductScheduleBNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductScheduleB::class; + return $type === \ShipStream\Ups\Api\Model\ProductScheduleB::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductScheduleB::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductScheduleB::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductScheduleB(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Quantity', $data)) { - $values = []; - foreach ($data['Quantity'] as $value) { - $values[] = $value; - } - $object->setQuantity($values); - unset($data['Quantity']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $values_1 = []; - foreach ($data['UnitOfMeasurement'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class, 'json', $context); - } - $object->setUnitOfMeasurement($values_1); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\ProductScheduleB(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $values = []; - foreach ($object->getQuantity() as $value) { - $values[] = $value; - } - $data['Quantity'] = $values; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Quantity', $data)) { + $values = []; + foreach ($data['Quantity'] as $value) { + $values[] = $value; } + $object->setQuantity($values); + unset($data['Quantity']); + } + if (\array_key_exists('UnitOfMeasurement', $data)) { $values_1 = []; - foreach ($object->getUnitOfMeasurement() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['UnitOfMeasurement'] = $values_1; - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + foreach ($data['UnitOfMeasurement'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class, 'json', $context); } - return $data; + $object->setUnitOfMeasurement($values_1); + unset($data['UnitOfMeasurement']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductScheduleB::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } } + return $object; } -} else { - class ProductScheduleBNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductScheduleB::class; + $dataArray = []; + $dataArray['Number'] = $data->getNumber(); + if ($data->isInitialized('quantity') && null !== $data->getQuantity()) { + $values = []; + foreach ($data->getQuantity() as $value) { + $values[] = $value; + } + $dataArray['Quantity'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductScheduleB::class; + $values_1 = []; + foreach ($data->getUnitOfMeasurement() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['UnitOfMeasurement'] = $values_1; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductScheduleB(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Quantity', $data)) { - $values = []; - foreach ($data['Quantity'] as $value) { - $values[] = $value; - } - $object->setQuantity($values); - unset($data['Quantity']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $values_1 = []; - foreach ($data['UnitOfMeasurement'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class, 'json', $context); - } - $object->setUnitOfMeasurement($values_1); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $values = []; - foreach ($object->getQuantity() as $value) { - $values[] = $value; - } - $data['Quantity'] = $values; - } - $values_1 = []; - foreach ($object->getUnitOfMeasurement() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['UnitOfMeasurement'] = $values_1; - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductScheduleB::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ProductScheduleB::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ProductUnitNormalizer.php b/src/Api/Normalizer/ProductUnitNormalizer.php index 5c35a67c..a77eb838 100644 --- a/src/Api/Normalizer/ProductUnitNormalizer.php +++ b/src/Api/Normalizer/ProductUnitNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ProductUnitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ProductUnitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductUnit::class; + return $type === \ShipStream\Ups\Api\Model\ProductUnit::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductUnit::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductUnit::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductUnit(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ProductUnit(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Number'] = $object->getNumber(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductUnit::class => false]; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - } -} else { - class ProductUnitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductUnit::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductUnit::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductUnit(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Number'] = $object->getNumber(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Number'] = $data->getNumber(); + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductUnit::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ProductUnit::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ProductWeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/ProductWeightUnitOfMeasurementNormalizer.php index 319d34ff..e3780405 100644 --- a/src/Api/Normalizer/ProductWeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/ProductWeightUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ProductWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ProductWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ProductWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ProductWeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PushToImageRepositoryRequestFormsHistoryDocumentIDNormalizer.php b/src/Api/Normalizer/PushToImageRepositoryRequestFormsHistoryDocumentIDNormalizer.php index c57ef00b..ccc670a9 100644 --- a/src/Api/Normalizer/PushToImageRepositoryRequestFormsHistoryDocumentIDNormalizer.php +++ b/src/Api/Normalizer/PushToImageRepositoryRequestFormsHistoryDocumentIDNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PushToImageRepositoryRequestFormsHistoryDocumentIDNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PushToImageRepositoryRequestFormsHistoryDocumentIDNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class; + return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DocumentID', $data)) { - $values = []; - foreach ($data['DocumentID'] as $value) { - $values[] = $value; - } - $object->setDocumentID($values); - unset($data['DocumentID']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('DocumentID', $data)) { $values = []; - foreach ($object->getDocumentID() as $value) { + foreach ($data['DocumentID'] as $value) { $values[] = $value; } - $data['DocumentID'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setDocumentID($values); + unset($data['DocumentID']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PushToImageRepositoryRequestFormsHistoryDocumentIDNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class; + $dataArray = []; + $values = []; + foreach ($data->getDocumentID() as $value) { + $values[] = $value; } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + $dataArray['DocumentID'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DocumentID', $data)) { - $values = []; - foreach ($data['DocumentID'] as $value) { - $values[] = $value; - } - $object->setDocumentID($values); - unset($data['DocumentID']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getDocumentID() as $value) { - $values[] = $value; - } - $data['DocumentID'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PushToImageRepositoryRequestNormalizer.php b/src/Api/Normalizer/PushToImageRepositoryRequestNormalizer.php index 28d45c3a..0c67d313 100644 --- a/src/Api/Normalizer/PushToImageRepositoryRequestNormalizer.php +++ b/src/Api/Normalizer/PushToImageRepositoryRequestNormalizer.php @@ -5,238 +5,118 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PushToImageRepositoryRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PushToImageRepositoryRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('FormsHistoryDocumentID', $data)) { - $object->setFormsHistoryDocumentID($this->denormalizer->denormalize($data['FormsHistoryDocumentID'], \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class, 'json', $context)); - unset($data['FormsHistoryDocumentID']); - } - if (\array_key_exists('FormsGroupID', $data)) { - $object->setFormsGroupID($data['FormsGroupID']); - unset($data['FormsGroupID']); - } - if (\array_key_exists('ShipmentIdentifier', $data)) { - $object->setShipmentIdentifier($data['ShipmentIdentifier']); - unset($data['ShipmentIdentifier']); - } - if (\array_key_exists('ShipmentDateAndTime', $data)) { - $object->setShipmentDateAndTime($data['ShipmentDateAndTime']); - unset($data['ShipmentDateAndTime']); - } - if (\array_key_exists('ShipmentType', $data)) { - $object->setShipmentType($data['ShipmentType']); - unset($data['ShipmentType']); - } - if (\array_key_exists('PRQConfirmationNumber', $data)) { - $object->setPRQConfirmationNumber($data['PRQConfirmationNumber']); - unset($data['PRQConfirmationNumber']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $values = []; - foreach ($data['TrackingNumber'] as $value) { - $values[] = $value; - } - $object->setTrackingNumber($values); - unset($data['TrackingNumber']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['FormsHistoryDocumentID'] = $this->normalizer->normalize($object->getFormsHistoryDocumentID(), 'json', $context); - if ($object->isInitialized('formsGroupID') && null !== $object->getFormsGroupID()) { - $data['FormsGroupID'] = $object->getFormsGroupID(); - } - $data['ShipmentIdentifier'] = $object->getShipmentIdentifier(); - if ($object->isInitialized('shipmentDateAndTime') && null !== $object->getShipmentDateAndTime()) { - $data['ShipmentDateAndTime'] = $object->getShipmentDateAndTime(); - } - $data['ShipmentType'] = $object->getShipmentType(); - if ($object->isInitialized('pRQConfirmationNumber') && null !== $object->getPRQConfirmationNumber()) { - $data['PRQConfirmationNumber'] = $object->getPRQConfirmationNumber(); - } - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $values = []; - foreach ($object->getTrackingNumber() as $value) { - $values[] = $value; - } - $data['TrackingNumber'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class, 'json', $context)); + unset($data['Request']); + } + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); + } + if (\array_key_exists('FormsHistoryDocumentID', $data)) { + $object->setFormsHistoryDocumentID($this->denormalizer->denormalize($data['FormsHistoryDocumentID'], \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class, 'json', $context)); + unset($data['FormsHistoryDocumentID']); + } + if (\array_key_exists('FormsGroupID', $data)) { + $object->setFormsGroupID($data['FormsGroupID']); + unset($data['FormsGroupID']); + } + if (\array_key_exists('ShipmentIdentifier', $data)) { + $object->setShipmentIdentifier($data['ShipmentIdentifier']); + unset($data['ShipmentIdentifier']); + } + if (\array_key_exists('ShipmentDateAndTime', $data)) { + $object->setShipmentDateAndTime($data['ShipmentDateAndTime']); + unset($data['ShipmentDateAndTime']); + } + if (\array_key_exists('ShipmentType', $data)) { + $object->setShipmentType($data['ShipmentType']); + unset($data['ShipmentType']); + } + if (\array_key_exists('PRQConfirmationNumber', $data)) { + $object->setPRQConfirmationNumber($data['PRQConfirmationNumber']); + unset($data['PRQConfirmationNumber']); + } + if (\array_key_exists('TrackingNumber', $data)) { + $values = []; + foreach ($data['TrackingNumber'] as $value) { + $values[] = $value; } - return $data; + $object->setTrackingNumber($values); + unset($data['TrackingNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PushToImageRepositoryRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('FormsHistoryDocumentID', $data)) { - $object->setFormsHistoryDocumentID($this->denormalizer->denormalize($data['FormsHistoryDocumentID'], \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestFormsHistoryDocumentID::class, 'json', $context)); - unset($data['FormsHistoryDocumentID']); - } - if (\array_key_exists('FormsGroupID', $data)) { - $object->setFormsGroupID($data['FormsGroupID']); - unset($data['FormsGroupID']); - } - if (\array_key_exists('ShipmentIdentifier', $data)) { - $object->setShipmentIdentifier($data['ShipmentIdentifier']); - unset($data['ShipmentIdentifier']); - } - if (\array_key_exists('ShipmentDateAndTime', $data)) { - $object->setShipmentDateAndTime($data['ShipmentDateAndTime']); - unset($data['ShipmentDateAndTime']); - } - if (\array_key_exists('ShipmentType', $data)) { - $object->setShipmentType($data['ShipmentType']); - unset($data['ShipmentType']); - } - if (\array_key_exists('PRQConfirmationNumber', $data)) { - $object->setPRQConfirmationNumber($data['PRQConfirmationNumber']); - unset($data['PRQConfirmationNumber']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $values = []; - foreach ($data['TrackingNumber'] as $value) { - $values[] = $value; - } - $object->setTrackingNumber($values); - unset($data['TrackingNumber']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + $dataArray['FormsHistoryDocumentID'] = $this->normalizer->normalize($data->getFormsHistoryDocumentID(), 'json', $context); + if ($data->isInitialized('formsGroupID') && null !== $data->getFormsGroupID()) { + $dataArray['FormsGroupID'] = $data->getFormsGroupID(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['FormsHistoryDocumentID'] = $this->normalizer->normalize($object->getFormsHistoryDocumentID(), 'json', $context); - if ($object->isInitialized('formsGroupID') && null !== $object->getFormsGroupID()) { - $data['FormsGroupID'] = $object->getFormsGroupID(); - } - $data['ShipmentIdentifier'] = $object->getShipmentIdentifier(); - if ($object->isInitialized('shipmentDateAndTime') && null !== $object->getShipmentDateAndTime()) { - $data['ShipmentDateAndTime'] = $object->getShipmentDateAndTime(); - } - $data['ShipmentType'] = $object->getShipmentType(); - if ($object->isInitialized('pRQConfirmationNumber') && null !== $object->getPRQConfirmationNumber()) { - $data['PRQConfirmationNumber'] = $object->getPRQConfirmationNumber(); - } - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $values = []; - foreach ($object->getTrackingNumber() as $value) { - $values[] = $value; - } - $data['TrackingNumber'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + $dataArray['ShipmentIdentifier'] = $data->getShipmentIdentifier(); + if ($data->isInitialized('shipmentDateAndTime') && null !== $data->getShipmentDateAndTime()) { + $dataArray['ShipmentDateAndTime'] = $data->getShipmentDateAndTime(); + } + $dataArray['ShipmentType'] = $data->getShipmentType(); + if ($data->isInitialized('pRQConfirmationNumber') && null !== $data->getPRQConfirmationNumber()) { + $dataArray['PRQConfirmationNumber'] = $data->getPRQConfirmationNumber(); + } + if ($data->isInitialized('trackingNumber') && null !== $data->getTrackingNumber()) { + $values = []; + foreach ($data->getTrackingNumber() as $value) { + $values[] = $value; } - return $data; + $dataArray['TrackingNumber'] = $values; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PushToImageRepositoryRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PushToImageRepositoryRequestRequestNormalizer.php b/src/Api/Normalizer/PushToImageRepositoryRequestRequestNormalizer.php index 32e446d8..9eb138f1 100644 --- a/src/Api/Normalizer/PushToImageRepositoryRequestRequestNormalizer.php +++ b/src/Api/Normalizer/PushToImageRepositoryRequestRequestNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PushToImageRepositoryRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PushToImageRepositoryRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); + } + if (\array_key_exists('SubVersion', $data)) { + $object->setSubVersion($data['SubVersion']); + unset($data['SubVersion']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class => false]; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class PushToImageRepositoryRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('requestOption') && null !== $data->getRequestOption()) { + $dataArray['RequestOption'] = $data->getRequestOption(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class; + if ($data->isInitialized('subVersion') && null !== $data->getSubVersion()) { + $dataArray['SubVersion'] = $data->getSubVersion(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PushToImageRepositoryRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PushToImageRepositoryResponseNormalizer.php b/src/Api/Normalizer/PushToImageRepositoryResponseNormalizer.php index a4eda201..3e738cf9 100644 --- a/src/Api/Normalizer/PushToImageRepositoryResponseNormalizer.php +++ b/src/Api/Normalizer/PushToImageRepositoryResponseNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PushToImageRepositoryResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PushToImageRepositoryResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class; + return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('FormsGroupID', $data)) { - $object->setFormsGroupID($data['FormsGroupID']); - unset($data['FormsGroupID']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('formsGroupID') && null !== $object->getFormsGroupID()) { - $data['FormsGroupID'] = $object->getFormsGroupID(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class, 'json', $context)); + unset($data['Response']); + } + if (\array_key_exists('FormsGroupID', $data)) { + $object->setFormsGroupID($data['FormsGroupID']); + unset($data['FormsGroupID']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class PushToImageRepositoryResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + if ($data->isInitialized('formsGroupID') && null !== $data->getFormsGroupID()) { + $dataArray['FormsGroupID'] = $data->getFormsGroupID(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class, 'json', $context)); - unset($data['Response']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('FormsGroupID', $data)) { - $object->setFormsGroupID($data['FormsGroupID']); - unset($data['FormsGroupID']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('formsGroupID') && null !== $object->getFormsGroupID()) { - $data['FormsGroupID'] = $object->getFormsGroupID(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PushToImageRepositoryResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/PushToImageRepositoryResponseResponseNormalizer.php b/src/Api/Normalizer/PushToImageRepositoryResponseResponseNormalizer.php index 64927248..e4b30056 100644 --- a/src/Api/Normalizer/PushToImageRepositoryResponseResponseNormalizer.php +++ b/src/Api/Normalizer/PushToImageRepositoryResponseResponseNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PushToImageRepositoryResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class PushToImageRepositoryResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); + } + if (\array_key_exists('Alert', $data)) { + $values = []; + foreach ($data['Alert'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); } - return $data; + $object->setAlert($values); + unset($data['Alert']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class PushToImageRepositoryResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $values = []; + foreach ($data->getAlert() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Alert'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\PushToImageRepositoryResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/QUANTUMVIEWRequestWrapperNormalizer.php b/src/Api/Normalizer/QUANTUMVIEWRequestWrapperNormalizer.php index 70ff446e..3d1accae 100644 --- a/src/Api/Normalizer/QUANTUMVIEWRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/QUANTUMVIEWRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class QUANTUMVIEWRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class QUANTUMVIEWRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('QuantumViewRequest', $data)) { - $object->setQuantumViewRequest($this->denormalizer->denormalize($data['QuantumViewRequest'], \ShipStream\Ups\Api\Model\QuantumViewRequest::class, 'json', $context)); - unset($data['QuantumViewRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['QuantumViewRequest'] = $this->normalizer->normalize($object->getQuantumViewRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('QuantumViewRequest', $data)) { + $object->setQuantumViewRequest($this->denormalizer->denormalize($data['QuantumViewRequest'], \ShipStream\Ups\Api\Model\QuantumViewRequest::class, 'json', $context)); + unset($data['QuantumViewRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class QUANTUMVIEWRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['QuantumViewRequest'] = $this->normalizer->normalize($data->getQuantumViewRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('QuantumViewRequest', $data)) { - $object->setQuantumViewRequest($this->denormalizer->denormalize($data['QuantumViewRequest'], \ShipStream\Ups\Api\Model\QuantumViewRequest::class, 'json', $context)); - unset($data['QuantumViewRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['QuantumViewRequest'] = $this->normalizer->normalize($object->getQuantumViewRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\QUANTUMVIEWRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/QUANTUMVIEWResponseWrapperNormalizer.php b/src/Api/Normalizer/QUANTUMVIEWResponseWrapperNormalizer.php index 2bf75afc..a5c6a9cd 100644 --- a/src/Api/Normalizer/QUANTUMVIEWResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/QUANTUMVIEWResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class QUANTUMVIEWResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class QUANTUMVIEWResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('QuantumViewResponse', $data)) { - $object->setQuantumViewResponse($this->denormalizer->denormalize($data['QuantumViewResponse'], \ShipStream\Ups\Api\Model\QuantumViewResponse::class, 'json', $context)); - unset($data['QuantumViewResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['QuantumViewResponse'] = $this->normalizer->normalize($object->getQuantumViewResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('QuantumViewResponse', $data)) { + $object->setQuantumViewResponse($this->denormalizer->denormalize($data['QuantumViewResponse'], \ShipStream\Ups\Api\Model\QuantumViewResponse::class, 'json', $context)); + unset($data['QuantumViewResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class QUANTUMVIEWResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['QuantumViewResponse'] = $this->normalizer->normalize($data->getQuantumViewResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('QuantumViewResponse', $data)) { - $object->setQuantumViewResponse($this->denormalizer->denormalize($data['QuantumViewResponse'], \ShipStream\Ups\Api\Model\QuantumViewResponse::class, 'json', $context)); - unset($data['QuantumViewResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['QuantumViewResponse'] = $this->normalizer->normalize($object->getQuantumViewResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\QUANTUMVIEWResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/QuantumViewEventsSubscriptionEventsNormalizer.php b/src/Api/Normalizer/QuantumViewEventsSubscriptionEventsNormalizer.php index 42524388..4ca8a1ee 100644 --- a/src/Api/Normalizer/QuantumViewEventsSubscriptionEventsNormalizer.php +++ b/src/Api/Normalizer/QuantumViewEventsSubscriptionEventsNormalizer.php @@ -5,198 +5,98 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class QuantumViewEventsSubscriptionEventsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class QuantumViewEventsSubscriptionEventsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class; + return $type === \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('SubscriptionStatus', $data)) { - $object->setSubscriptionStatus($this->denormalizer->denormalize($data['SubscriptionStatus'], \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class, 'json', $context)); - unset($data['SubscriptionStatus']); - } - if (\array_key_exists('DateRange', $data)) { - $object->setDateRange($this->denormalizer->denormalize($data['DateRange'], \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class, 'json', $context)); - unset($data['DateRange']); - } - if (\array_key_exists('SubscriptionFile', $data)) { - $values = []; - foreach ($data['SubscriptionFile'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class, 'json', $context); - } - $object->setSubscriptionFile($values); - unset($data['SubscriptionFile']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - $data['SubscriptionStatus'] = $this->normalizer->normalize($object->getSubscriptionStatus(), 'json', $context); - if ($object->isInitialized('dateRange') && null !== $object->getDateRange()) { - $data['DateRange'] = $this->normalizer->normalize($object->getDateRange(), 'json', $context); - } - if ($object->isInitialized('subscriptionFile') && null !== $object->getSubscriptionFile()) { - $values = []; - foreach ($object->getSubscriptionFile() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['SubscriptionFile'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('SubscriptionStatus', $data)) { + $object->setSubscriptionStatus($this->denormalizer->denormalize($data['SubscriptionStatus'], \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class, 'json', $context)); + unset($data['SubscriptionStatus']); + } + if (\array_key_exists('DateRange', $data)) { + $object->setDateRange($this->denormalizer->denormalize($data['DateRange'], \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class, 'json', $context)); + unset($data['DateRange']); + } + if (\array_key_exists('SubscriptionFile', $data)) { + $values = []; + foreach ($data['SubscriptionFile'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class, 'json', $context); } - return $data; + $object->setSubscriptionFile($values); + unset($data['SubscriptionFile']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class QuantumViewEventsSubscriptionEventsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class; + $dataArray = []; + if ($data->isInitialized('name') && null !== $data->getName()) { + $dataArray['Name'] = $data->getName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('SubscriptionStatus', $data)) { - $object->setSubscriptionStatus($this->denormalizer->denormalize($data['SubscriptionStatus'], \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class, 'json', $context)); - unset($data['SubscriptionStatus']); - } - if (\array_key_exists('DateRange', $data)) { - $object->setDateRange($this->denormalizer->denormalize($data['DateRange'], \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class, 'json', $context)); - unset($data['DateRange']); - } - if (\array_key_exists('SubscriptionFile', $data)) { - $values = []; - foreach ($data['SubscriptionFile'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class, 'json', $context); - } - $object->setSubscriptionFile($values); - unset($data['SubscriptionFile']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray['SubscriptionStatus'] = $this->normalizer->normalize($data->getSubscriptionStatus(), 'json', $context); + if ($data->isInitialized('dateRange') && null !== $data->getDateRange()) { + $dataArray['DateRange'] = $this->normalizer->normalize($data->getDateRange(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - $data['SubscriptionStatus'] = $this->normalizer->normalize($object->getSubscriptionStatus(), 'json', $context); - if ($object->isInitialized('dateRange') && null !== $object->getDateRange()) { - $data['DateRange'] = $this->normalizer->normalize($object->getDateRange(), 'json', $context); - } - if ($object->isInitialized('subscriptionFile') && null !== $object->getSubscriptionFile()) { - $values = []; - foreach ($object->getSubscriptionFile() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['SubscriptionFile'] = $values; + if ($data->isInitialized('subscriptionFile') && null !== $data->getSubscriptionFile()) { + $values = []; + foreach ($data->getSubscriptionFile() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $dataArray['SubscriptionFile'] = $values; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/QuantumViewRequestNormalizer.php b/src/Api/Normalizer/QuantumViewRequestNormalizer.php index a94a6000..fd6e8349 100644 --- a/src/Api/Normalizer/QuantumViewRequestNormalizer.php +++ b/src/Api/Normalizer/QuantumViewRequestNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class QuantumViewRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class QuantumViewRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewRequest::class; + return $type === \ShipStream\Ups\Api\Model\QuantumViewRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('SubscriptionRequest', $data)) { - $values = []; - foreach ($data['SubscriptionRequest'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class, 'json', $context); - } - $object->setSubscriptionRequest($values); - unset($data['SubscriptionRequest']); - } - if (\array_key_exists('Bookmark', $data)) { - $object->setBookmark($data['Bookmark']); - unset($data['Bookmark']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\QuantumViewRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('subscriptionRequest') && null !== $object->getSubscriptionRequest()) { - $values = []; - foreach ($object->getSubscriptionRequest() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['SubscriptionRequest'] = $values; - } - if ($object->isInitialized('bookmark') && null !== $object->getBookmark()) { - $data['Bookmark'] = $object->getBookmark(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class, 'json', $context)); + unset($data['Request']); + } + if (\array_key_exists('SubscriptionRequest', $data)) { + $values = []; + foreach ($data['SubscriptionRequest'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class, 'json', $context); } - return $data; + $object->setSubscriptionRequest($values); + unset($data['SubscriptionRequest']); + } + if (\array_key_exists('Bookmark', $data)) { + $object->setBookmark($data['Bookmark']); + unset($data['Bookmark']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewRequest::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class QuantumViewRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewRequest::class; + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + if ($data->isInitialized('subscriptionRequest') && null !== $data->getSubscriptionRequest()) { + $values = []; + foreach ($data->getSubscriptionRequest() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['SubscriptionRequest'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewRequest::class; + if ($data->isInitialized('bookmark') && null !== $data->getBookmark()) { + $dataArray['Bookmark'] = $data->getBookmark(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class, 'json', $context)); - unset($data['Request']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('SubscriptionRequest', $data)) { - $values = []; - foreach ($data['SubscriptionRequest'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class, 'json', $context); - } - $object->setSubscriptionRequest($values); - unset($data['SubscriptionRequest']); - } - if (\array_key_exists('Bookmark', $data)) { - $object->setBookmark($data['Bookmark']); - unset($data['Bookmark']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('subscriptionRequest') && null !== $object->getSubscriptionRequest()) { - $values = []; - foreach ($object->getSubscriptionRequest() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['SubscriptionRequest'] = $values; - } - if ($object->isInitialized('bookmark') && null !== $object->getBookmark()) { - $data['Bookmark'] = $object->getBookmark(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\QuantumViewRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/QuantumViewRequestRequestNormalizer.php b/src/Api/Normalizer/QuantumViewRequestRequestNormalizer.php index 0944a990..2d1d7a06 100644 --- a/src/Api/Normalizer/QuantumViewRequestRequestNormalizer.php +++ b/src/Api/Normalizer/QuantumViewRequestRequestNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class QuantumViewRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class QuantumViewRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - if (\array_key_exists('RequestAction', $data)) { - $object->setRequestAction($data['RequestAction']); - unset($data['RequestAction']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\QuantumViewRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - $data['RequestAction'] = $object->getRequestAction(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + if (\array_key_exists('RequestAction', $data)) { + $object->setRequestAction($data['RequestAction']); + unset($data['RequestAction']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class QuantumViewRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); + $dataArray['RequestAction'] = $data->getRequestAction(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('RequestAction', $data)) { - $object->setRequestAction($data['RequestAction']); - unset($data['RequestAction']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - $data['RequestAction'] = $object->getRequestAction(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\QuantumViewRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/QuantumViewRequestSubscriptionRequestNormalizer.php b/src/Api/Normalizer/QuantumViewRequestSubscriptionRequestNormalizer.php index 40f7410c..70324d47 100644 --- a/src/Api/Normalizer/QuantumViewRequestSubscriptionRequestNormalizer.php +++ b/src/Api/Normalizer/QuantumViewRequestSubscriptionRequestNormalizer.php @@ -5,174 +5,86 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class QuantumViewRequestSubscriptionRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class QuantumViewRequestSubscriptionRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class; + return $type === \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('DateTimeRange', $data)) { - $object->setDateTimeRange($this->denormalizer->denormalize($data['DateTimeRange'], \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class, 'json', $context)); - unset($data['DateTimeRange']); - } - if (\array_key_exists('FileName', $data)) { - $values = []; - foreach ($data['FileName'] as $value) { - $values[] = $value; - } - $object->setFileName($values); - unset($data['FileName']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('dateTimeRange') && null !== $object->getDateTimeRange()) { - $data['DateTimeRange'] = $this->normalizer->normalize($object->getDateTimeRange(), 'json', $context); - } - if ($object->isInitialized('fileName') && null !== $object->getFileName()) { - $values = []; - foreach ($object->getFileName() as $value) { - $values[] = $value; - } - $data['FileName'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('DateTimeRange', $data)) { + $object->setDateTimeRange($this->denormalizer->denormalize($data['DateTimeRange'], \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class, 'json', $context)); + unset($data['DateTimeRange']); + } + if (\array_key_exists('FileName', $data)) { + $values = []; + foreach ($data['FileName'] as $value) { + $values[] = $value; } - return $data; + $object->setFileName($values); + unset($data['FileName']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class QuantumViewRequestSubscriptionRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class; + $dataArray = []; + if ($data->isInitialized('name') && null !== $data->getName()) { + $dataArray['Name'] = $data->getName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class; + if ($data->isInitialized('dateTimeRange') && null !== $data->getDateTimeRange()) { + $dataArray['DateTimeRange'] = $this->normalizer->normalize($data->getDateTimeRange(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('DateTimeRange', $data)) { - $object->setDateTimeRange($this->denormalizer->denormalize($data['DateTimeRange'], \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class, 'json', $context)); - unset($data['DateTimeRange']); - } - if (\array_key_exists('FileName', $data)) { - $values = []; - foreach ($data['FileName'] as $value) { - $values[] = $value; - } - $object->setFileName($values); - unset($data['FileName']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + if ($data->isInitialized('fileName') && null !== $data->getFileName()) { + $values = []; + foreach ($data->getFileName() as $value) { + $values[] = $value; } - return $object; + $dataArray['FileName'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('dateTimeRange') && null !== $object->getDateTimeRange()) { - $data['DateTimeRange'] = $this->normalizer->normalize($object->getDateTimeRange(), 'json', $context); - } - if ($object->isInitialized('fileName') && null !== $object->getFileName()) { - $values = []; - foreach ($object->getFileName() as $value) { - $values[] = $value; - } - $data['FileName'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\QuantumViewRequestSubscriptionRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/QuantumViewResponseNormalizer.php b/src/Api/Normalizer/QuantumViewResponseNormalizer.php index 5d9e8c3c..ce6d0aed 100644 --- a/src/Api/Normalizer/QuantumViewResponseNormalizer.php +++ b/src/Api/Normalizer/QuantumViewResponseNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class QuantumViewResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class QuantumViewResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewResponse::class; + return $type === \ShipStream\Ups\Api\Model\QuantumViewResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('QuantumViewEvents', $data)) { - $object->setQuantumViewEvents($this->denormalizer->denormalize($data['QuantumViewEvents'], \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class, 'json', $context)); - unset($data['QuantumViewEvents']); - } - if (\array_key_exists('Bookmark', $data)) { - $object->setBookmark($data['Bookmark']); - unset($data['Bookmark']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\QuantumViewResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['QuantumViewEvents'] = $this->normalizer->normalize($object->getQuantumViewEvents(), 'json', $context); - if ($object->isInitialized('bookmark') && null !== $object->getBookmark()) { - $data['Bookmark'] = $object->getBookmark(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewResponse::class => false]; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class, 'json', $context)); + unset($data['Response']); } - } -} else { - class QuantumViewResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewResponse::class; + if (\array_key_exists('QuantumViewEvents', $data)) { + $object->setQuantumViewEvents($this->denormalizer->denormalize($data['QuantumViewEvents'], \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class, 'json', $context)); + unset($data['QuantumViewEvents']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewResponse::class; + if (\array_key_exists('Bookmark', $data)) { + $object->setBookmark($data['Bookmark']); + unset($data['Bookmark']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class, 'json', $context)); - unset($data['Response']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('QuantumViewEvents', $data)) { - $object->setQuantumViewEvents($this->denormalizer->denormalize($data['QuantumViewEvents'], \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class, 'json', $context)); - unset($data['QuantumViewEvents']); - } - if (\array_key_exists('Bookmark', $data)) { - $object->setBookmark($data['Bookmark']); - unset($data['Bookmark']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['QuantumViewEvents'] = $this->normalizer->normalize($object->getQuantumViewEvents(), 'json', $context); - if ($object->isInitialized('bookmark') && null !== $object->getBookmark()) { - $data['Bookmark'] = $object->getBookmark(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + $dataArray['QuantumViewEvents'] = $this->normalizer->normalize($data->getQuantumViewEvents(), 'json', $context); + if ($data->isInitialized('bookmark') && null !== $data->getBookmark()) { + $dataArray['Bookmark'] = $data->getBookmark(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewResponse::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\QuantumViewResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/QuantumViewResponseQuantumViewEventsNormalizer.php b/src/Api/Normalizer/QuantumViewResponseQuantumViewEventsNormalizer.php index 8068e2bc..d17ddede 100644 --- a/src/Api/Normalizer/QuantumViewResponseQuantumViewEventsNormalizer.php +++ b/src/Api/Normalizer/QuantumViewResponseQuantumViewEventsNormalizer.php @@ -5,152 +5,75 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class QuantumViewResponseQuantumViewEventsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class QuantumViewResponseQuantumViewEventsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class; + return $type === \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SubscriberID', $data)) { - $object->setSubscriberID($data['SubscriberID']); - unset($data['SubscriberID']); - } - if (\array_key_exists('SubscriptionEvents', $data)) { - $values = []; - foreach ($data['SubscriptionEvents'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class, 'json', $context); - } - $object->setSubscriptionEvents($values); - unset($data['SubscriptionEvents']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['SubscriberID'] = $object->getSubscriberID(); + if (\array_key_exists('SubscriberID', $data)) { + $object->setSubscriberID($data['SubscriberID']); + unset($data['SubscriberID']); + } + if (\array_key_exists('SubscriptionEvents', $data)) { $values = []; - foreach ($object->getSubscriptionEvents() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['SubscriptionEvents'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class, 'json', $context); } - $data['SubscriptionEvents'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setSubscriptionEvents($values); + unset($data['SubscriptionEvents']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class QuantumViewResponseQuantumViewEventsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class; + $dataArray = []; + $dataArray['SubscriberID'] = $data->getSubscriberID(); + $values = []; + foreach ($data->getSubscriptionEvents() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['SubscriptionEvents'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SubscriberID', $data)) { - $object->setSubscriberID($data['SubscriberID']); - unset($data['SubscriberID']); - } - if (\array_key_exists('SubscriptionEvents', $data)) { - $values = []; - foreach ($data['SubscriptionEvents'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\QuantumViewEventsSubscriptionEvents::class, 'json', $context); - } - $object->setSubscriptionEvents($values); - unset($data['SubscriptionEvents']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['SubscriberID'] = $object->getSubscriberID(); - $values = []; - foreach ($object->getSubscriptionEvents() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['SubscriptionEvents'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\QuantumViewResponseQuantumViewEvents::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/QuantumViewResponseResponseNormalizer.php b/src/Api/Normalizer/QuantumViewResponseResponseNormalizer.php index b2f0c2ae..53870ee9 100644 --- a/src/Api/Normalizer/QuantumViewResponseResponseNormalizer.php +++ b/src/Api/Normalizer/QuantumViewResponseResponseNormalizer.php @@ -5,180 +5,89 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class QuantumViewResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class QuantumViewResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - if (\array_key_exists('ResponseStatusCode', $data)) { - $object->setResponseStatusCode($data['ResponseStatusCode']); - unset($data['ResponseStatusCode']); - } - if (\array_key_exists('ResponseStatusDescription', $data)) { - $object->setResponseStatusDescription($data['ResponseStatusDescription']); - unset($data['ResponseStatusDescription']); - } - if (\array_key_exists('Error', $data)) { - $values = []; - foreach ($data['Error'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseError::class, 'json', $context); - } - $object->setError($values); - unset($data['Error']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\QuantumViewResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - $data['ResponseStatusCode'] = $object->getResponseStatusCode(); - if ($object->isInitialized('responseStatusDescription') && null !== $object->getResponseStatusDescription()) { - $data['ResponseStatusDescription'] = $object->getResponseStatusDescription(); - } - if ($object->isInitialized('error') && null !== $object->getError()) { - $values = []; - foreach ($object->getError() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Error'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + if (\array_key_exists('ResponseStatusCode', $data)) { + $object->setResponseStatusCode($data['ResponseStatusCode']); + unset($data['ResponseStatusCode']); + } + if (\array_key_exists('ResponseStatusDescription', $data)) { + $object->setResponseStatusDescription($data['ResponseStatusDescription']); + unset($data['ResponseStatusDescription']); + } + if (\array_key_exists('Error', $data)) { + $values = []; + foreach ($data['Error'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseError::class, 'json', $context); } - return $data; + $object->setError($values); + unset($data['Error']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class QuantumViewResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class; + $dataArray = []; + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); + $dataArray['ResponseStatusCode'] = $data->getResponseStatusCode(); + if ($data->isInitialized('responseStatusDescription') && null !== $data->getResponseStatusDescription()) { + $dataArray['ResponseStatusDescription'] = $data->getResponseStatusDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\QuantumViewResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - if (\array_key_exists('ResponseStatusCode', $data)) { - $object->setResponseStatusCode($data['ResponseStatusCode']); - unset($data['ResponseStatusCode']); - } - if (\array_key_exists('ResponseStatusDescription', $data)) { - $object->setResponseStatusDescription($data['ResponseStatusDescription']); - unset($data['ResponseStatusDescription']); + if ($data->isInitialized('error') && null !== $data->getError()) { + $values = []; + foreach ($data->getError() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - if (\array_key_exists('Error', $data)) { - $values = []; - foreach ($data['Error'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseError::class, 'json', $context); - } - $object->setError($values); - unset($data['Error']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray['Error'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - $data['ResponseStatusCode'] = $object->getResponseStatusCode(); - if ($object->isInitialized('responseStatusDescription') && null !== $object->getResponseStatusDescription()) { - $data['ResponseStatusDescription'] = $object->getResponseStatusDescription(); - } - if ($object->isInitialized('error') && null !== $object->getError()) { - $values = []; - foreach ($object->getError() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Error'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\QuantumViewResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RATERequestWrapperNormalizer.php b/src/Api/Normalizer/RATERequestWrapperNormalizer.php index 63c54ff3..f63935dd 100644 --- a/src/Api/Normalizer/RATERequestWrapperNormalizer.php +++ b/src/Api/Normalizer/RATERequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RATERequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RATERequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RATERequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\RATERequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RATERequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RATERequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RATERequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RateRequest', $data)) { - $object->setRateRequest($this->denormalizer->denormalize($data['RateRequest'], \ShipStream\Ups\Api\Model\RateRequest::class, 'json', $context)); - unset($data['RateRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RATERequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['RateRequest'] = $this->normalizer->normalize($object->getRateRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RateRequest', $data)) { + $object->setRateRequest($this->denormalizer->denormalize($data['RateRequest'], \ShipStream\Ups\Api\Model\RateRequest::class, 'json', $context)); + unset($data['RateRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RATERequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RATERequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RATERequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RATERequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RATERequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['RateRequest'] = $this->normalizer->normalize($data->getRateRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('RateRequest', $data)) { - $object->setRateRequest($this->denormalizer->denormalize($data['RateRequest'], \ShipStream\Ups\Api\Model\RateRequest::class, 'json', $context)); - unset($data['RateRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['RateRequest'] = $this->normalizer->normalize($object->getRateRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RATERequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RATERequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RATEResponseWrapperNormalizer.php b/src/Api/Normalizer/RATEResponseWrapperNormalizer.php index 23366040..63c2322c 100644 --- a/src/Api/Normalizer/RATEResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/RATEResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RATEResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RATEResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RATEResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\RATEResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RATEResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RATEResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RATEResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RateResponse', $data)) { - $object->setRateResponse($this->denormalizer->denormalize($data['RateResponse'], \ShipStream\Ups\Api\Model\RateResponse::class, 'json', $context)); - unset($data['RateResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RATEResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['RateResponse'] = $this->normalizer->normalize($object->getRateResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RateResponse', $data)) { + $object->setRateResponse($this->denormalizer->denormalize($data['RateResponse'], \ShipStream\Ups\Api\Model\RateResponse::class, 'json', $context)); + unset($data['RateResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RATEResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RATEResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RATEResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RATEResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RATEResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['RateResponse'] = $this->normalizer->normalize($data->getRateResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('RateResponse', $data)) { - $object->setRateResponse($this->denormalizer->denormalize($data['RateResponse'], \ShipStream\Ups\Api\Model\RateResponse::class, 'json', $context)); - unset($data['RateResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['RateResponse'] = $this->normalizer->normalize($object->getRateResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RATEResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RATEResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateAlternateDeliveryAddressAddressNormalizer.php b/src/Api/Normalizer/RateAlternateDeliveryAddressAddressNormalizer.php index 6100143c..0c28a47a 100644 --- a/src/Api/Normalizer/RateAlternateDeliveryAddressAddressNormalizer.php +++ b/src/Api/Normalizer/RateAlternateDeliveryAddressAddressNormalizer.php @@ -5,222 +5,110 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateAlternateDeliveryAddressAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateAlternateDeliveryAddressAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialAddressIndicator', $data)) { - $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); - unset($data['ResidentialAddressIndicator']); - } - if (\array_key_exists('POBoxIndicator', $data)) { - $object->setPOBoxIndicator($data['POBoxIndicator']); - unset($data['POBoxIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - if ($object->isInitialized('residentialAddressIndicator') && null !== $object->getResidentialAddressIndicator()) { - $data['ResidentialAddressIndicator'] = $object->getResidentialAddressIndicator(); - } - if ($object->isInitialized('pOBoxIndicator') && null !== $object->getPOBoxIndicator()) { - $data['POBoxIndicator'] = $object->getPOBoxIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + if (\array_key_exists('ResidentialAddressIndicator', $data)) { + $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); + unset($data['ResidentialAddressIndicator']); + } + if (\array_key_exists('POBoxIndicator', $data)) { + $object->setPOBoxIndicator($data['POBoxIndicator']); + unset($data['POBoxIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class RateAlternateDeliveryAddressAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialAddressIndicator', $data)) { - $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); - unset($data['ResidentialAddressIndicator']); - } - if (\array_key_exists('POBoxIndicator', $data)) { - $object->setPOBoxIndicator($data['POBoxIndicator']); - unset($data['POBoxIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - if ($object->isInitialized('residentialAddressIndicator') && null !== $object->getResidentialAddressIndicator()) { - $data['ResidentialAddressIndicator'] = $object->getResidentialAddressIndicator(); - } - if ($object->isInitialized('pOBoxIndicator') && null !== $object->getPOBoxIndicator()) { - $data['POBoxIndicator'] = $object->getPOBoxIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $dataArray['AddressLine'] = $values; + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class => false]; + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); + } + $dataArray['CountryCode'] = $data->getCountryCode(); + if ($data->isInitialized('residentialAddressIndicator') && null !== $data->getResidentialAddressIndicator()) { + $dataArray['ResidentialAddressIndicator'] = $data->getResidentialAddressIndicator(); + } + if ($data->isInitialized('pOBoxIndicator') && null !== $data->getPOBoxIndicator()) { + $dataArray['POBoxIndicator'] = $data->getPOBoxIndicator(); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateBillThirdPartyAddressNormalizer.php b/src/Api/Normalizer/RateBillThirdPartyAddressNormalizer.php index ffa7339f..eb43199d 100644 --- a/src/Api/Normalizer/RateBillThirdPartyAddressNormalizer.php +++ b/src/Api/Normalizer/RateBillThirdPartyAddressNormalizer.php @@ -5,198 +5,98 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateBillThirdPartyAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateBillThirdPartyAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class; + return $type === \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); + if (\array_key_exists('AddressLine', $data)) { + $values = []; + foreach ($data['AddressLine'] as $value) { + $values[] = $value; } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } - } -} else { - class RateBillThirdPartyAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class; + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('addressLine') && null !== $data->getAddressLine()) { + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - return $data; + $dataArray['AddressLine'] = $values; + } + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class => false]; + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); + } + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateFactorNormalizer.php b/src/Api/Normalizer/RateFactorNormalizer.php index a69cbca1..f5d9d687 100644 --- a/src/Api/Normalizer/RateFactorNormalizer.php +++ b/src/Api/Normalizer/RateFactorNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateFactorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateFactorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateFactor::class; + return $type === \ShipStream\Ups\Api\Model\RateFactor::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateFactor::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateFactor::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateFactor(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateFactor(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Value'] = $object->getValue(); - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); + } + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateFactor::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RateFactorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateFactor::class; + $dataArray = []; + $dataArray['Value'] = $data->getValue(); + if ($data->isInitialized('unitOfMeasurement') && null !== $data->getUnitOfMeasurement()) { + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateFactor::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateFactor(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\FactorUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Value'] = $object->getValue(); - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateFactor::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateFactor::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatePackagePackageServiceOptionsNormalizer.php b/src/Api/Normalizer/RatePackagePackageServiceOptionsNormalizer.php index d0c7fb3b..123b263d 100644 --- a/src/Api/Normalizer/RatePackagePackageServiceOptionsNormalizer.php +++ b/src/Api/Normalizer/RatePackagePackageServiceOptionsNormalizer.php @@ -5,284 +5,141 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatePackagePackageServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatePackagePackageServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class; + return $type === \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DeliveryConfirmation', $data)) { - $object->setDeliveryConfirmation($this->denormalizer->denormalize($data['DeliveryConfirmation'], \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class, 'json', $context)); - unset($data['DeliveryConfirmation']); - } - if (\array_key_exists('AccessPointCOD', $data)) { - $object->setAccessPointCOD($this->denormalizer->denormalize($data['AccessPointCOD'], \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class, 'json', $context)); - unset($data['AccessPointCOD']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('DeclaredValue', $data)) { - $object->setDeclaredValue($this->denormalizer->denormalize($data['DeclaredValue'], \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class, 'json', $context)); - unset($data['DeclaredValue']); - } - if (\array_key_exists('ShipperDeclaredValue', $data)) { - $object->setShipperDeclaredValue($this->denormalizer->denormalize($data['ShipperDeclaredValue'], \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class, 'json', $context)); - unset($data['ShipperDeclaredValue']); - } - if (\array_key_exists('ShipperReleaseIndicator', $data)) { - $object->setShipperReleaseIndicator($data['ShipperReleaseIndicator']); - unset($data['ShipperReleaseIndicator']); - } - if (\array_key_exists('ProactiveIndicator', $data)) { - $object->setProactiveIndicator($data['ProactiveIndicator']); - unset($data['ProactiveIndicator']); - } - if (\array_key_exists('RefrigerationIndicator', $data)) { - $object->setRefrigerationIndicator($data['RefrigerationIndicator']); - unset($data['RefrigerationIndicator']); - } - if (\array_key_exists('Insurance', $data)) { - $object->setInsurance($this->denormalizer->denormalize($data['Insurance'], \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class, 'json', $context)); - unset($data['Insurance']); - } - if (\array_key_exists('UPSPremiumCareIndicator', $data)) { - $object->setUPSPremiumCareIndicator($data['UPSPremiumCareIndicator']); - unset($data['UPSPremiumCareIndicator']); - } - if (\array_key_exists('HazMat', $data)) { - $object->setHazMat($this->denormalizer->denormalize($data['HazMat'], \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class, 'json', $context)); - unset($data['HazMat']); - } - if (\array_key_exists('DryIce', $data)) { - $object->setDryIce($this->denormalizer->denormalize($data['DryIce'], \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class, 'json', $context)); - unset($data['DryIce']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('deliveryConfirmation') && null !== $object->getDeliveryConfirmation()) { - $data['DeliveryConfirmation'] = $this->normalizer->normalize($object->getDeliveryConfirmation(), 'json', $context); - } - if ($object->isInitialized('accessPointCOD') && null !== $object->getAccessPointCOD()) { - $data['AccessPointCOD'] = $this->normalizer->normalize($object->getAccessPointCOD(), 'json', $context); - } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('declaredValue') && null !== $object->getDeclaredValue()) { - $data['DeclaredValue'] = $this->normalizer->normalize($object->getDeclaredValue(), 'json', $context); - } - if ($object->isInitialized('shipperDeclaredValue') && null !== $object->getShipperDeclaredValue()) { - $data['ShipperDeclaredValue'] = $this->normalizer->normalize($object->getShipperDeclaredValue(), 'json', $context); - } - if ($object->isInitialized('shipperReleaseIndicator') && null !== $object->getShipperReleaseIndicator()) { - $data['ShipperReleaseIndicator'] = $object->getShipperReleaseIndicator(); - } - if ($object->isInitialized('proactiveIndicator') && null !== $object->getProactiveIndicator()) { - $data['ProactiveIndicator'] = $object->getProactiveIndicator(); - } - if ($object->isInitialized('refrigerationIndicator') && null !== $object->getRefrigerationIndicator()) { - $data['RefrigerationIndicator'] = $object->getRefrigerationIndicator(); - } - if ($object->isInitialized('insurance') && null !== $object->getInsurance()) { - $data['Insurance'] = $this->normalizer->normalize($object->getInsurance(), 'json', $context); - } - if ($object->isInitialized('uPSPremiumCareIndicator') && null !== $object->getUPSPremiumCareIndicator()) { - $data['UPSPremiumCareIndicator'] = $object->getUPSPremiumCareIndicator(); - } - if ($object->isInitialized('hazMat') && null !== $object->getHazMat()) { - $data['HazMat'] = $this->normalizer->normalize($object->getHazMat(), 'json', $context); - } - if ($object->isInitialized('dryIce') && null !== $object->getDryIce()) { - $data['DryIce'] = $this->normalizer->normalize($object->getDryIce(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DeliveryConfirmation', $data)) { + $object->setDeliveryConfirmation($this->denormalizer->denormalize($data['DeliveryConfirmation'], \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class, 'json', $context)); + unset($data['DeliveryConfirmation']); + } + if (\array_key_exists('AccessPointCOD', $data)) { + $object->setAccessPointCOD($this->denormalizer->denormalize($data['AccessPointCOD'], \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class, 'json', $context)); + unset($data['AccessPointCOD']); + } + if (\array_key_exists('COD', $data)) { + $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class, 'json', $context)); + unset($data['COD']); + } + if (\array_key_exists('DeclaredValue', $data)) { + $object->setDeclaredValue($this->denormalizer->denormalize($data['DeclaredValue'], \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class, 'json', $context)); + unset($data['DeclaredValue']); + } + if (\array_key_exists('ShipperDeclaredValue', $data)) { + $object->setShipperDeclaredValue($this->denormalizer->denormalize($data['ShipperDeclaredValue'], \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class, 'json', $context)); + unset($data['ShipperDeclaredValue']); + } + if (\array_key_exists('ShipperReleaseIndicator', $data)) { + $object->setShipperReleaseIndicator($data['ShipperReleaseIndicator']); + unset($data['ShipperReleaseIndicator']); + } + if (\array_key_exists('ProactiveIndicator', $data)) { + $object->setProactiveIndicator($data['ProactiveIndicator']); + unset($data['ProactiveIndicator']); + } + if (\array_key_exists('RefrigerationIndicator', $data)) { + $object->setRefrigerationIndicator($data['RefrigerationIndicator']); + unset($data['RefrigerationIndicator']); + } + if (\array_key_exists('Insurance', $data)) { + $object->setInsurance($this->denormalizer->denormalize($data['Insurance'], \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class, 'json', $context)); + unset($data['Insurance']); + } + if (\array_key_exists('UPSPremiumCareIndicator', $data)) { + $object->setUPSPremiumCareIndicator($data['UPSPremiumCareIndicator']); + unset($data['UPSPremiumCareIndicator']); + } + if (\array_key_exists('HazMat', $data)) { + $object->setHazMat($this->denormalizer->denormalize($data['HazMat'], \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class, 'json', $context)); + unset($data['HazMat']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class => false]; + if (\array_key_exists('DryIce', $data)) { + $object->setDryIce($this->denormalizer->denormalize($data['DryIce'], \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class, 'json', $context)); + unset($data['DryIce']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class RatePackagePackageServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class; + $dataArray = []; + if ($data->isInitialized('deliveryConfirmation') && null !== $data->getDeliveryConfirmation()) { + $dataArray['DeliveryConfirmation'] = $this->normalizer->normalize($data->getDeliveryConfirmation(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class; + if ($data->isInitialized('accessPointCOD') && null !== $data->getAccessPointCOD()) { + $dataArray['AccessPointCOD'] = $this->normalizer->normalize($data->getAccessPointCOD(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DeliveryConfirmation', $data)) { - $object->setDeliveryConfirmation($this->denormalizer->denormalize($data['DeliveryConfirmation'], \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class, 'json', $context)); - unset($data['DeliveryConfirmation']); - } - if (\array_key_exists('AccessPointCOD', $data)) { - $object->setAccessPointCOD($this->denormalizer->denormalize($data['AccessPointCOD'], \ShipStream\Ups\Api\Model\PackageServiceOptionsAccessPointCOD::class, 'json', $context)); - unset($data['AccessPointCOD']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\PackageServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('DeclaredValue', $data)) { - $object->setDeclaredValue($this->denormalizer->denormalize($data['DeclaredValue'], \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class, 'json', $context)); - unset($data['DeclaredValue']); - } - if (\array_key_exists('ShipperDeclaredValue', $data)) { - $object->setShipperDeclaredValue($this->denormalizer->denormalize($data['ShipperDeclaredValue'], \ShipStream\Ups\Api\Model\PackageServiceOptionsShipperDeclaredValue::class, 'json', $context)); - unset($data['ShipperDeclaredValue']); - } - if (\array_key_exists('ShipperReleaseIndicator', $data)) { - $object->setShipperReleaseIndicator($data['ShipperReleaseIndicator']); - unset($data['ShipperReleaseIndicator']); - } - if (\array_key_exists('ProactiveIndicator', $data)) { - $object->setProactiveIndicator($data['ProactiveIndicator']); - unset($data['ProactiveIndicator']); - } - if (\array_key_exists('RefrigerationIndicator', $data)) { - $object->setRefrigerationIndicator($data['RefrigerationIndicator']); - unset($data['RefrigerationIndicator']); - } - if (\array_key_exists('Insurance', $data)) { - $object->setInsurance($this->denormalizer->denormalize($data['Insurance'], \ShipStream\Ups\Api\Model\PackageServiceOptionsInsurance::class, 'json', $context)); - unset($data['Insurance']); - } - if (\array_key_exists('UPSPremiumCareIndicator', $data)) { - $object->setUPSPremiumCareIndicator($data['UPSPremiumCareIndicator']); - unset($data['UPSPremiumCareIndicator']); - } - if (\array_key_exists('HazMat', $data)) { - $object->setHazMat($this->denormalizer->denormalize($data['HazMat'], \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class, 'json', $context)); - unset($data['HazMat']); - } - if (\array_key_exists('DryIce', $data)) { - $object->setDryIce($this->denormalizer->denormalize($data['DryIce'], \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class, 'json', $context)); - unset($data['DryIce']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('cOD') && null !== $data->getCOD()) { + $dataArray['COD'] = $this->normalizer->normalize($data->getCOD(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('deliveryConfirmation') && null !== $object->getDeliveryConfirmation()) { - $data['DeliveryConfirmation'] = $this->normalizer->normalize($object->getDeliveryConfirmation(), 'json', $context); - } - if ($object->isInitialized('accessPointCOD') && null !== $object->getAccessPointCOD()) { - $data['AccessPointCOD'] = $this->normalizer->normalize($object->getAccessPointCOD(), 'json', $context); - } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('declaredValue') && null !== $object->getDeclaredValue()) { - $data['DeclaredValue'] = $this->normalizer->normalize($object->getDeclaredValue(), 'json', $context); - } - if ($object->isInitialized('shipperDeclaredValue') && null !== $object->getShipperDeclaredValue()) { - $data['ShipperDeclaredValue'] = $this->normalizer->normalize($object->getShipperDeclaredValue(), 'json', $context); - } - if ($object->isInitialized('shipperReleaseIndicator') && null !== $object->getShipperReleaseIndicator()) { - $data['ShipperReleaseIndicator'] = $object->getShipperReleaseIndicator(); - } - if ($object->isInitialized('proactiveIndicator') && null !== $object->getProactiveIndicator()) { - $data['ProactiveIndicator'] = $object->getProactiveIndicator(); - } - if ($object->isInitialized('refrigerationIndicator') && null !== $object->getRefrigerationIndicator()) { - $data['RefrigerationIndicator'] = $object->getRefrigerationIndicator(); - } - if ($object->isInitialized('insurance') && null !== $object->getInsurance()) { - $data['Insurance'] = $this->normalizer->normalize($object->getInsurance(), 'json', $context); - } - if ($object->isInitialized('uPSPremiumCareIndicator') && null !== $object->getUPSPremiumCareIndicator()) { - $data['UPSPremiumCareIndicator'] = $object->getUPSPremiumCareIndicator(); - } - if ($object->isInitialized('hazMat') && null !== $object->getHazMat()) { - $data['HazMat'] = $this->normalizer->normalize($object->getHazMat(), 'json', $context); - } - if ($object->isInitialized('dryIce') && null !== $object->getDryIce()) { - $data['DryIce'] = $this->normalizer->normalize($object->getDryIce(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('declaredValue') && null !== $data->getDeclaredValue()) { + $dataArray['DeclaredValue'] = $this->normalizer->normalize($data->getDeclaredValue(), 'json', $context); + } + if ($data->isInitialized('shipperDeclaredValue') && null !== $data->getShipperDeclaredValue()) { + $dataArray['ShipperDeclaredValue'] = $this->normalizer->normalize($data->getShipperDeclaredValue(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class => false]; + if ($data->isInitialized('shipperReleaseIndicator') && null !== $data->getShipperReleaseIndicator()) { + $dataArray['ShipperReleaseIndicator'] = $data->getShipperReleaseIndicator(); } + if ($data->isInitialized('proactiveIndicator') && null !== $data->getProactiveIndicator()) { + $dataArray['ProactiveIndicator'] = $data->getProactiveIndicator(); + } + if ($data->isInitialized('refrigerationIndicator') && null !== $data->getRefrigerationIndicator()) { + $dataArray['RefrigerationIndicator'] = $data->getRefrigerationIndicator(); + } + if ($data->isInitialized('insurance') && null !== $data->getInsurance()) { + $dataArray['Insurance'] = $this->normalizer->normalize($data->getInsurance(), 'json', $context); + } + if ($data->isInitialized('uPSPremiumCareIndicator') && null !== $data->getUPSPremiumCareIndicator()) { + $dataArray['UPSPremiumCareIndicator'] = $data->getUPSPremiumCareIndicator(); + } + if ($data->isInitialized('hazMat') && null !== $data->getHazMat()) { + $dataArray['HazMat'] = $this->normalizer->normalize($data->getHazMat(), 'json', $context); + } + if ($data->isInitialized('dryIce') && null !== $data->getDryIce()) { + $dataArray['DryIce'] = $this->normalizer->normalize($data->getDryIce(), 'json', $context); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatePackageServiceOptionsDeclaredValueNormalizer.php b/src/Api/Normalizer/RatePackageServiceOptionsDeclaredValueNormalizer.php index f2bd0d08..1e123987 100644 --- a/src/Api/Normalizer/RatePackageServiceOptionsDeclaredValueNormalizer.php +++ b/src/Api/Normalizer/RatePackageServiceOptionsDeclaredValueNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatePackageServiceOptionsDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatePackageServiceOptionsDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class; + return $type === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class => false]; - } - } -} else { - class RatePackageServiceOptionsDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeclaredValue::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatePackageServiceOptionsDeliveryConfirmationNormalizer.php b/src/Api/Normalizer/RatePackageServiceOptionsDeliveryConfirmationNormalizer.php index 6b3dbfb3..648f8a7e 100644 --- a/src/Api/Normalizer/RatePackageServiceOptionsDeliveryConfirmationNormalizer.php +++ b/src/Api/Normalizer/RatePackageServiceOptionsDeliveryConfirmationNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatePackageServiceOptionsDeliveryConfirmationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatePackageServiceOptionsDeliveryConfirmationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class; + return $type === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DCISType', $data)) { - $object->setDCISType($data['DCISType']); - unset($data['DCISType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['DCISType'] = $object->getDCISType(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DCISType', $data)) { + $object->setDCISType($data['DCISType']); + unset($data['DCISType']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RatePackageServiceOptionsDeliveryConfirmationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['DCISType'] = $data->getDCISType(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('DCISType', $data)) { - $object->setDCISType($data['DCISType']); - unset($data['DCISType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['DCISType'] = $object->getDCISType(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatePackageServiceOptionsDeliveryConfirmation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatePackageServiceOptionsDryIceNormalizer.php b/src/Api/Normalizer/RatePackageServiceOptionsDryIceNormalizer.php index 356ff23f..af26e7c0 100644 --- a/src/Api/Normalizer/RatePackageServiceOptionsDryIceNormalizer.php +++ b/src/Api/Normalizer/RatePackageServiceOptionsDryIceNormalizer.php @@ -5,164 +5,81 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatePackageServiceOptionsDryIceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatePackageServiceOptionsDryIceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class; + return $type === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('DryIceWeight', $data)) { - $object->setDryIceWeight($this->denormalizer->denormalize($data['DryIceWeight'], \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class, 'json', $context)); - unset($data['DryIceWeight']); - } - if (\array_key_exists('MedicalUseIndicator', $data)) { - $object->setMedicalUseIndicator($data['MedicalUseIndicator']); - unset($data['MedicalUseIndicator']); - } - if (\array_key_exists('AuditRequired', $data)) { - $object->setAuditRequired($data['AuditRequired']); - unset($data['AuditRequired']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['RegulationSet'] = $object->getRegulationSet(); - $data['DryIceWeight'] = $this->normalizer->normalize($object->getDryIceWeight(), 'json', $context); - if ($object->isInitialized('medicalUseIndicator') && null !== $object->getMedicalUseIndicator()) { - $data['MedicalUseIndicator'] = $object->getMedicalUseIndicator(); - } - if ($object->isInitialized('auditRequired') && null !== $object->getAuditRequired()) { - $data['AuditRequired'] = $object->getAuditRequired(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RegulationSet', $data)) { + $object->setRegulationSet($data['RegulationSet']); + unset($data['RegulationSet']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class => false]; + if (\array_key_exists('DryIceWeight', $data)) { + $object->setDryIceWeight($this->denormalizer->denormalize($data['DryIceWeight'], \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class, 'json', $context)); + unset($data['DryIceWeight']); } - } -} else { - class RatePackageServiceOptionsDryIceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class; + if (\array_key_exists('MedicalUseIndicator', $data)) { + $object->setMedicalUseIndicator($data['MedicalUseIndicator']); + unset($data['MedicalUseIndicator']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class; + if (\array_key_exists('AuditRequired', $data)) { + $object->setAuditRequired($data['AuditRequired']); + unset($data['AuditRequired']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RegulationSet', $data)) { - $object->setRegulationSet($data['RegulationSet']); - unset($data['RegulationSet']); - } - if (\array_key_exists('DryIceWeight', $data)) { - $object->setDryIceWeight($this->denormalizer->denormalize($data['DryIceWeight'], \ShipStream\Ups\Api\Model\DryIceDryIceWeight::class, 'json', $context)); - unset($data['DryIceWeight']); - } - if (\array_key_exists('MedicalUseIndicator', $data)) { - $object->setMedicalUseIndicator($data['MedicalUseIndicator']); - unset($data['MedicalUseIndicator']); - } - if (\array_key_exists('AuditRequired', $data)) { - $object->setAuditRequired($data['AuditRequired']); - unset($data['AuditRequired']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['RegulationSet'] = $object->getRegulationSet(); - $data['DryIceWeight'] = $this->normalizer->normalize($object->getDryIceWeight(), 'json', $context); - if ($object->isInitialized('medicalUseIndicator') && null !== $object->getMedicalUseIndicator()) { - $data['MedicalUseIndicator'] = $object->getMedicalUseIndicator(); - } - if ($object->isInitialized('auditRequired') && null !== $object->getAuditRequired()) { - $data['AuditRequired'] = $object->getAuditRequired(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['RegulationSet'] = $data->getRegulationSet(); + $dataArray['DryIceWeight'] = $this->normalizer->normalize($data->getDryIceWeight(), 'json', $context); + if ($data->isInitialized('medicalUseIndicator') && null !== $data->getMedicalUseIndicator()) { + $dataArray['MedicalUseIndicator'] = $data->getMedicalUseIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class => false]; + if ($data->isInitialized('auditRequired') && null !== $data->getAuditRequired()) { + $dataArray['AuditRequired'] = $data->getAuditRequired(); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatePackageServiceOptionsDryIce::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatePackageServiceOptionsHazMatNormalizer.php b/src/Api/Normalizer/RatePackageServiceOptionsHazMatNormalizer.php index 3e67ec9f..5932a6bf 100644 --- a/src/Api/Normalizer/RatePackageServiceOptionsHazMatNormalizer.php +++ b/src/Api/Normalizer/RatePackageServiceOptionsHazMatNormalizer.php @@ -5,198 +5,98 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatePackageServiceOptionsHazMatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatePackageServiceOptionsHazMatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class; + return $type === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageIdentifier', $data)) { - $object->setPackageIdentifier($data['PackageIdentifier']); - unset($data['PackageIdentifier']); - } - if (\array_key_exists('QValue', $data)) { - $object->setQValue($data['QValue']); - unset($data['QValue']); - } - if (\array_key_exists('OverPackedIndicator', $data)) { - $object->setOverPackedIndicator($data['OverPackedIndicator']); - unset($data['OverPackedIndicator']); - } - if (\array_key_exists('AllPackedInOneIndicator', $data)) { - $object->setAllPackedInOneIndicator($data['AllPackedInOneIndicator']); - unset($data['AllPackedInOneIndicator']); - } - if (\array_key_exists('HazMatChemicalRecord', $data)) { - $values = []; - foreach ($data['HazMatChemicalRecord'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class, 'json', $context); - } - $object->setHazMatChemicalRecord($values); - unset($data['HazMatChemicalRecord']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('packageIdentifier') && null !== $object->getPackageIdentifier()) { - $data['PackageIdentifier'] = $object->getPackageIdentifier(); - } - if ($object->isInitialized('qValue') && null !== $object->getQValue()) { - $data['QValue'] = $object->getQValue(); - } - if ($object->isInitialized('overPackedIndicator') && null !== $object->getOverPackedIndicator()) { - $data['OverPackedIndicator'] = $object->getOverPackedIndicator(); - } - if ($object->isInitialized('allPackedInOneIndicator') && null !== $object->getAllPackedInOneIndicator()) { - $data['AllPackedInOneIndicator'] = $object->getAllPackedInOneIndicator(); - } + if (\array_key_exists('PackageIdentifier', $data)) { + $object->setPackageIdentifier($data['PackageIdentifier']); + unset($data['PackageIdentifier']); + } + if (\array_key_exists('QValue', $data)) { + $object->setQValue($data['QValue']); + unset($data['QValue']); + } + if (\array_key_exists('OverPackedIndicator', $data)) { + $object->setOverPackedIndicator($data['OverPackedIndicator']); + unset($data['OverPackedIndicator']); + } + if (\array_key_exists('AllPackedInOneIndicator', $data)) { + $object->setAllPackedInOneIndicator($data['AllPackedInOneIndicator']); + unset($data['AllPackedInOneIndicator']); + } + if (\array_key_exists('HazMatChemicalRecord', $data)) { $values = []; - foreach ($object->getHazMatChemicalRecord() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['HazMatChemicalRecord'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data['HazMatChemicalRecord'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class, 'json', $context); } - return $data; + $object->setHazMatChemicalRecord($values); + unset($data['HazMatChemicalRecord']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class RatePackageServiceOptionsHazMatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class; + $dataArray = []; + if ($data->isInitialized('packageIdentifier') && null !== $data->getPackageIdentifier()) { + $dataArray['PackageIdentifier'] = $data->getPackageIdentifier(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class; + if ($data->isInitialized('qValue') && null !== $data->getQValue()) { + $dataArray['QValue'] = $data->getQValue(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageIdentifier', $data)) { - $object->setPackageIdentifier($data['PackageIdentifier']); - unset($data['PackageIdentifier']); - } - if (\array_key_exists('QValue', $data)) { - $object->setQValue($data['QValue']); - unset($data['QValue']); - } - if (\array_key_exists('OverPackedIndicator', $data)) { - $object->setOverPackedIndicator($data['OverPackedIndicator']); - unset($data['OverPackedIndicator']); - } - if (\array_key_exists('AllPackedInOneIndicator', $data)) { - $object->setAllPackedInOneIndicator($data['AllPackedInOneIndicator']); - unset($data['AllPackedInOneIndicator']); - } - if (\array_key_exists('HazMatChemicalRecord', $data)) { - $values = []; - foreach ($data['HazMatChemicalRecord'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\HazMatHazMatChemicalRecord::class, 'json', $context); - } - $object->setHazMatChemicalRecord($values); - unset($data['HazMatChemicalRecord']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('overPackedIndicator') && null !== $data->getOverPackedIndicator()) { + $dataArray['OverPackedIndicator'] = $data->getOverPackedIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('packageIdentifier') && null !== $object->getPackageIdentifier()) { - $data['PackageIdentifier'] = $object->getPackageIdentifier(); - } - if ($object->isInitialized('qValue') && null !== $object->getQValue()) { - $data['QValue'] = $object->getQValue(); - } - if ($object->isInitialized('overPackedIndicator') && null !== $object->getOverPackedIndicator()) { - $data['OverPackedIndicator'] = $object->getOverPackedIndicator(); - } - if ($object->isInitialized('allPackedInOneIndicator') && null !== $object->getAllPackedInOneIndicator()) { - $data['AllPackedInOneIndicator'] = $object->getAllPackedInOneIndicator(); - } - $values = []; - foreach ($object->getHazMatChemicalRecord() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['HazMatChemicalRecord'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('allPackedInOneIndicator') && null !== $data->getAllPackedInOneIndicator()) { + $dataArray['AllPackedInOneIndicator'] = $data->getAllPackedInOneIndicator(); + } + $values = []; + foreach ($data->getHazMatChemicalRecord() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class => false]; + $dataArray['HazMatChemicalRecord'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatePackageServiceOptionsHazMat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatePackageUPSPremierNormalizer.php b/src/Api/Normalizer/RatePackageUPSPremierNormalizer.php index 297296e3..385e9cff 100644 --- a/src/Api/Normalizer/RatePackageUPSPremierNormalizer.php +++ b/src/Api/Normalizer/RatePackageUPSPremierNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatePackageUPSPremierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatePackageUPSPremierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class; + return $type === \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatePackageUPSPremier(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Category', $data)) { - $object->setCategory($data['Category']); - unset($data['Category']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatePackageUPSPremier(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Category'] = $object->getCategory(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Category', $data)) { + $object->setCategory($data['Category']); + unset($data['Category']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatePackageUPSPremier::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RatePackageUPSPremierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatePackageUPSPremier(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Category'] = $data->getCategory(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Category', $data)) { - $object->setCategory($data['Category']); - unset($data['Category']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Category'] = $object->getCategory(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatePackageUPSPremier::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatePackageUPSPremier::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateRequestCustomerClassificationNormalizer.php b/src/Api/Normalizer/RateRequestCustomerClassificationNormalizer.php index 7e2d25bf..bcf29ecb 100644 --- a/src/Api/Normalizer/RateRequestCustomerClassificationNormalizer.php +++ b/src/Api/Normalizer/RateRequestCustomerClassificationNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateRequestCustomerClassificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateRequestCustomerClassificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class; + return $type === \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateRequestCustomerClassification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateRequestCustomerClassification(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RateRequestCustomerClassificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateRequestCustomerClassification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateRequestNormalizer.php b/src/Api/Normalizer/RateRequestNormalizer.php index a9480136..4c68b6a1 100644 --- a/src/Api/Normalizer/RateRequestNormalizer.php +++ b/src/Api/Normalizer/RateRequestNormalizer.php @@ -5,164 +5,81 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateRequest::class; + return $type === \ShipStream\Ups\Api\Model\RateRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\RateRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('PickupType', $data)) { - $object->setPickupType($this->denormalizer->denormalize($data['PickupType'], \ShipStream\Ups\Api\Model\RateRequestPickupType::class, 'json', $context)); - unset($data['PickupType']); - } - if (\array_key_exists('CustomerClassification', $data)) { - $object->setCustomerClassification($this->denormalizer->denormalize($data['CustomerClassification'], \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class, 'json', $context)); - unset($data['CustomerClassification']); - } - if (\array_key_exists('Shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\RateRequestShipment::class, 'json', $context)); - unset($data['Shipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('pickupType') && null !== $object->getPickupType()) { - $data['PickupType'] = $this->normalizer->normalize($object->getPickupType(), 'json', $context); - } - if ($object->isInitialized('customerClassification') && null !== $object->getCustomerClassification()) { - $data['CustomerClassification'] = $this->normalizer->normalize($object->getCustomerClassification(), 'json', $context); - } - $data['Shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\RateRequestRequest::class, 'json', $context)); + unset($data['Request']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateRequest::class => false]; + if (\array_key_exists('PickupType', $data)) { + $object->setPickupType($this->denormalizer->denormalize($data['PickupType'], \ShipStream\Ups\Api\Model\RateRequestPickupType::class, 'json', $context)); + unset($data['PickupType']); } - } -} else { - class RateRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateRequest::class; + if (\array_key_exists('CustomerClassification', $data)) { + $object->setCustomerClassification($this->denormalizer->denormalize($data['CustomerClassification'], \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class, 'json', $context)); + unset($data['CustomerClassification']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequest::class; + if (\array_key_exists('Shipment', $data)) { + $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\RateRequestShipment::class, 'json', $context)); + unset($data['Shipment']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\RateRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('PickupType', $data)) { - $object->setPickupType($this->denormalizer->denormalize($data['PickupType'], \ShipStream\Ups\Api\Model\RateRequestPickupType::class, 'json', $context)); - unset($data['PickupType']); - } - if (\array_key_exists('CustomerClassification', $data)) { - $object->setCustomerClassification($this->denormalizer->denormalize($data['CustomerClassification'], \ShipStream\Ups\Api\Model\RateRequestCustomerClassification::class, 'json', $context)); - unset($data['CustomerClassification']); - } - if (\array_key_exists('Shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\RateRequestShipment::class, 'json', $context)); - unset($data['Shipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('pickupType') && null !== $object->getPickupType()) { - $data['PickupType'] = $this->normalizer->normalize($object->getPickupType(), 'json', $context); - } - if ($object->isInitialized('customerClassification') && null !== $object->getCustomerClassification()) { - $data['CustomerClassification'] = $this->normalizer->normalize($object->getCustomerClassification(), 'json', $context); - } - $data['Shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + if ($data->isInitialized('pickupType') && null !== $data->getPickupType()) { + $dataArray['PickupType'] = $this->normalizer->normalize($data->getPickupType(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateRequest::class => false]; + if ($data->isInitialized('customerClassification') && null !== $data->getCustomerClassification()) { + $dataArray['CustomerClassification'] = $this->normalizer->normalize($data->getCustomerClassification(), 'json', $context); } + $dataArray['Shipment'] = $this->normalizer->normalize($data->getShipment(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateRequestPickupTypeNormalizer.php b/src/Api/Normalizer/RateRequestPickupTypeNormalizer.php index bcdece26..9fbdc712 100644 --- a/src/Api/Normalizer/RateRequestPickupTypeNormalizer.php +++ b/src/Api/Normalizer/RateRequestPickupTypeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateRequestPickupTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateRequestPickupTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateRequestPickupType::class; + return $type === \ShipStream\Ups\Api\Model\RateRequestPickupType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequestPickupType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequestPickupType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateRequestPickupType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateRequestPickupType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateRequestPickupType::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RateRequestPickupTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateRequestPickupType::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequestPickupType::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateRequestPickupType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateRequestPickupType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateRequestPickupType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateRequestRequestNormalizer.php b/src/Api/Normalizer/RateRequestRequestNormalizer.php index 71f6a8a6..4c652b6b 100644 --- a/src/Api/Normalizer/RateRequestRequestNormalizer.php +++ b/src/Api/Normalizer/RateRequestRequestNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\RateRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['RequestOption'] = $object->getRequestOption(); - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateRequestRequest::class => false]; + if (\array_key_exists('SubVersion', $data)) { + $object->setSubVersion($data['SubVersion']); + unset($data['SubVersion']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class RateRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateRequestRequest::class; + $dataArray = []; + $dataArray['RequestOption'] = $data->getRequestOption(); + if ($data->isInitialized('subVersion') && null !== $data->getSubVersion()) { + $dataArray['SubVersion'] = $data->getSubVersion(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequestRequest::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['RequestOption'] = $object->getRequestOption(); - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateRequestShipmentNormalizer.php b/src/Api/Normalizer/RateRequestShipmentNormalizer.php index 5035f26f..4b7d094d 100644 --- a/src/Api/Normalizer/RateRequestShipmentNormalizer.php +++ b/src/Api/Normalizer/RateRequestShipmentNormalizer.php @@ -5,472 +5,235 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateRequestShipment::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequestShipment::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateRequestShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('OriginRecordTransactionTimestamp', $data)) { - $object->setOriginRecordTransactionTimestamp($data['OriginRecordTransactionTimestamp']); - unset($data['OriginRecordTransactionTimestamp']); - } - if (\array_key_exists('Shipper', $data)) { - $object->setShipper($this->denormalizer->denormalize($data['Shipper'], \ShipStream\Ups\Api\Model\RateShipmentShipper::class, 'json', $context)); - unset($data['Shipper']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\RateShipmentShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('ShipFrom', $data)) { - $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class, 'json', $context)); - unset($data['ShipFrom']); - } - if (\array_key_exists('AlternateDeliveryAddress', $data)) { - $object->setAlternateDeliveryAddress($this->denormalizer->denormalize($data['AlternateDeliveryAddress'], \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class, 'json', $context)); - unset($data['AlternateDeliveryAddress']); - } - if (\array_key_exists('ShipmentIndicationType', $data)) { - $values = []; - foreach ($data['ShipmentIndicationType'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class, 'json', $context); - } - $object->setShipmentIndicationType($values); - unset($data['ShipmentIndicationType']); - } - if (\array_key_exists('PaymentDetails', $data)) { - $object->setPaymentDetails($this->denormalizer->denormalize($data['PaymentDetails'], \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class, 'json', $context)); - unset($data['PaymentDetails']); - } - if (\array_key_exists('FRSPaymentInformation', $data)) { - $object->setFRSPaymentInformation($this->denormalizer->denormalize($data['FRSPaymentInformation'], \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class, 'json', $context)); - unset($data['FRSPaymentInformation']); - } - if (\array_key_exists('FreightShipmentInformation', $data)) { - $object->setFreightShipmentInformation($this->denormalizer->denormalize($data['FreightShipmentInformation'], \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class, 'json', $context)); - unset($data['FreightShipmentInformation']); - } - if (\array_key_exists('GoodsNotInFreeCirculationIndicator', $data)) { - $object->setGoodsNotInFreeCirculationIndicator($data['GoodsNotInFreeCirculationIndicator']); - unset($data['GoodsNotInFreeCirculationIndicator']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('NumOfPieces', $data)) { - $object->setNumOfPieces($data['NumOfPieces']); - unset($data['NumOfPieces']); - } - if (\array_key_exists('ShipmentTotalWeight', $data)) { - $object->setShipmentTotalWeight($this->denormalizer->denormalize($data['ShipmentTotalWeight'], \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class, 'json', $context)); - unset($data['ShipmentTotalWeight']); - } - if (\array_key_exists('DocumentsOnlyIndicator', $data)) { - $object->setDocumentsOnlyIndicator($data['DocumentsOnlyIndicator']); - unset($data['DocumentsOnlyIndicator']); - } - if (\array_key_exists('Package', $data)) { - $values_1 = []; - foreach ($data['Package'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\RateShipmentPackage::class, 'json', $context); - } - $object->setPackage($values_1); - unset($data['Package']); - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('ShipmentRatingOptions', $data)) { - $object->setShipmentRatingOptions($this->denormalizer->denormalize($data['ShipmentRatingOptions'], \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class, 'json', $context)); - unset($data['ShipmentRatingOptions']); - } - if (\array_key_exists('InvoiceLineTotal', $data)) { - $object->setInvoiceLineTotal($this->denormalizer->denormalize($data['InvoiceLineTotal'], \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class, 'json', $context)); - unset($data['InvoiceLineTotal']); - } - if (\array_key_exists('RatingMethodRequestedIndicator', $data)) { - $object->setRatingMethodRequestedIndicator($data['RatingMethodRequestedIndicator']); - unset($data['RatingMethodRequestedIndicator']); - } - if (\array_key_exists('TaxInformationIndicator', $data)) { - $object->setTaxInformationIndicator($data['TaxInformationIndicator']); - unset($data['TaxInformationIndicator']); - } - if (\array_key_exists('PromotionalDiscountInformation', $data)) { - $object->setPromotionalDiscountInformation($this->denormalizer->denormalize($data['PromotionalDiscountInformation'], \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class, 'json', $context)); - unset($data['PromotionalDiscountInformation']); - } - if (\array_key_exists('DeliveryTimeInformation', $data)) { - $object->setDeliveryTimeInformation($this->denormalizer->denormalize($data['DeliveryTimeInformation'], \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class, 'json', $context)); - unset($data['DeliveryTimeInformation']); - } - if (\array_key_exists('MasterCartonIndicator', $data)) { - $object->setMasterCartonIndicator($data['MasterCartonIndicator']); - unset($data['MasterCartonIndicator']); - } - if (\array_key_exists('WWEShipmentIndicator', $data)) { - $object->setWWEShipmentIndicator($data['WWEShipmentIndicator']); - unset($data['WWEShipmentIndicator']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + return $type === \ShipStream\Ups\Api\Model\RateRequestShipment::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequestShipment::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\RateRequestShipment(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('originRecordTransactionTimestamp') && null !== $object->getOriginRecordTransactionTimestamp()) { - $data['OriginRecordTransactionTimestamp'] = $object->getOriginRecordTransactionTimestamp(); - } - $data['Shipper'] = $this->normalizer->normalize($object->getShipper(), 'json', $context); - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - if ($object->isInitialized('shipFrom') && null !== $object->getShipFrom()) { - $data['ShipFrom'] = $this->normalizer->normalize($object->getShipFrom(), 'json', $context); - } - if ($object->isInitialized('alternateDeliveryAddress') && null !== $object->getAlternateDeliveryAddress()) { - $data['AlternateDeliveryAddress'] = $this->normalizer->normalize($object->getAlternateDeliveryAddress(), 'json', $context); - } - if ($object->isInitialized('shipmentIndicationType') && null !== $object->getShipmentIndicationType()) { - $values = []; - foreach ($object->getShipmentIndicationType() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ShipmentIndicationType'] = $values; - } - if ($object->isInitialized('paymentDetails') && null !== $object->getPaymentDetails()) { - $data['PaymentDetails'] = $this->normalizer->normalize($object->getPaymentDetails(), 'json', $context); - } - if ($object->isInitialized('fRSPaymentInformation') && null !== $object->getFRSPaymentInformation()) { - $data['FRSPaymentInformation'] = $this->normalizer->normalize($object->getFRSPaymentInformation(), 'json', $context); - } - if ($object->isInitialized('freightShipmentInformation') && null !== $object->getFreightShipmentInformation()) { - $data['FreightShipmentInformation'] = $this->normalizer->normalize($object->getFreightShipmentInformation(), 'json', $context); - } - if ($object->isInitialized('goodsNotInFreeCirculationIndicator') && null !== $object->getGoodsNotInFreeCirculationIndicator()) { - $data['GoodsNotInFreeCirculationIndicator'] = $object->getGoodsNotInFreeCirculationIndicator(); - } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - } - if ($object->isInitialized('numOfPieces') && null !== $object->getNumOfPieces()) { - $data['NumOfPieces'] = $object->getNumOfPieces(); - } - if ($object->isInitialized('shipmentTotalWeight') && null !== $object->getShipmentTotalWeight()) { - $data['ShipmentTotalWeight'] = $this->normalizer->normalize($object->getShipmentTotalWeight(), 'json', $context); - } - if ($object->isInitialized('documentsOnlyIndicator') && null !== $object->getDocumentsOnlyIndicator()) { - $data['DocumentsOnlyIndicator'] = $object->getDocumentsOnlyIndicator(); + if (\array_key_exists('OriginRecordTransactionTimestamp', $data)) { + $object->setOriginRecordTransactionTimestamp($data['OriginRecordTransactionTimestamp']); + unset($data['OriginRecordTransactionTimestamp']); + } + if (\array_key_exists('Shipper', $data)) { + $object->setShipper($this->denormalizer->denormalize($data['Shipper'], \ShipStream\Ups\Api\Model\RateShipmentShipper::class, 'json', $context)); + unset($data['Shipper']); + } + if (\array_key_exists('ShipTo', $data)) { + $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\RateShipmentShipTo::class, 'json', $context)); + unset($data['ShipTo']); + } + if (\array_key_exists('ShipFrom', $data)) { + $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class, 'json', $context)); + unset($data['ShipFrom']); + } + if (\array_key_exists('AlternateDeliveryAddress', $data)) { + $object->setAlternateDeliveryAddress($this->denormalizer->denormalize($data['AlternateDeliveryAddress'], \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class, 'json', $context)); + unset($data['AlternateDeliveryAddress']); + } + if (\array_key_exists('ShipmentIndicationType', $data)) { + $values = []; + foreach ($data['ShipmentIndicationType'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class, 'json', $context); } + $object->setShipmentIndicationType($values); + unset($data['ShipmentIndicationType']); + } + if (\array_key_exists('PaymentDetails', $data)) { + $object->setPaymentDetails($this->denormalizer->denormalize($data['PaymentDetails'], \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class, 'json', $context)); + unset($data['PaymentDetails']); + } + if (\array_key_exists('FRSPaymentInformation', $data)) { + $object->setFRSPaymentInformation($this->denormalizer->denormalize($data['FRSPaymentInformation'], \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class, 'json', $context)); + unset($data['FRSPaymentInformation']); + } + if (\array_key_exists('FreightShipmentInformation', $data)) { + $object->setFreightShipmentInformation($this->denormalizer->denormalize($data['FreightShipmentInformation'], \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class, 'json', $context)); + unset($data['FreightShipmentInformation']); + } + if (\array_key_exists('GoodsNotInFreeCirculationIndicator', $data)) { + $object->setGoodsNotInFreeCirculationIndicator($data['GoodsNotInFreeCirculationIndicator']); + unset($data['GoodsNotInFreeCirculationIndicator']); + } + if (\array_key_exists('Service', $data)) { + $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); + unset($data['Service']); + } + if (\array_key_exists('NumOfPieces', $data)) { + $object->setNumOfPieces($data['NumOfPieces']); + unset($data['NumOfPieces']); + } + if (\array_key_exists('ShipmentTotalWeight', $data)) { + $object->setShipmentTotalWeight($this->denormalizer->denormalize($data['ShipmentTotalWeight'], \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class, 'json', $context)); + unset($data['ShipmentTotalWeight']); + } + if (\array_key_exists('DocumentsOnlyIndicator', $data)) { + $object->setDocumentsOnlyIndicator($data['DocumentsOnlyIndicator']); + unset($data['DocumentsOnlyIndicator']); + } + if (\array_key_exists('Package', $data)) { $values_1 = []; - foreach ($object->getPackage() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Package'] = $values_1; - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('shipmentRatingOptions') && null !== $object->getShipmentRatingOptions()) { - $data['ShipmentRatingOptions'] = $this->normalizer->normalize($object->getShipmentRatingOptions(), 'json', $context); - } - if ($object->isInitialized('invoiceLineTotal') && null !== $object->getInvoiceLineTotal()) { - $data['InvoiceLineTotal'] = $this->normalizer->normalize($object->getInvoiceLineTotal(), 'json', $context); - } - if ($object->isInitialized('ratingMethodRequestedIndicator') && null !== $object->getRatingMethodRequestedIndicator()) { - $data['RatingMethodRequestedIndicator'] = $object->getRatingMethodRequestedIndicator(); - } - if ($object->isInitialized('taxInformationIndicator') && null !== $object->getTaxInformationIndicator()) { - $data['TaxInformationIndicator'] = $object->getTaxInformationIndicator(); - } - if ($object->isInitialized('promotionalDiscountInformation') && null !== $object->getPromotionalDiscountInformation()) { - $data['PromotionalDiscountInformation'] = $this->normalizer->normalize($object->getPromotionalDiscountInformation(), 'json', $context); - } - if ($object->isInitialized('deliveryTimeInformation') && null !== $object->getDeliveryTimeInformation()) { - $data['DeliveryTimeInformation'] = $this->normalizer->normalize($object->getDeliveryTimeInformation(), 'json', $context); - } - if ($object->isInitialized('masterCartonIndicator') && null !== $object->getMasterCartonIndicator()) { - $data['MasterCartonIndicator'] = $object->getMasterCartonIndicator(); - } - if ($object->isInitialized('wWEShipmentIndicator') && null !== $object->getWWEShipmentIndicator()) { - $data['WWEShipmentIndicator'] = $object->getWWEShipmentIndicator(); + foreach ($data['Package'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\RateShipmentPackage::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; + $object->setPackage($values_1); + unset($data['Package']); + } + if (\array_key_exists('ShipmentServiceOptions', $data)) { + $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class, 'json', $context)); + unset($data['ShipmentServiceOptions']); + } + if (\array_key_exists('ShipmentRatingOptions', $data)) { + $object->setShipmentRatingOptions($this->denormalizer->denormalize($data['ShipmentRatingOptions'], \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class, 'json', $context)); + unset($data['ShipmentRatingOptions']); + } + if (\array_key_exists('InvoiceLineTotal', $data)) { + $object->setInvoiceLineTotal($this->denormalizer->denormalize($data['InvoiceLineTotal'], \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class, 'json', $context)); + unset($data['InvoiceLineTotal']); + } + if (\array_key_exists('RatingMethodRequestedIndicator', $data)) { + $object->setRatingMethodRequestedIndicator($data['RatingMethodRequestedIndicator']); + unset($data['RatingMethodRequestedIndicator']); + } + if (\array_key_exists('TaxInformationIndicator', $data)) { + $object->setTaxInformationIndicator($data['TaxInformationIndicator']); + unset($data['TaxInformationIndicator']); + } + if (\array_key_exists('PromotionalDiscountInformation', $data)) { + $object->setPromotionalDiscountInformation($this->denormalizer->denormalize($data['PromotionalDiscountInformation'], \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class, 'json', $context)); + unset($data['PromotionalDiscountInformation']); + } + if (\array_key_exists('DeliveryTimeInformation', $data)) { + $object->setDeliveryTimeInformation($this->denormalizer->denormalize($data['DeliveryTimeInformation'], \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class, 'json', $context)); + unset($data['DeliveryTimeInformation']); + } + if (\array_key_exists('MasterCartonIndicator', $data)) { + $object->setMasterCartonIndicator($data['MasterCartonIndicator']); + unset($data['MasterCartonIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateRequestShipment::class => false]; + if (\array_key_exists('WWEShipmentIndicator', $data)) { + $object->setWWEShipmentIndicator($data['WWEShipmentIndicator']); + unset($data['WWEShipmentIndicator']); } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } -} else { - class RateRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateRequestShipment::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateRequestShipment::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateRequestShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('OriginRecordTransactionTimestamp', $data)) { - $object->setOriginRecordTransactionTimestamp($data['OriginRecordTransactionTimestamp']); - unset($data['OriginRecordTransactionTimestamp']); - } - if (\array_key_exists('Shipper', $data)) { - $object->setShipper($this->denormalizer->denormalize($data['Shipper'], \ShipStream\Ups\Api\Model\RateShipmentShipper::class, 'json', $context)); - unset($data['Shipper']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\RateShipmentShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('ShipFrom', $data)) { - $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class, 'json', $context)); - unset($data['ShipFrom']); - } - if (\array_key_exists('AlternateDeliveryAddress', $data)) { - $object->setAlternateDeliveryAddress($this->denormalizer->denormalize($data['AlternateDeliveryAddress'], \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class, 'json', $context)); - unset($data['AlternateDeliveryAddress']); - } - if (\array_key_exists('ShipmentIndicationType', $data)) { - $values = []; - foreach ($data['ShipmentIndicationType'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class, 'json', $context); - } - $object->setShipmentIndicationType($values); - unset($data['ShipmentIndicationType']); - } - if (\array_key_exists('PaymentDetails', $data)) { - $object->setPaymentDetails($this->denormalizer->denormalize($data['PaymentDetails'], \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class, 'json', $context)); - unset($data['PaymentDetails']); - } - if (\array_key_exists('FRSPaymentInformation', $data)) { - $object->setFRSPaymentInformation($this->denormalizer->denormalize($data['FRSPaymentInformation'], \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class, 'json', $context)); - unset($data['FRSPaymentInformation']); - } - if (\array_key_exists('FreightShipmentInformation', $data)) { - $object->setFreightShipmentInformation($this->denormalizer->denormalize($data['FreightShipmentInformation'], \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class, 'json', $context)); - unset($data['FreightShipmentInformation']); - } - if (\array_key_exists('GoodsNotInFreeCirculationIndicator', $data)) { - $object->setGoodsNotInFreeCirculationIndicator($data['GoodsNotInFreeCirculationIndicator']); - unset($data['GoodsNotInFreeCirculationIndicator']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('NumOfPieces', $data)) { - $object->setNumOfPieces($data['NumOfPieces']); - unset($data['NumOfPieces']); - } - if (\array_key_exists('ShipmentTotalWeight', $data)) { - $object->setShipmentTotalWeight($this->denormalizer->denormalize($data['ShipmentTotalWeight'], \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class, 'json', $context)); - unset($data['ShipmentTotalWeight']); - } - if (\array_key_exists('DocumentsOnlyIndicator', $data)) { - $object->setDocumentsOnlyIndicator($data['DocumentsOnlyIndicator']); - unset($data['DocumentsOnlyIndicator']); - } - if (\array_key_exists('Package', $data)) { - $values_1 = []; - foreach ($data['Package'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\RateShipmentPackage::class, 'json', $context); - } - $object->setPackage($values_1); - unset($data['Package']); - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('ShipmentRatingOptions', $data)) { - $object->setShipmentRatingOptions($this->denormalizer->denormalize($data['ShipmentRatingOptions'], \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class, 'json', $context)); - unset($data['ShipmentRatingOptions']); - } - if (\array_key_exists('InvoiceLineTotal', $data)) { - $object->setInvoiceLineTotal($this->denormalizer->denormalize($data['InvoiceLineTotal'], \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class, 'json', $context)); - unset($data['InvoiceLineTotal']); - } - if (\array_key_exists('RatingMethodRequestedIndicator', $data)) { - $object->setRatingMethodRequestedIndicator($data['RatingMethodRequestedIndicator']); - unset($data['RatingMethodRequestedIndicator']); - } - if (\array_key_exists('TaxInformationIndicator', $data)) { - $object->setTaxInformationIndicator($data['TaxInformationIndicator']); - unset($data['TaxInformationIndicator']); - } - if (\array_key_exists('PromotionalDiscountInformation', $data)) { - $object->setPromotionalDiscountInformation($this->denormalizer->denormalize($data['PromotionalDiscountInformation'], \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class, 'json', $context)); - unset($data['PromotionalDiscountInformation']); - } - if (\array_key_exists('DeliveryTimeInformation', $data)) { - $object->setDeliveryTimeInformation($this->denormalizer->denormalize($data['DeliveryTimeInformation'], \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class, 'json', $context)); - unset($data['DeliveryTimeInformation']); - } - if (\array_key_exists('MasterCartonIndicator', $data)) { - $object->setMasterCartonIndicator($data['MasterCartonIndicator']); - unset($data['MasterCartonIndicator']); - } - if (\array_key_exists('WWEShipmentIndicator', $data)) { - $object->setWWEShipmentIndicator($data['WWEShipmentIndicator']); - unset($data['WWEShipmentIndicator']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('originRecordTransactionTimestamp') && null !== $data->getOriginRecordTransactionTimestamp()) { + $dataArray['OriginRecordTransactionTimestamp'] = $data->getOriginRecordTransactionTimestamp(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('originRecordTransactionTimestamp') && null !== $object->getOriginRecordTransactionTimestamp()) { - $data['OriginRecordTransactionTimestamp'] = $object->getOriginRecordTransactionTimestamp(); - } - $data['Shipper'] = $this->normalizer->normalize($object->getShipper(), 'json', $context); - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - if ($object->isInitialized('shipFrom') && null !== $object->getShipFrom()) { - $data['ShipFrom'] = $this->normalizer->normalize($object->getShipFrom(), 'json', $context); - } - if ($object->isInitialized('alternateDeliveryAddress') && null !== $object->getAlternateDeliveryAddress()) { - $data['AlternateDeliveryAddress'] = $this->normalizer->normalize($object->getAlternateDeliveryAddress(), 'json', $context); - } - if ($object->isInitialized('shipmentIndicationType') && null !== $object->getShipmentIndicationType()) { - $values = []; - foreach ($object->getShipmentIndicationType() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ShipmentIndicationType'] = $values; - } - if ($object->isInitialized('paymentDetails') && null !== $object->getPaymentDetails()) { - $data['PaymentDetails'] = $this->normalizer->normalize($object->getPaymentDetails(), 'json', $context); - } - if ($object->isInitialized('fRSPaymentInformation') && null !== $object->getFRSPaymentInformation()) { - $data['FRSPaymentInformation'] = $this->normalizer->normalize($object->getFRSPaymentInformation(), 'json', $context); - } - if ($object->isInitialized('freightShipmentInformation') && null !== $object->getFreightShipmentInformation()) { - $data['FreightShipmentInformation'] = $this->normalizer->normalize($object->getFreightShipmentInformation(), 'json', $context); - } - if ($object->isInitialized('goodsNotInFreeCirculationIndicator') && null !== $object->getGoodsNotInFreeCirculationIndicator()) { - $data['GoodsNotInFreeCirculationIndicator'] = $object->getGoodsNotInFreeCirculationIndicator(); - } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - } - if ($object->isInitialized('numOfPieces') && null !== $object->getNumOfPieces()) { - $data['NumOfPieces'] = $object->getNumOfPieces(); - } - if ($object->isInitialized('shipmentTotalWeight') && null !== $object->getShipmentTotalWeight()) { - $data['ShipmentTotalWeight'] = $this->normalizer->normalize($object->getShipmentTotalWeight(), 'json', $context); - } - if ($object->isInitialized('documentsOnlyIndicator') && null !== $object->getDocumentsOnlyIndicator()) { - $data['DocumentsOnlyIndicator'] = $object->getDocumentsOnlyIndicator(); - } - $values_1 = []; - foreach ($object->getPackage() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Package'] = $values_1; - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('shipmentRatingOptions') && null !== $object->getShipmentRatingOptions()) { - $data['ShipmentRatingOptions'] = $this->normalizer->normalize($object->getShipmentRatingOptions(), 'json', $context); - } - if ($object->isInitialized('invoiceLineTotal') && null !== $object->getInvoiceLineTotal()) { - $data['InvoiceLineTotal'] = $this->normalizer->normalize($object->getInvoiceLineTotal(), 'json', $context); - } - if ($object->isInitialized('ratingMethodRequestedIndicator') && null !== $object->getRatingMethodRequestedIndicator()) { - $data['RatingMethodRequestedIndicator'] = $object->getRatingMethodRequestedIndicator(); - } - if ($object->isInitialized('taxInformationIndicator') && null !== $object->getTaxInformationIndicator()) { - $data['TaxInformationIndicator'] = $object->getTaxInformationIndicator(); - } - if ($object->isInitialized('promotionalDiscountInformation') && null !== $object->getPromotionalDiscountInformation()) { - $data['PromotionalDiscountInformation'] = $this->normalizer->normalize($object->getPromotionalDiscountInformation(), 'json', $context); - } - if ($object->isInitialized('deliveryTimeInformation') && null !== $object->getDeliveryTimeInformation()) { - $data['DeliveryTimeInformation'] = $this->normalizer->normalize($object->getDeliveryTimeInformation(), 'json', $context); - } - if ($object->isInitialized('masterCartonIndicator') && null !== $object->getMasterCartonIndicator()) { - $data['MasterCartonIndicator'] = $object->getMasterCartonIndicator(); - } - if ($object->isInitialized('wWEShipmentIndicator') && null !== $object->getWWEShipmentIndicator()) { - $data['WWEShipmentIndicator'] = $object->getWWEShipmentIndicator(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $dataArray['Shipper'] = $this->normalizer->normalize($data->getShipper(), 'json', $context); + $dataArray['ShipTo'] = $this->normalizer->normalize($data->getShipTo(), 'json', $context); + if ($data->isInitialized('shipFrom') && null !== $data->getShipFrom()) { + $dataArray['ShipFrom'] = $this->normalizer->normalize($data->getShipFrom(), 'json', $context); + } + if ($data->isInitialized('alternateDeliveryAddress') && null !== $data->getAlternateDeliveryAddress()) { + $dataArray['AlternateDeliveryAddress'] = $this->normalizer->normalize($data->getAlternateDeliveryAddress(), 'json', $context); + } + if ($data->isInitialized('shipmentIndicationType') && null !== $data->getShipmentIndicationType()) { + $values = []; + foreach ($data->getShipmentIndicationType() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $data; + $dataArray['ShipmentIndicationType'] = $values; + } + if ($data->isInitialized('paymentDetails') && null !== $data->getPaymentDetails()) { + $dataArray['PaymentDetails'] = $this->normalizer->normalize($data->getPaymentDetails(), 'json', $context); + } + if ($data->isInitialized('fRSPaymentInformation') && null !== $data->getFRSPaymentInformation()) { + $dataArray['FRSPaymentInformation'] = $this->normalizer->normalize($data->getFRSPaymentInformation(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateRequestShipment::class => false]; + if ($data->isInitialized('freightShipmentInformation') && null !== $data->getFreightShipmentInformation()) { + $dataArray['FreightShipmentInformation'] = $this->normalizer->normalize($data->getFreightShipmentInformation(), 'json', $context); } + if ($data->isInitialized('goodsNotInFreeCirculationIndicator') && null !== $data->getGoodsNotInFreeCirculationIndicator()) { + $dataArray['GoodsNotInFreeCirculationIndicator'] = $data->getGoodsNotInFreeCirculationIndicator(); + } + if ($data->isInitialized('service') && null !== $data->getService()) { + $dataArray['Service'] = $this->normalizer->normalize($data->getService(), 'json', $context); + } + if ($data->isInitialized('numOfPieces') && null !== $data->getNumOfPieces()) { + $dataArray['NumOfPieces'] = $data->getNumOfPieces(); + } + if ($data->isInitialized('shipmentTotalWeight') && null !== $data->getShipmentTotalWeight()) { + $dataArray['ShipmentTotalWeight'] = $this->normalizer->normalize($data->getShipmentTotalWeight(), 'json', $context); + } + if ($data->isInitialized('documentsOnlyIndicator') && null !== $data->getDocumentsOnlyIndicator()) { + $dataArray['DocumentsOnlyIndicator'] = $data->getDocumentsOnlyIndicator(); + } + $values_1 = []; + foreach ($data->getPackage() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + } + $dataArray['Package'] = $values_1; + if ($data->isInitialized('shipmentServiceOptions') && null !== $data->getShipmentServiceOptions()) { + $dataArray['ShipmentServiceOptions'] = $this->normalizer->normalize($data->getShipmentServiceOptions(), 'json', $context); + } + if ($data->isInitialized('shipmentRatingOptions') && null !== $data->getShipmentRatingOptions()) { + $dataArray['ShipmentRatingOptions'] = $this->normalizer->normalize($data->getShipmentRatingOptions(), 'json', $context); + } + if ($data->isInitialized('invoiceLineTotal') && null !== $data->getInvoiceLineTotal()) { + $dataArray['InvoiceLineTotal'] = $this->normalizer->normalize($data->getInvoiceLineTotal(), 'json', $context); + } + if ($data->isInitialized('ratingMethodRequestedIndicator') && null !== $data->getRatingMethodRequestedIndicator()) { + $dataArray['RatingMethodRequestedIndicator'] = $data->getRatingMethodRequestedIndicator(); + } + if ($data->isInitialized('taxInformationIndicator') && null !== $data->getTaxInformationIndicator()) { + $dataArray['TaxInformationIndicator'] = $data->getTaxInformationIndicator(); + } + if ($data->isInitialized('promotionalDiscountInformation') && null !== $data->getPromotionalDiscountInformation()) { + $dataArray['PromotionalDiscountInformation'] = $this->normalizer->normalize($data->getPromotionalDiscountInformation(), 'json', $context); + } + if ($data->isInitialized('deliveryTimeInformation') && null !== $data->getDeliveryTimeInformation()) { + $dataArray['DeliveryTimeInformation'] = $this->normalizer->normalize($data->getDeliveryTimeInformation(), 'json', $context); + } + if ($data->isInitialized('masterCartonIndicator') && null !== $data->getMasterCartonIndicator()) { + $dataArray['MasterCartonIndicator'] = $data->getMasterCartonIndicator(); + } + if ($data->isInitialized('wWEShipmentIndicator') && null !== $data->getWWEShipmentIndicator()) { + $dataArray['WWEShipmentIndicator'] = $data->getWWEShipmentIndicator(); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateRequestShipment::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateResponseNormalizer.php b/src/Api/Normalizer/RateResponseNormalizer.php index 34fc4556..1441601e 100644 --- a/src/Api/Normalizer/RateResponseNormalizer.php +++ b/src/Api/Normalizer/RateResponseNormalizer.php @@ -5,152 +5,75 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateResponse::class; + return $type === \ShipStream\Ups\Api\Model\RateResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\RateResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('RatedShipment', $data)) { - $values = []; - foreach ($data['RatedShipment'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class, 'json', $context); - } - $object->setRatedShipment($values); - unset($data['RatedShipment']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\RateResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\RateResponseResponse::class, 'json', $context)); + unset($data['Response']); + } + if (\array_key_exists('RatedShipment', $data)) { $values = []; - foreach ($object->getRatedShipment() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['RatedShipment'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class, 'json', $context); } - $data['RatedShipment'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setRatedShipment($values); + unset($data['RatedShipment']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class RateResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResponse::class; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + $values = []; + foreach ($data->getRatedShipment() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['RatedShipment'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\RateResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('RatedShipment', $data)) { - $values = []; - foreach ($data['RatedShipment'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class, 'json', $context); - } - $object->setRatedShipment($values); - unset($data['RatedShipment']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $values = []; - foreach ($object->getRatedShipment() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['RatedShipment'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateResponseRatedShipmentNormalizer.php b/src/Api/Normalizer/RateResponseRatedShipmentNormalizer.php index 045f57c6..a7516fcc 100644 --- a/src/Api/Normalizer/RateResponseRatedShipmentNormalizer.php +++ b/src/Api/Normalizer/RateResponseRatedShipmentNormalizer.php @@ -5,458 +5,228 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateResponseRatedShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateResponseRatedShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateResponseRatedShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Disclaimer', $data)) { - $values = []; - foreach ($data['Disclaimer'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class, 'json', $context); - } - $object->setDisclaimer($values); - unset($data['Disclaimer']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\RatedShipmentService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('RateChart', $data)) { - $object->setRateChart($data['RateChart']); - unset($data['RateChart']); - } - if (\array_key_exists('RatedShipmentAlert', $data)) { - $values_1 = []; - foreach ($data['RatedShipmentAlert'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class, 'json', $context); - } - $object->setRatedShipmentAlert($values_1); - unset($data['RatedShipmentAlert']); - } - if (\array_key_exists('BillableWeightCalculationMethod', $data)) { - $object->setBillableWeightCalculationMethod($data['BillableWeightCalculationMethod']); - unset($data['BillableWeightCalculationMethod']); - } - if (\array_key_exists('RatingMethod', $data)) { - $object->setRatingMethod($data['RatingMethod']); - unset($data['RatingMethod']); - } - if (\array_key_exists('BillingWeight', $data)) { - $object->setBillingWeight($this->denormalizer->denormalize($data['BillingWeight'], \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class, 'json', $context)); - unset($data['BillingWeight']); - } - if (\array_key_exists('TransportationCharges', $data)) { - $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class, 'json', $context)); - unset($data['TransportationCharges']); - } - if (\array_key_exists('BaseServiceCharge', $data)) { - $object->setBaseServiceCharge($this->denormalizer->denormalize($data['BaseServiceCharge'], \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class, 'json', $context)); - unset($data['BaseServiceCharge']); - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values_2 = []; - foreach ($data['ItemizedCharges'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values_2); - unset($data['ItemizedCharges']); - } - if (\array_key_exists('FRSShipmentData', $data)) { - $object->setFRSShipmentData($this->denormalizer->denormalize($data['FRSShipmentData'], \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class, 'json', $context)); - unset($data['FRSShipmentData']); - } - if (\array_key_exists('ServiceOptionsCharges', $data)) { - $object->setServiceOptionsCharges($this->denormalizer->denormalize($data['ServiceOptionsCharges'], \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class, 'json', $context)); - unset($data['ServiceOptionsCharges']); - } - if (\array_key_exists('TaxCharges', $data)) { - $values_3 = []; - foreach ($data['TaxCharges'] as $value_3) { - $values_3[] = $this->denormalizer->denormalize($value_3, \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class, 'json', $context); - } - $object->setTaxCharges($values_3); - unset($data['TaxCharges']); - } - if (\array_key_exists('TotalCharges', $data)) { - $object->setTotalCharges($this->denormalizer->denormalize($data['TotalCharges'], \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class, 'json', $context)); - unset($data['TotalCharges']); - } - if (\array_key_exists('TotalChargesWithTaxes', $data)) { - $object->setTotalChargesWithTaxes($this->denormalizer->denormalize($data['TotalChargesWithTaxes'], \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class, 'json', $context)); - unset($data['TotalChargesWithTaxes']); - } - if (\array_key_exists('NegotiatedRateCharges', $data) && $data['NegotiatedRateCharges'] !== null) { - $object->setNegotiatedRateCharges($this->denormalizer->denormalize($data['NegotiatedRateCharges'], \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class, 'json', $context)); - unset($data['NegotiatedRateCharges']); - } - elseif (\array_key_exists('NegotiatedRateCharges', $data) && $data['NegotiatedRateCharges'] === null) { - $object->setNegotiatedRateCharges(null); - } - if (\array_key_exists('RatedPackage', $data)) { - $values_4 = []; - foreach ($data['RatedPackage'] as $value_4) { - $values_4[] = $this->denormalizer->denormalize($value_4, \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class, 'json', $context); - } - $object->setRatedPackage($values_4); - unset($data['RatedPackage']); - } - if (\array_key_exists('TimeInTransit', $data)) { - $object->setTimeInTransit($this->denormalizer->denormalize($data['TimeInTransit'], \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class, 'json', $context)); - unset($data['TimeInTransit']); - } - if (\array_key_exists('ScheduledDeliveryDate', $data)) { - $object->setScheduledDeliveryDate($data['ScheduledDeliveryDate']); - unset($data['ScheduledDeliveryDate']); - } - if (\array_key_exists('RoarRatedIndicator', $data)) { - $object->setRoarRatedIndicator($data['RoarRatedIndicator']); - unset($data['RoarRatedIndicator']); - } - foreach ($data as $key => $value_5) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_5; - } - } + return $type === \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\RateResponseRatedShipment(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $values = []; - foreach ($object->getDisclaimer() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Disclaimer'] = $values; - } - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - if ($object->isInitialized('rateChart') && null !== $object->getRateChart()) { - $data['RateChart'] = $object->getRateChart(); - } - if ($object->isInitialized('ratedShipmentAlert') && null !== $object->getRatedShipmentAlert()) { - $values_1 = []; - foreach ($object->getRatedShipmentAlert() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['RatedShipmentAlert'] = $values_1; - } - if ($object->isInitialized('billableWeightCalculationMethod') && null !== $object->getBillableWeightCalculationMethod()) { - $data['BillableWeightCalculationMethod'] = $object->getBillableWeightCalculationMethod(); - } - if ($object->isInitialized('ratingMethod') && null !== $object->getRatingMethod()) { - $data['RatingMethod'] = $object->getRatingMethod(); - } - $data['BillingWeight'] = $this->normalizer->normalize($object->getBillingWeight(), 'json', $context); - $data['TransportationCharges'] = $this->normalizer->normalize($object->getTransportationCharges(), 'json', $context); - if ($object->isInitialized('baseServiceCharge') && null !== $object->getBaseServiceCharge()) { - $data['BaseServiceCharge'] = $this->normalizer->normalize($object->getBaseServiceCharge(), 'json', $context); - } - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values_2 = []; - foreach ($object->getItemizedCharges() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['ItemizedCharges'] = $values_2; - } - if ($object->isInitialized('fRSShipmentData') && null !== $object->getFRSShipmentData()) { - $data['FRSShipmentData'] = $this->normalizer->normalize($object->getFRSShipmentData(), 'json', $context); + if (\array_key_exists('Disclaimer', $data)) { + $values = []; + foreach ($data['Disclaimer'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class, 'json', $context); } - $data['ServiceOptionsCharges'] = $this->normalizer->normalize($object->getServiceOptionsCharges(), 'json', $context); - if ($object->isInitialized('taxCharges') && null !== $object->getTaxCharges()) { - $values_3 = []; - foreach ($object->getTaxCharges() as $value_3) { - $values_3[] = $this->normalizer->normalize($value_3, 'json', $context); - } - $data['TaxCharges'] = $values_3; + $object->setDisclaimer($values); + unset($data['Disclaimer']); + } + if (\array_key_exists('Service', $data)) { + $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\RatedShipmentService::class, 'json', $context)); + unset($data['Service']); + } + if (\array_key_exists('RateChart', $data)) { + $object->setRateChart($data['RateChart']); + unset($data['RateChart']); + } + if (\array_key_exists('RatedShipmentAlert', $data)) { + $values_1 = []; + foreach ($data['RatedShipmentAlert'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class, 'json', $context); } - $data['TotalCharges'] = $this->normalizer->normalize($object->getTotalCharges(), 'json', $context); - if ($object->isInitialized('totalChargesWithTaxes') && null !== $object->getTotalChargesWithTaxes()) { - $data['TotalChargesWithTaxes'] = $this->normalizer->normalize($object->getTotalChargesWithTaxes(), 'json', $context); + $object->setRatedShipmentAlert($values_1); + unset($data['RatedShipmentAlert']); + } + if (\array_key_exists('BillableWeightCalculationMethod', $data)) { + $object->setBillableWeightCalculationMethod($data['BillableWeightCalculationMethod']); + unset($data['BillableWeightCalculationMethod']); + } + if (\array_key_exists('RatingMethod', $data)) { + $object->setRatingMethod($data['RatingMethod']); + unset($data['RatingMethod']); + } + if (\array_key_exists('BillingWeight', $data)) { + $object->setBillingWeight($this->denormalizer->denormalize($data['BillingWeight'], \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class, 'json', $context)); + unset($data['BillingWeight']); + } + if (\array_key_exists('TransportationCharges', $data)) { + $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class, 'json', $context)); + unset($data['TransportationCharges']); + } + if (\array_key_exists('BaseServiceCharge', $data)) { + $object->setBaseServiceCharge($this->denormalizer->denormalize($data['BaseServiceCharge'], \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class, 'json', $context)); + unset($data['BaseServiceCharge']); + } + if (\array_key_exists('ItemizedCharges', $data)) { + $values_2 = []; + foreach ($data['ItemizedCharges'] as $value_2) { + $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class, 'json', $context); } - if ($object->isInitialized('negotiatedRateCharges') && null !== $object->getNegotiatedRateCharges()) { - $data['NegotiatedRateCharges'] = $this->normalizer->normalize($object->getNegotiatedRateCharges(), 'json', $context); + $object->setItemizedCharges($values_2); + unset($data['ItemizedCharges']); + } + if (\array_key_exists('FRSShipmentData', $data)) { + $object->setFRSShipmentData($this->denormalizer->denormalize($data['FRSShipmentData'], \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class, 'json', $context)); + unset($data['FRSShipmentData']); + } + if (\array_key_exists('ServiceOptionsCharges', $data)) { + $object->setServiceOptionsCharges($this->denormalizer->denormalize($data['ServiceOptionsCharges'], \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class, 'json', $context)); + unset($data['ServiceOptionsCharges']); + } + if (\array_key_exists('TaxCharges', $data)) { + $values_3 = []; + foreach ($data['TaxCharges'] as $value_3) { + $values_3[] = $this->denormalizer->denormalize($value_3, \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class, 'json', $context); } + $object->setTaxCharges($values_3); + unset($data['TaxCharges']); + } + if (\array_key_exists('TotalCharges', $data)) { + $object->setTotalCharges($this->denormalizer->denormalize($data['TotalCharges'], \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class, 'json', $context)); + unset($data['TotalCharges']); + } + if (\array_key_exists('TotalChargesWithTaxes', $data)) { + $object->setTotalChargesWithTaxes($this->denormalizer->denormalize($data['TotalChargesWithTaxes'], \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class, 'json', $context)); + unset($data['TotalChargesWithTaxes']); + } + if (\array_key_exists('NegotiatedRateCharges', $data) && $data['NegotiatedRateCharges'] !== null) { + $object->setNegotiatedRateCharges($this->denormalizer->denormalize($data['NegotiatedRateCharges'], \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class, 'json', $context)); + unset($data['NegotiatedRateCharges']); + } + elseif (\array_key_exists('NegotiatedRateCharges', $data) && $data['NegotiatedRateCharges'] === null) { + $object->setNegotiatedRateCharges(null); + } + if (\array_key_exists('RatedPackage', $data)) { $values_4 = []; - foreach ($object->getRatedPackage() as $value_4) { - $values_4[] = $this->normalizer->normalize($value_4, 'json', $context); - } - $data['RatedPackage'] = $values_4; - if ($object->isInitialized('timeInTransit') && null !== $object->getTimeInTransit()) { - $data['TimeInTransit'] = $this->normalizer->normalize($object->getTimeInTransit(), 'json', $context); - } - if ($object->isInitialized('scheduledDeliveryDate') && null !== $object->getScheduledDeliveryDate()) { - $data['ScheduledDeliveryDate'] = $object->getScheduledDeliveryDate(); - } - if ($object->isInitialized('roarRatedIndicator') && null !== $object->getRoarRatedIndicator()) { - $data['RoarRatedIndicator'] = $object->getRoarRatedIndicator(); - } - foreach ($object as $key => $value_5) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_5; - } + foreach ($data['RatedPackage'] as $value_4) { + $values_4[] = $this->denormalizer->denormalize($value_4, \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class, 'json', $context); } - return $data; + $object->setRatedPackage($values_4); + unset($data['RatedPackage']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateResponseRatedShipment::class => false]; + if (\array_key_exists('TimeInTransit', $data)) { + $object->setTimeInTransit($this->denormalizer->denormalize($data['TimeInTransit'], \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class, 'json', $context)); + unset($data['TimeInTransit']); } + if (\array_key_exists('ScheduledDeliveryDate', $data)) { + $object->setScheduledDeliveryDate($data['ScheduledDeliveryDate']); + unset($data['ScheduledDeliveryDate']); + } + if (\array_key_exists('RoarRatedIndicator', $data)) { + $object->setRoarRatedIndicator($data['RoarRatedIndicator']); + unset($data['RoarRatedIndicator']); + } + foreach ($data as $key => $value_5) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_5; + } + } + return $object; } -} else { - class RateResponseRatedShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResponseRatedShipment::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateResponseRatedShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Disclaimer', $data)) { - $values = []; - foreach ($data['Disclaimer'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class, 'json', $context); - } - $object->setDisclaimer($values); - unset($data['Disclaimer']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\RatedShipmentService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('RateChart', $data)) { - $object->setRateChart($data['RateChart']); - unset($data['RateChart']); - } - if (\array_key_exists('RatedShipmentAlert', $data)) { - $values_1 = []; - foreach ($data['RatedShipmentAlert'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class, 'json', $context); - } - $object->setRatedShipmentAlert($values_1); - unset($data['RatedShipmentAlert']); - } - if (\array_key_exists('BillableWeightCalculationMethod', $data)) { - $object->setBillableWeightCalculationMethod($data['BillableWeightCalculationMethod']); - unset($data['BillableWeightCalculationMethod']); - } - if (\array_key_exists('RatingMethod', $data)) { - $object->setRatingMethod($data['RatingMethod']); - unset($data['RatingMethod']); - } - if (\array_key_exists('BillingWeight', $data)) { - $object->setBillingWeight($this->denormalizer->denormalize($data['BillingWeight'], \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class, 'json', $context)); - unset($data['BillingWeight']); - } - if (\array_key_exists('TransportationCharges', $data)) { - $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class, 'json', $context)); - unset($data['TransportationCharges']); - } - if (\array_key_exists('BaseServiceCharge', $data)) { - $object->setBaseServiceCharge($this->denormalizer->denormalize($data['BaseServiceCharge'], \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class, 'json', $context)); - unset($data['BaseServiceCharge']); + $dataArray = []; + if ($data->isInitialized('disclaimer') && null !== $data->getDisclaimer()) { + $values = []; + foreach ($data->getDisclaimer() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - if (\array_key_exists('ItemizedCharges', $data)) { - $values_2 = []; - foreach ($data['ItemizedCharges'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values_2); - unset($data['ItemizedCharges']); - } - if (\array_key_exists('FRSShipmentData', $data)) { - $object->setFRSShipmentData($this->denormalizer->denormalize($data['FRSShipmentData'], \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class, 'json', $context)); - unset($data['FRSShipmentData']); - } - if (\array_key_exists('ServiceOptionsCharges', $data)) { - $object->setServiceOptionsCharges($this->denormalizer->denormalize($data['ServiceOptionsCharges'], \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class, 'json', $context)); - unset($data['ServiceOptionsCharges']); - } - if (\array_key_exists('TaxCharges', $data)) { - $values_3 = []; - foreach ($data['TaxCharges'] as $value_3) { - $values_3[] = $this->denormalizer->denormalize($value_3, \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class, 'json', $context); - } - $object->setTaxCharges($values_3); - unset($data['TaxCharges']); - } - if (\array_key_exists('TotalCharges', $data)) { - $object->setTotalCharges($this->denormalizer->denormalize($data['TotalCharges'], \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class, 'json', $context)); - unset($data['TotalCharges']); - } - if (\array_key_exists('TotalChargesWithTaxes', $data)) { - $object->setTotalChargesWithTaxes($this->denormalizer->denormalize($data['TotalChargesWithTaxes'], \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class, 'json', $context)); - unset($data['TotalChargesWithTaxes']); - } - if (\array_key_exists('NegotiatedRateCharges', $data) && $data['NegotiatedRateCharges'] !== null) { - $object->setNegotiatedRateCharges($this->denormalizer->denormalize($data['NegotiatedRateCharges'], \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class, 'json', $context)); - unset($data['NegotiatedRateCharges']); - } - elseif (\array_key_exists('NegotiatedRateCharges', $data) && $data['NegotiatedRateCharges'] === null) { - $object->setNegotiatedRateCharges(null); - } - if (\array_key_exists('RatedPackage', $data)) { - $values_4 = []; - foreach ($data['RatedPackage'] as $value_4) { - $values_4[] = $this->denormalizer->denormalize($value_4, \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class, 'json', $context); - } - $object->setRatedPackage($values_4); - unset($data['RatedPackage']); - } - if (\array_key_exists('TimeInTransit', $data)) { - $object->setTimeInTransit($this->denormalizer->denormalize($data['TimeInTransit'], \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class, 'json', $context)); - unset($data['TimeInTransit']); - } - if (\array_key_exists('ScheduledDeliveryDate', $data)) { - $object->setScheduledDeliveryDate($data['ScheduledDeliveryDate']); - unset($data['ScheduledDeliveryDate']); - } - if (\array_key_exists('RoarRatedIndicator', $data)) { - $object->setRoarRatedIndicator($data['RoarRatedIndicator']); - unset($data['RoarRatedIndicator']); - } - foreach ($data as $key => $value_5) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_5; - } - } - return $object; + $dataArray['Disclaimer'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $values = []; - foreach ($object->getDisclaimer() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Disclaimer'] = $values; - } - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - if ($object->isInitialized('rateChart') && null !== $object->getRateChart()) { - $data['RateChart'] = $object->getRateChart(); - } - if ($object->isInitialized('ratedShipmentAlert') && null !== $object->getRatedShipmentAlert()) { - $values_1 = []; - foreach ($object->getRatedShipmentAlert() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['RatedShipmentAlert'] = $values_1; - } - if ($object->isInitialized('billableWeightCalculationMethod') && null !== $object->getBillableWeightCalculationMethod()) { - $data['BillableWeightCalculationMethod'] = $object->getBillableWeightCalculationMethod(); - } - if ($object->isInitialized('ratingMethod') && null !== $object->getRatingMethod()) { - $data['RatingMethod'] = $object->getRatingMethod(); - } - $data['BillingWeight'] = $this->normalizer->normalize($object->getBillingWeight(), 'json', $context); - $data['TransportationCharges'] = $this->normalizer->normalize($object->getTransportationCharges(), 'json', $context); - if ($object->isInitialized('baseServiceCharge') && null !== $object->getBaseServiceCharge()) { - $data['BaseServiceCharge'] = $this->normalizer->normalize($object->getBaseServiceCharge(), 'json', $context); - } - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values_2 = []; - foreach ($object->getItemizedCharges() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['ItemizedCharges'] = $values_2; - } - if ($object->isInitialized('fRSShipmentData') && null !== $object->getFRSShipmentData()) { - $data['FRSShipmentData'] = $this->normalizer->normalize($object->getFRSShipmentData(), 'json', $context); - } - $data['ServiceOptionsCharges'] = $this->normalizer->normalize($object->getServiceOptionsCharges(), 'json', $context); - if ($object->isInitialized('taxCharges') && null !== $object->getTaxCharges()) { - $values_3 = []; - foreach ($object->getTaxCharges() as $value_3) { - $values_3[] = $this->normalizer->normalize($value_3, 'json', $context); - } - $data['TaxCharges'] = $values_3; - } - $data['TotalCharges'] = $this->normalizer->normalize($object->getTotalCharges(), 'json', $context); - if ($object->isInitialized('totalChargesWithTaxes') && null !== $object->getTotalChargesWithTaxes()) { - $data['TotalChargesWithTaxes'] = $this->normalizer->normalize($object->getTotalChargesWithTaxes(), 'json', $context); - } - if ($object->isInitialized('negotiatedRateCharges') && null !== $object->getNegotiatedRateCharges()) { - $data['NegotiatedRateCharges'] = $this->normalizer->normalize($object->getNegotiatedRateCharges(), 'json', $context); - } - $values_4 = []; - foreach ($object->getRatedPackage() as $value_4) { - $values_4[] = $this->normalizer->normalize($value_4, 'json', $context); - } - $data['RatedPackage'] = $values_4; - if ($object->isInitialized('timeInTransit') && null !== $object->getTimeInTransit()) { - $data['TimeInTransit'] = $this->normalizer->normalize($object->getTimeInTransit(), 'json', $context); - } - if ($object->isInitialized('scheduledDeliveryDate') && null !== $object->getScheduledDeliveryDate()) { - $data['ScheduledDeliveryDate'] = $object->getScheduledDeliveryDate(); + $dataArray['Service'] = $this->normalizer->normalize($data->getService(), 'json', $context); + if ($data->isInitialized('rateChart') && null !== $data->getRateChart()) { + $dataArray['RateChart'] = $data->getRateChart(); + } + if ($data->isInitialized('ratedShipmentAlert') && null !== $data->getRatedShipmentAlert()) { + $values_1 = []; + foreach ($data->getRatedShipmentAlert() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - if ($object->isInitialized('roarRatedIndicator') && null !== $object->getRoarRatedIndicator()) { - $data['RoarRatedIndicator'] = $object->getRoarRatedIndicator(); + $dataArray['RatedShipmentAlert'] = $values_1; + } + if ($data->isInitialized('billableWeightCalculationMethod') && null !== $data->getBillableWeightCalculationMethod()) { + $dataArray['BillableWeightCalculationMethod'] = $data->getBillableWeightCalculationMethod(); + } + if ($data->isInitialized('ratingMethod') && null !== $data->getRatingMethod()) { + $dataArray['RatingMethod'] = $data->getRatingMethod(); + } + $dataArray['BillingWeight'] = $this->normalizer->normalize($data->getBillingWeight(), 'json', $context); + $dataArray['TransportationCharges'] = $this->normalizer->normalize($data->getTransportationCharges(), 'json', $context); + if ($data->isInitialized('baseServiceCharge') && null !== $data->getBaseServiceCharge()) { + $dataArray['BaseServiceCharge'] = $this->normalizer->normalize($data->getBaseServiceCharge(), 'json', $context); + } + if ($data->isInitialized('itemizedCharges') && null !== $data->getItemizedCharges()) { + $values_2 = []; + foreach ($data->getItemizedCharges() as $value_2) { + $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); } - foreach ($object as $key => $value_5) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_5; - } + $dataArray['ItemizedCharges'] = $values_2; + } + if ($data->isInitialized('fRSShipmentData') && null !== $data->getFRSShipmentData()) { + $dataArray['FRSShipmentData'] = $this->normalizer->normalize($data->getFRSShipmentData(), 'json', $context); + } + $dataArray['ServiceOptionsCharges'] = $this->normalizer->normalize($data->getServiceOptionsCharges(), 'json', $context); + if ($data->isInitialized('taxCharges') && null !== $data->getTaxCharges()) { + $values_3 = []; + foreach ($data->getTaxCharges() as $value_3) { + $values_3[] = $this->normalizer->normalize($value_3, 'json', $context); } - return $data; + $dataArray['TaxCharges'] = $values_3; + } + $dataArray['TotalCharges'] = $this->normalizer->normalize($data->getTotalCharges(), 'json', $context); + if ($data->isInitialized('totalChargesWithTaxes') && null !== $data->getTotalChargesWithTaxes()) { + $dataArray['TotalChargesWithTaxes'] = $this->normalizer->normalize($data->getTotalChargesWithTaxes(), 'json', $context); + } + if ($data->isInitialized('negotiatedRateCharges')) { + $dataArray['NegotiatedRateCharges'] = $this->normalizer->normalize($data->getNegotiatedRateCharges(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateResponseRatedShipment::class => false]; + $values_4 = []; + foreach ($data->getRatedPackage() as $value_4) { + $values_4[] = $this->normalizer->normalize($value_4, 'json', $context); } + $dataArray['RatedPackage'] = $values_4; + if ($data->isInitialized('timeInTransit') && null !== $data->getTimeInTransit()) { + $dataArray['TimeInTransit'] = $this->normalizer->normalize($data->getTimeInTransit(), 'json', $context); + } + if ($data->isInitialized('scheduledDeliveryDate') && null !== $data->getScheduledDeliveryDate()) { + $dataArray['ScheduledDeliveryDate'] = $data->getScheduledDeliveryDate(); + } + if ($data->isInitialized('roarRatedIndicator') && null !== $data->getRoarRatedIndicator()) { + $dataArray['RoarRatedIndicator'] = $data->getRoarRatedIndicator(); + } + foreach ($data as $key => $value_5) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_5; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateResponseRatedShipment::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateResponseResponseNormalizer.php b/src/Api/Normalizer/RateResponseResponseNormalizer.php index 3b78231b..9647c7eb 100644 --- a/src/Api/Normalizer/RateResponseResponseNormalizer.php +++ b/src/Api/Normalizer/RateResponseResponseNormalizer.php @@ -5,200 +5,99 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\RateResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('AlertDetail', $data)) { - $values_1 = []; - foreach ($data['AlertDetail'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ResponseAlertDetail::class, 'json', $context); - } - $object->setAlertDetail($values_1); - unset($data['AlertDetail']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\RateResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('alertDetail') && null !== $object->getAlertDetail()) { - $values_1 = []; - foreach ($object->getAlertDetail() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['AlertDetail'] = $values_1; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); + } + if (\array_key_exists('Alert', $data)) { + $values = []; + foreach ($data['Alert'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setAlert($values); + unset($data['Alert']); + } + if (\array_key_exists('AlertDetail', $data)) { + $values_1 = []; + foreach ($data['AlertDetail'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ResponseAlertDetail::class, 'json', $context); } - return $data; + $object->setAlertDetail($values_1); + unset($data['AlertDetail']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateResponseResponse::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } } + return $object; } -} else { - class RateResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateResponseResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $values = []; + foreach ($data->getAlert() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Alert'] = $values; } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('AlertDetail', $data)) { - $values_1 = []; - foreach ($data['AlertDetail'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ResponseAlertDetail::class, 'json', $context); - } - $object->setAlertDetail($values_1); - unset($data['AlertDetail']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } + if ($data->isInitialized('alertDetail') && null !== $data->getAlertDetail()) { + $values_1 = []; + foreach ($data->getAlertDetail() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $object; + $dataArray['AlertDetail'] = $values_1; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('alertDetail') && null !== $object->getAlertDetail()) { - $values_1 = []; - foreach ($object->getAlertDetail() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['AlertDetail'] = $values_1; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateResponseResponse::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateResultChargeDetailNormalizer.php b/src/Api/Normalizer/RateResultChargeDetailNormalizer.php index 4c4017bd..1851f601 100644 --- a/src/Api/Normalizer/RateResultChargeDetailNormalizer.php +++ b/src/Api/Normalizer/RateResultChargeDetailNormalizer.php @@ -5,178 +5,88 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateResultChargeDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateResultChargeDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateResultChargeDetail::class; + return $type === \ShipStream\Ups\Api\Model\RateResultChargeDetail::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResultChargeDetail::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResultChargeDetail::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateResultChargeDetail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ChargeCode', $data)) { - $object->setChargeCode($data['ChargeCode']); - unset($data['ChargeCode']); - } - if (\array_key_exists('ChargeDescription', $data)) { - $object->setChargeDescription($data['ChargeDescription']); - unset($data['ChargeDescription']); - } - if (\array_key_exists('ChargeAmount', $data)) { - $object->setChargeAmount($data['ChargeAmount']); - unset($data['ChargeAmount']); - } - if (\array_key_exists('IncentedAmount', $data)) { - $object->setIncentedAmount($data['IncentedAmount']); - unset($data['IncentedAmount']); - } - if (\array_key_exists('TaxAmount', $data)) { - $object->setTaxAmount($data['TaxAmount']); - unset($data['TaxAmount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateResultChargeDetail(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ChargeCode'] = $object->getChargeCode(); - if ($object->isInitialized('chargeDescription') && null !== $object->getChargeDescription()) { - $data['ChargeDescription'] = $object->getChargeDescription(); - } - $data['ChargeAmount'] = $object->getChargeAmount(); - if ($object->isInitialized('incentedAmount') && null !== $object->getIncentedAmount()) { - $data['IncentedAmount'] = $object->getIncentedAmount(); - } - if ($object->isInitialized('taxAmount') && null !== $object->getTaxAmount()) { - $data['TaxAmount'] = $object->getTaxAmount(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ChargeCode', $data)) { + $object->setChargeCode($data['ChargeCode']); + unset($data['ChargeCode']); + } + if (\array_key_exists('ChargeDescription', $data)) { + $object->setChargeDescription($data['ChargeDescription']); + unset($data['ChargeDescription']); + } + if (\array_key_exists('ChargeAmount', $data)) { + $object->setChargeAmount($data['ChargeAmount']); + unset($data['ChargeAmount']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateResultChargeDetail::class => false]; + if (\array_key_exists('IncentedAmount', $data)) { + $object->setIncentedAmount($data['IncentedAmount']); + unset($data['IncentedAmount']); } + if (\array_key_exists('TaxAmount', $data)) { + $object->setTaxAmount($data['TaxAmount']); + unset($data['TaxAmount']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class RateResultChargeDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateResultChargeDetail::class; + $dataArray = []; + $dataArray['ChargeCode'] = $data->getChargeCode(); + if ($data->isInitialized('chargeDescription') && null !== $data->getChargeDescription()) { + $dataArray['ChargeDescription'] = $data->getChargeDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResultChargeDetail::class; + $dataArray['ChargeAmount'] = $data->getChargeAmount(); + if ($data->isInitialized('incentedAmount') && null !== $data->getIncentedAmount()) { + $dataArray['IncentedAmount'] = $data->getIncentedAmount(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateResultChargeDetail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ChargeCode', $data)) { - $object->setChargeCode($data['ChargeCode']); - unset($data['ChargeCode']); - } - if (\array_key_exists('ChargeDescription', $data)) { - $object->setChargeDescription($data['ChargeDescription']); - unset($data['ChargeDescription']); - } - if (\array_key_exists('ChargeAmount', $data)) { - $object->setChargeAmount($data['ChargeAmount']); - unset($data['ChargeAmount']); - } - if (\array_key_exists('IncentedAmount', $data)) { - $object->setIncentedAmount($data['IncentedAmount']); - unset($data['IncentedAmount']); - } - if (\array_key_exists('TaxAmount', $data)) { - $object->setTaxAmount($data['TaxAmount']); - unset($data['TaxAmount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('taxAmount') && null !== $data->getTaxAmount()) { + $dataArray['TaxAmount'] = $data->getTaxAmount(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ChargeCode'] = $object->getChargeCode(); - if ($object->isInitialized('chargeDescription') && null !== $object->getChargeDescription()) { - $data['ChargeDescription'] = $object->getChargeDescription(); - } - $data['ChargeAmount'] = $object->getChargeAmount(); - if ($object->isInitialized('incentedAmount') && null !== $object->getIncentedAmount()) { - $data['IncentedAmount'] = $object->getIncentedAmount(); - } - if ($object->isInitialized('taxAmount') && null !== $object->getTaxAmount()) { - $data['TaxAmount'] = $object->getTaxAmount(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateResultChargeDetail::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateResultChargeDetail::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateResultDisclaimerNormalizer.php b/src/Api/Normalizer/RateResultDisclaimerNormalizer.php index 54d2cdfa..e7cdc75d 100644 --- a/src/Api/Normalizer/RateResultDisclaimerNormalizer.php +++ b/src/Api/Normalizer/RateResultDisclaimerNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateResultDisclaimerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateResultDisclaimerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateResultDisclaimer::class; + return $type === \ShipStream\Ups\Api\Model\RateResultDisclaimer::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResultDisclaimer::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResultDisclaimer::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateResultDisclaimer(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateResultDisclaimer(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateResultDisclaimer::class => false]; - } - } -} else { - class RateResultDisclaimerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateResultDisclaimer::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResultDisclaimer::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateResultDisclaimer(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateResultDisclaimer::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateResultDisclaimer::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateResultTaxChargesNormalizer.php b/src/Api/Normalizer/RateResultTaxChargesNormalizer.php index 81fd8588..24b51284 100644 --- a/src/Api/Normalizer/RateResultTaxChargesNormalizer.php +++ b/src/Api/Normalizer/RateResultTaxChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateResultTaxChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateResultTaxChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateResultTaxCharges::class; + return $type === \ShipStream\Ups\Api\Model\RateResultTaxCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResultTaxCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResultTaxCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateResultTaxCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateResultTaxCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $object->getType(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateResultTaxCharges::class => false]; - } - } -} else { - class RateResultTaxChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateResultTaxCharges::class; + if (\array_key_exists('Type', $data)) { + $object->setType($data['Type']); + unset($data['Type']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateResultTaxCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateResultTaxCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $object->getType(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Type'] = $data->getType(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateResultTaxCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateResultTaxCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateShipmentAlternateDeliveryAddressNormalizer.php b/src/Api/Normalizer/RateShipmentAlternateDeliveryAddressNormalizer.php index 93539bc6..56fe3bd0 100644 --- a/src/Api/Normalizer/RateShipmentAlternateDeliveryAddressNormalizer.php +++ b/src/Api/Normalizer/RateShipmentAlternateDeliveryAddressNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateShipmentAlternateDeliveryAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateShipmentAlternateDeliveryAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class; + return $type === \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class, 'json', $context)); + unset($data['Address']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RateShipmentAlternateDeliveryAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class; + $dataArray = []; + if ($data->isInitialized('name') && null !== $data->getName()) { + $dataArray['Name'] = $data->getName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\RateAlternateDeliveryAddressAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateShipmentAlternateDeliveryAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateShipmentChargeBillShipperNormalizer.php b/src/Api/Normalizer/RateShipmentChargeBillShipperNormalizer.php index c0dc0f00..7c55aa3e 100644 --- a/src/Api/Normalizer/RateShipmentChargeBillShipperNormalizer.php +++ b/src/Api/Normalizer/RateShipmentChargeBillShipperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateShipmentChargeBillShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateShipmentChargeBillShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class; + return $type === \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AccountNumber'] = $object->getAccountNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AccountNumber', $data)) { + $object->setAccountNumber($data['AccountNumber']); + unset($data['AccountNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RateShipmentChargeBillShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['AccountNumber'] = $data->getAccountNumber(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AccountNumber'] = $object->getAccountNumber(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateShipmentChargeBillShipper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateShipmentChargeBillThirdPartyNormalizer.php b/src/Api/Normalizer/RateShipmentChargeBillThirdPartyNormalizer.php index 7e779bf9..c0f4bdec 100644 --- a/src/Api/Normalizer/RateShipmentChargeBillThirdPartyNormalizer.php +++ b/src/Api/Normalizer/RateShipmentChargeBillThirdPartyNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateShipmentChargeBillThirdPartyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateShipmentChargeBillThirdPartyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class; + return $type === \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AccountNumber'] = $object->getAccountNumber(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class => false]; - } - } -} else { - class RateShipmentChargeBillThirdPartyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class; + if (\array_key_exists('AccountNumber', $data)) { + $object->setAccountNumber($data['AccountNumber']); + unset($data['AccountNumber']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class, 'json', $context)); + unset($data['Address']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\RateBillThirdPartyAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AccountNumber'] = $object->getAccountNumber(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['AccountNumber'] = $data->getAccountNumber(); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateShipmentChargeBillThirdParty::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateShipmentFRSPaymentInformationNormalizer.php b/src/Api/Normalizer/RateShipmentFRSPaymentInformationNormalizer.php index 16f1bc1d..531a1b73 100644 --- a/src/Api/Normalizer/RateShipmentFRSPaymentInformationNormalizer.php +++ b/src/Api/Normalizer/RateShipmentFRSPaymentInformationNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateShipmentFRSPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateShipmentFRSPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class; + return $type === \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - if ($object->isInitialized('accountNumber') && null !== $object->getAccountNumber()) { - $data['AccountNumber'] = $object->getAccountNumber(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class, 'json', $context)); + unset($data['Type']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class => false]; + if (\array_key_exists('AccountNumber', $data)) { + $object->setAccountNumber($data['AccountNumber']); + unset($data['AccountNumber']); } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class, 'json', $context)); + unset($data['Address']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class RateShipmentFRSPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class; + $dataArray = []; + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + if ($data->isInitialized('accountNumber') && null !== $data->getAccountNumber()) { + $dataArray['AccountNumber'] = $data->getAccountNumber(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class; + if ($data->isInitialized('address') && null !== $data->getAddress()) { + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class, 'json', $context)); - unset($data['Type']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - if ($object->isInitialized('accountNumber') && null !== $object->getAccountNumber()) { - $data['AccountNumber'] = $object->getAccountNumber(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateShipmentFRSPaymentInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateShipmentPackageNormalizer.php b/src/Api/Normalizer/RateShipmentPackageNormalizer.php index 6a02c730..9216d952 100644 --- a/src/Api/Normalizer/RateShipmentPackageNormalizer.php +++ b/src/Api/Normalizer/RateShipmentPackageNormalizer.php @@ -5,284 +5,141 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateShipmentPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateShipmentPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentPackage::class; + return $type === \ShipStream\Ups\Api\Model\RateShipmentPackage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentPackage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentPackage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentPackage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\PackagePackagingType::class, 'json', $context)); - unset($data['PackagingType']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\PackageDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('DimWeight', $data)) { - $object->setDimWeight($this->denormalizer->denormalize($data['DimWeight'], \ShipStream\Ups\Api\Model\PackageDimWeight::class, 'json', $context)); - unset($data['DimWeight']); - } - if (\array_key_exists('PackageWeight', $data)) { - $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\PackagePackageWeight::class, 'json', $context)); - unset($data['PackageWeight']); - } - if (\array_key_exists('Commodity', $data)) { - $object->setCommodity($this->denormalizer->denormalize($data['Commodity'], \ShipStream\Ups\Api\Model\PackageCommodity::class, 'json', $context)); - unset($data['Commodity']); - } - if (\array_key_exists('LargePackageIndicator', $data)) { - $object->setLargePackageIndicator($data['LargePackageIndicator']); - unset($data['LargePackageIndicator']); - } - if (\array_key_exists('PackageServiceOptions', $data)) { - $object->setPackageServiceOptions($this->denormalizer->denormalize($data['PackageServiceOptions'], \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class, 'json', $context)); - unset($data['PackageServiceOptions']); - } - if (\array_key_exists('AdditionalHandlingIndicator', $data)) { - $object->setAdditionalHandlingIndicator($data['AdditionalHandlingIndicator']); - unset($data['AdditionalHandlingIndicator']); - } - if (\array_key_exists('SimpleRate', $data)) { - $object->setSimpleRate($this->denormalizer->denormalize($data['SimpleRate'], \ShipStream\Ups\Api\Model\PackageSimpleRate::class, 'json', $context)); - unset($data['SimpleRate']); - } - if (\array_key_exists('UPSPremier', $data)) { - $object->setUPSPremier($this->denormalizer->denormalize($data['UPSPremier'], \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class, 'json', $context)); - unset($data['UPSPremier']); - } - if (\array_key_exists('OversizeIndicator', $data)) { - $object->setOversizeIndicator($data['OversizeIndicator']); - unset($data['OversizeIndicator']); - } - if (\array_key_exists('MinimumBillableWeightIndicator', $data)) { - $object->setMinimumBillableWeightIndicator($data['MinimumBillableWeightIndicator']); - unset($data['MinimumBillableWeightIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateShipmentPackage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $this->normalizer->normalize($object->getPackagingType(), 'json', $context); - } - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - if ($object->isInitialized('dimWeight') && null !== $object->getDimWeight()) { - $data['DimWeight'] = $this->normalizer->normalize($object->getDimWeight(), 'json', $context); - } - if ($object->isInitialized('packageWeight') && null !== $object->getPackageWeight()) { - $data['PackageWeight'] = $this->normalizer->normalize($object->getPackageWeight(), 'json', $context); - } - if ($object->isInitialized('commodity') && null !== $object->getCommodity()) { - $data['Commodity'] = $this->normalizer->normalize($object->getCommodity(), 'json', $context); - } - if ($object->isInitialized('largePackageIndicator') && null !== $object->getLargePackageIndicator()) { - $data['LargePackageIndicator'] = $object->getLargePackageIndicator(); - } - if ($object->isInitialized('packageServiceOptions') && null !== $object->getPackageServiceOptions()) { - $data['PackageServiceOptions'] = $this->normalizer->normalize($object->getPackageServiceOptions(), 'json', $context); - } - if ($object->isInitialized('additionalHandlingIndicator') && null !== $object->getAdditionalHandlingIndicator()) { - $data['AdditionalHandlingIndicator'] = $object->getAdditionalHandlingIndicator(); - } - if ($object->isInitialized('simpleRate') && null !== $object->getSimpleRate()) { - $data['SimpleRate'] = $this->normalizer->normalize($object->getSimpleRate(), 'json', $context); - } - if ($object->isInitialized('uPSPremier') && null !== $object->getUPSPremier()) { - $data['UPSPremier'] = $this->normalizer->normalize($object->getUPSPremier(), 'json', $context); - } - if ($object->isInitialized('oversizeIndicator') && null !== $object->getOversizeIndicator()) { - $data['OversizeIndicator'] = $object->getOversizeIndicator(); - } - if ($object->isInitialized('minimumBillableWeightIndicator') && null !== $object->getMinimumBillableWeightIndicator()) { - $data['MinimumBillableWeightIndicator'] = $object->getMinimumBillableWeightIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PackagingType', $data)) { + $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\PackagePackagingType::class, 'json', $context)); + unset($data['PackagingType']); + } + if (\array_key_exists('Dimensions', $data)) { + $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\PackageDimensions::class, 'json', $context)); + unset($data['Dimensions']); + } + if (\array_key_exists('DimWeight', $data)) { + $object->setDimWeight($this->denormalizer->denormalize($data['DimWeight'], \ShipStream\Ups\Api\Model\PackageDimWeight::class, 'json', $context)); + unset($data['DimWeight']); + } + if (\array_key_exists('PackageWeight', $data)) { + $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\PackagePackageWeight::class, 'json', $context)); + unset($data['PackageWeight']); + } + if (\array_key_exists('Commodity', $data)) { + $object->setCommodity($this->denormalizer->denormalize($data['Commodity'], \ShipStream\Ups\Api\Model\PackageCommodity::class, 'json', $context)); + unset($data['Commodity']); + } + if (\array_key_exists('LargePackageIndicator', $data)) { + $object->setLargePackageIndicator($data['LargePackageIndicator']); + unset($data['LargePackageIndicator']); + } + if (\array_key_exists('PackageServiceOptions', $data)) { + $object->setPackageServiceOptions($this->denormalizer->denormalize($data['PackageServiceOptions'], \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class, 'json', $context)); + unset($data['PackageServiceOptions']); + } + if (\array_key_exists('AdditionalHandlingIndicator', $data)) { + $object->setAdditionalHandlingIndicator($data['AdditionalHandlingIndicator']); + unset($data['AdditionalHandlingIndicator']); + } + if (\array_key_exists('SimpleRate', $data)) { + $object->setSimpleRate($this->denormalizer->denormalize($data['SimpleRate'], \ShipStream\Ups\Api\Model\PackageSimpleRate::class, 'json', $context)); + unset($data['SimpleRate']); + } + if (\array_key_exists('UPSPremier', $data)) { + $object->setUPSPremier($this->denormalizer->denormalize($data['UPSPremier'], \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class, 'json', $context)); + unset($data['UPSPremier']); + } + if (\array_key_exists('OversizeIndicator', $data)) { + $object->setOversizeIndicator($data['OversizeIndicator']); + unset($data['OversizeIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentPackage::class => false]; + if (\array_key_exists('MinimumBillableWeightIndicator', $data)) { + $object->setMinimumBillableWeightIndicator($data['MinimumBillableWeightIndicator']); + unset($data['MinimumBillableWeightIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class RateShipmentPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentPackage::class; + $dataArray = []; + if ($data->isInitialized('packagingType') && null !== $data->getPackagingType()) { + $dataArray['PackagingType'] = $this->normalizer->normalize($data->getPackagingType(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentPackage::class; + if ($data->isInitialized('dimensions') && null !== $data->getDimensions()) { + $dataArray['Dimensions'] = $this->normalizer->normalize($data->getDimensions(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentPackage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\PackagePackagingType::class, 'json', $context)); - unset($data['PackagingType']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\PackageDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('DimWeight', $data)) { - $object->setDimWeight($this->denormalizer->denormalize($data['DimWeight'], \ShipStream\Ups\Api\Model\PackageDimWeight::class, 'json', $context)); - unset($data['DimWeight']); - } - if (\array_key_exists('PackageWeight', $data)) { - $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\PackagePackageWeight::class, 'json', $context)); - unset($data['PackageWeight']); - } - if (\array_key_exists('Commodity', $data)) { - $object->setCommodity($this->denormalizer->denormalize($data['Commodity'], \ShipStream\Ups\Api\Model\PackageCommodity::class, 'json', $context)); - unset($data['Commodity']); - } - if (\array_key_exists('LargePackageIndicator', $data)) { - $object->setLargePackageIndicator($data['LargePackageIndicator']); - unset($data['LargePackageIndicator']); - } - if (\array_key_exists('PackageServiceOptions', $data)) { - $object->setPackageServiceOptions($this->denormalizer->denormalize($data['PackageServiceOptions'], \ShipStream\Ups\Api\Model\RatePackagePackageServiceOptions::class, 'json', $context)); - unset($data['PackageServiceOptions']); - } - if (\array_key_exists('AdditionalHandlingIndicator', $data)) { - $object->setAdditionalHandlingIndicator($data['AdditionalHandlingIndicator']); - unset($data['AdditionalHandlingIndicator']); - } - if (\array_key_exists('SimpleRate', $data)) { - $object->setSimpleRate($this->denormalizer->denormalize($data['SimpleRate'], \ShipStream\Ups\Api\Model\PackageSimpleRate::class, 'json', $context)); - unset($data['SimpleRate']); - } - if (\array_key_exists('UPSPremier', $data)) { - $object->setUPSPremier($this->denormalizer->denormalize($data['UPSPremier'], \ShipStream\Ups\Api\Model\RatePackageUPSPremier::class, 'json', $context)); - unset($data['UPSPremier']); - } - if (\array_key_exists('OversizeIndicator', $data)) { - $object->setOversizeIndicator($data['OversizeIndicator']); - unset($data['OversizeIndicator']); - } - if (\array_key_exists('MinimumBillableWeightIndicator', $data)) { - $object->setMinimumBillableWeightIndicator($data['MinimumBillableWeightIndicator']); - unset($data['MinimumBillableWeightIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('dimWeight') && null !== $data->getDimWeight()) { + $dataArray['DimWeight'] = $this->normalizer->normalize($data->getDimWeight(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $this->normalizer->normalize($object->getPackagingType(), 'json', $context); - } - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - if ($object->isInitialized('dimWeight') && null !== $object->getDimWeight()) { - $data['DimWeight'] = $this->normalizer->normalize($object->getDimWeight(), 'json', $context); - } - if ($object->isInitialized('packageWeight') && null !== $object->getPackageWeight()) { - $data['PackageWeight'] = $this->normalizer->normalize($object->getPackageWeight(), 'json', $context); - } - if ($object->isInitialized('commodity') && null !== $object->getCommodity()) { - $data['Commodity'] = $this->normalizer->normalize($object->getCommodity(), 'json', $context); - } - if ($object->isInitialized('largePackageIndicator') && null !== $object->getLargePackageIndicator()) { - $data['LargePackageIndicator'] = $object->getLargePackageIndicator(); - } - if ($object->isInitialized('packageServiceOptions') && null !== $object->getPackageServiceOptions()) { - $data['PackageServiceOptions'] = $this->normalizer->normalize($object->getPackageServiceOptions(), 'json', $context); - } - if ($object->isInitialized('additionalHandlingIndicator') && null !== $object->getAdditionalHandlingIndicator()) { - $data['AdditionalHandlingIndicator'] = $object->getAdditionalHandlingIndicator(); - } - if ($object->isInitialized('simpleRate') && null !== $object->getSimpleRate()) { - $data['SimpleRate'] = $this->normalizer->normalize($object->getSimpleRate(), 'json', $context); - } - if ($object->isInitialized('uPSPremier') && null !== $object->getUPSPremier()) { - $data['UPSPremier'] = $this->normalizer->normalize($object->getUPSPremier(), 'json', $context); - } - if ($object->isInitialized('oversizeIndicator') && null !== $object->getOversizeIndicator()) { - $data['OversizeIndicator'] = $object->getOversizeIndicator(); - } - if ($object->isInitialized('minimumBillableWeightIndicator') && null !== $object->getMinimumBillableWeightIndicator()) { - $data['MinimumBillableWeightIndicator'] = $object->getMinimumBillableWeightIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('packageWeight') && null !== $data->getPackageWeight()) { + $dataArray['PackageWeight'] = $this->normalizer->normalize($data->getPackageWeight(), 'json', $context); + } + if ($data->isInitialized('commodity') && null !== $data->getCommodity()) { + $dataArray['Commodity'] = $this->normalizer->normalize($data->getCommodity(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentPackage::class => false]; + if ($data->isInitialized('largePackageIndicator') && null !== $data->getLargePackageIndicator()) { + $dataArray['LargePackageIndicator'] = $data->getLargePackageIndicator(); } + if ($data->isInitialized('packageServiceOptions') && null !== $data->getPackageServiceOptions()) { + $dataArray['PackageServiceOptions'] = $this->normalizer->normalize($data->getPackageServiceOptions(), 'json', $context); + } + if ($data->isInitialized('additionalHandlingIndicator') && null !== $data->getAdditionalHandlingIndicator()) { + $dataArray['AdditionalHandlingIndicator'] = $data->getAdditionalHandlingIndicator(); + } + if ($data->isInitialized('simpleRate') && null !== $data->getSimpleRate()) { + $dataArray['SimpleRate'] = $this->normalizer->normalize($data->getSimpleRate(), 'json', $context); + } + if ($data->isInitialized('uPSPremier') && null !== $data->getUPSPremier()) { + $dataArray['UPSPremier'] = $this->normalizer->normalize($data->getUPSPremier(), 'json', $context); + } + if ($data->isInitialized('oversizeIndicator') && null !== $data->getOversizeIndicator()) { + $dataArray['OversizeIndicator'] = $data->getOversizeIndicator(); + } + if ($data->isInitialized('minimumBillableWeightIndicator') && null !== $data->getMinimumBillableWeightIndicator()) { + $dataArray['MinimumBillableWeightIndicator'] = $data->getMinimumBillableWeightIndicator(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateShipmentPackage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateShipmentServiceOptionsDeliveryConfirmationNormalizer.php b/src/Api/Normalizer/RateShipmentServiceOptionsDeliveryConfirmationNormalizer.php index 8ddbc94b..f5cb2fd8 100644 --- a/src/Api/Normalizer/RateShipmentServiceOptionsDeliveryConfirmationNormalizer.php +++ b/src/Api/Normalizer/RateShipmentServiceOptionsDeliveryConfirmationNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateShipmentServiceOptionsDeliveryConfirmationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateShipmentServiceOptionsDeliveryConfirmationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class; + return $type === \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DCISType', $data)) { - $object->setDCISType($data['DCISType']); - unset($data['DCISType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['DCISType'] = $object->getDCISType(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DCISType', $data)) { + $object->setDCISType($data['DCISType']); + unset($data['DCISType']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RateShipmentServiceOptionsDeliveryConfirmationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['DCISType'] = $data->getDCISType(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('DCISType', $data)) { - $object->setDCISType($data['DCISType']); - unset($data['DCISType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['DCISType'] = $object->getDCISType(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateShipmentServiceOptionsRestrictedArticlesNormalizer.php b/src/Api/Normalizer/RateShipmentServiceOptionsRestrictedArticlesNormalizer.php index 41c611d4..b048fd27 100644 --- a/src/Api/Normalizer/RateShipmentServiceOptionsRestrictedArticlesNormalizer.php +++ b/src/Api/Normalizer/RateShipmentServiceOptionsRestrictedArticlesNormalizer.php @@ -5,242 +5,120 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateShipmentServiceOptionsRestrictedArticlesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateShipmentServiceOptionsRestrictedArticlesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AlcoholicBeveragesIndicator', $data)) { - $object->setAlcoholicBeveragesIndicator($data['AlcoholicBeveragesIndicator']); - unset($data['AlcoholicBeveragesIndicator']); - } - if (\array_key_exists('DiagnosticSpecimensIndicator', $data)) { - $object->setDiagnosticSpecimensIndicator($data['DiagnosticSpecimensIndicator']); - unset($data['DiagnosticSpecimensIndicator']); - } - if (\array_key_exists('PerishablesIndicator', $data)) { - $object->setPerishablesIndicator($data['PerishablesIndicator']); - unset($data['PerishablesIndicator']); - } - if (\array_key_exists('PlantsIndicator', $data)) { - $object->setPlantsIndicator($data['PlantsIndicator']); - unset($data['PlantsIndicator']); - } - if (\array_key_exists('SeedsIndicator', $data)) { - $object->setSeedsIndicator($data['SeedsIndicator']); - unset($data['SeedsIndicator']); - } - if (\array_key_exists('SpecialExceptionsIndicator', $data)) { - $object->setSpecialExceptionsIndicator($data['SpecialExceptionsIndicator']); - unset($data['SpecialExceptionsIndicator']); - } - if (\array_key_exists('TobaccoIndicator', $data)) { - $object->setTobaccoIndicator($data['TobaccoIndicator']); - unset($data['TobaccoIndicator']); - } - if (\array_key_exists('ECigarettesIndicator', $data)) { - $object->setECigarettesIndicator($data['ECigarettesIndicator']); - unset($data['ECigarettesIndicator']); - } - if (\array_key_exists('HempCBDIndicator', $data)) { - $object->setHempCBDIndicator($data['HempCBDIndicator']); - unset($data['HempCBDIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('alcoholicBeveragesIndicator') && null !== $object->getAlcoholicBeveragesIndicator()) { - $data['AlcoholicBeveragesIndicator'] = $object->getAlcoholicBeveragesIndicator(); - } - if ($object->isInitialized('diagnosticSpecimensIndicator') && null !== $object->getDiagnosticSpecimensIndicator()) { - $data['DiagnosticSpecimensIndicator'] = $object->getDiagnosticSpecimensIndicator(); - } - if ($object->isInitialized('perishablesIndicator') && null !== $object->getPerishablesIndicator()) { - $data['PerishablesIndicator'] = $object->getPerishablesIndicator(); - } - if ($object->isInitialized('plantsIndicator') && null !== $object->getPlantsIndicator()) { - $data['PlantsIndicator'] = $object->getPlantsIndicator(); - } - if ($object->isInitialized('seedsIndicator') && null !== $object->getSeedsIndicator()) { - $data['SeedsIndicator'] = $object->getSeedsIndicator(); - } - if ($object->isInitialized('specialExceptionsIndicator') && null !== $object->getSpecialExceptionsIndicator()) { - $data['SpecialExceptionsIndicator'] = $object->getSpecialExceptionsIndicator(); - } - if ($object->isInitialized('tobaccoIndicator') && null !== $object->getTobaccoIndicator()) { - $data['TobaccoIndicator'] = $object->getTobaccoIndicator(); - } - if ($object->isInitialized('eCigarettesIndicator') && null !== $object->getECigarettesIndicator()) { - $data['ECigarettesIndicator'] = $object->getECigarettesIndicator(); - } - if ($object->isInitialized('hempCBDIndicator') && null !== $object->getHempCBDIndicator()) { - $data['HempCBDIndicator'] = $object->getHempCBDIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AlcoholicBeveragesIndicator', $data)) { + $object->setAlcoholicBeveragesIndicator($data['AlcoholicBeveragesIndicator']); + unset($data['AlcoholicBeveragesIndicator']); + } + if (\array_key_exists('DiagnosticSpecimensIndicator', $data)) { + $object->setDiagnosticSpecimensIndicator($data['DiagnosticSpecimensIndicator']); + unset($data['DiagnosticSpecimensIndicator']); + } + if (\array_key_exists('PerishablesIndicator', $data)) { + $object->setPerishablesIndicator($data['PerishablesIndicator']); + unset($data['PerishablesIndicator']); + } + if (\array_key_exists('PlantsIndicator', $data)) { + $object->setPlantsIndicator($data['PlantsIndicator']); + unset($data['PlantsIndicator']); + } + if (\array_key_exists('SeedsIndicator', $data)) { + $object->setSeedsIndicator($data['SeedsIndicator']); + unset($data['SeedsIndicator']); + } + if (\array_key_exists('SpecialExceptionsIndicator', $data)) { + $object->setSpecialExceptionsIndicator($data['SpecialExceptionsIndicator']); + unset($data['SpecialExceptionsIndicator']); + } + if (\array_key_exists('TobaccoIndicator', $data)) { + $object->setTobaccoIndicator($data['TobaccoIndicator']); + unset($data['TobaccoIndicator']); + } + if (\array_key_exists('ECigarettesIndicator', $data)) { + $object->setECigarettesIndicator($data['ECigarettesIndicator']); + unset($data['ECigarettesIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class => false]; + if (\array_key_exists('HempCBDIndicator', $data)) { + $object->setHempCBDIndicator($data['HempCBDIndicator']); + unset($data['HempCBDIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class RateShipmentServiceOptionsRestrictedArticlesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AlcoholicBeveragesIndicator', $data)) { - $object->setAlcoholicBeveragesIndicator($data['AlcoholicBeveragesIndicator']); - unset($data['AlcoholicBeveragesIndicator']); - } - if (\array_key_exists('DiagnosticSpecimensIndicator', $data)) { - $object->setDiagnosticSpecimensIndicator($data['DiagnosticSpecimensIndicator']); - unset($data['DiagnosticSpecimensIndicator']); - } - if (\array_key_exists('PerishablesIndicator', $data)) { - $object->setPerishablesIndicator($data['PerishablesIndicator']); - unset($data['PerishablesIndicator']); - } - if (\array_key_exists('PlantsIndicator', $data)) { - $object->setPlantsIndicator($data['PlantsIndicator']); - unset($data['PlantsIndicator']); - } - if (\array_key_exists('SeedsIndicator', $data)) { - $object->setSeedsIndicator($data['SeedsIndicator']); - unset($data['SeedsIndicator']); - } - if (\array_key_exists('SpecialExceptionsIndicator', $data)) { - $object->setSpecialExceptionsIndicator($data['SpecialExceptionsIndicator']); - unset($data['SpecialExceptionsIndicator']); - } - if (\array_key_exists('TobaccoIndicator', $data)) { - $object->setTobaccoIndicator($data['TobaccoIndicator']); - unset($data['TobaccoIndicator']); - } - if (\array_key_exists('ECigarettesIndicator', $data)) { - $object->setECigarettesIndicator($data['ECigarettesIndicator']); - unset($data['ECigarettesIndicator']); - } - if (\array_key_exists('HempCBDIndicator', $data)) { - $object->setHempCBDIndicator($data['HempCBDIndicator']); - unset($data['HempCBDIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('alcoholicBeveragesIndicator') && null !== $data->getAlcoholicBeveragesIndicator()) { + $dataArray['AlcoholicBeveragesIndicator'] = $data->getAlcoholicBeveragesIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('alcoholicBeveragesIndicator') && null !== $object->getAlcoholicBeveragesIndicator()) { - $data['AlcoholicBeveragesIndicator'] = $object->getAlcoholicBeveragesIndicator(); - } - if ($object->isInitialized('diagnosticSpecimensIndicator') && null !== $object->getDiagnosticSpecimensIndicator()) { - $data['DiagnosticSpecimensIndicator'] = $object->getDiagnosticSpecimensIndicator(); - } - if ($object->isInitialized('perishablesIndicator') && null !== $object->getPerishablesIndicator()) { - $data['PerishablesIndicator'] = $object->getPerishablesIndicator(); - } - if ($object->isInitialized('plantsIndicator') && null !== $object->getPlantsIndicator()) { - $data['PlantsIndicator'] = $object->getPlantsIndicator(); - } - if ($object->isInitialized('seedsIndicator') && null !== $object->getSeedsIndicator()) { - $data['SeedsIndicator'] = $object->getSeedsIndicator(); - } - if ($object->isInitialized('specialExceptionsIndicator') && null !== $object->getSpecialExceptionsIndicator()) { - $data['SpecialExceptionsIndicator'] = $object->getSpecialExceptionsIndicator(); - } - if ($object->isInitialized('tobaccoIndicator') && null !== $object->getTobaccoIndicator()) { - $data['TobaccoIndicator'] = $object->getTobaccoIndicator(); - } - if ($object->isInitialized('eCigarettesIndicator') && null !== $object->getECigarettesIndicator()) { - $data['ECigarettesIndicator'] = $object->getECigarettesIndicator(); - } - if ($object->isInitialized('hempCBDIndicator') && null !== $object->getHempCBDIndicator()) { - $data['HempCBDIndicator'] = $object->getHempCBDIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('diagnosticSpecimensIndicator') && null !== $data->getDiagnosticSpecimensIndicator()) { + $dataArray['DiagnosticSpecimensIndicator'] = $data->getDiagnosticSpecimensIndicator(); + } + if ($data->isInitialized('perishablesIndicator') && null !== $data->getPerishablesIndicator()) { + $dataArray['PerishablesIndicator'] = $data->getPerishablesIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class => false]; + if ($data->isInitialized('plantsIndicator') && null !== $data->getPlantsIndicator()) { + $dataArray['PlantsIndicator'] = $data->getPlantsIndicator(); } + if ($data->isInitialized('seedsIndicator') && null !== $data->getSeedsIndicator()) { + $dataArray['SeedsIndicator'] = $data->getSeedsIndicator(); + } + if ($data->isInitialized('specialExceptionsIndicator') && null !== $data->getSpecialExceptionsIndicator()) { + $dataArray['SpecialExceptionsIndicator'] = $data->getSpecialExceptionsIndicator(); + } + if ($data->isInitialized('tobaccoIndicator') && null !== $data->getTobaccoIndicator()) { + $dataArray['TobaccoIndicator'] = $data->getTobaccoIndicator(); + } + if ($data->isInitialized('eCigarettesIndicator') && null !== $data->getECigarettesIndicator()) { + $dataArray['ECigarettesIndicator'] = $data->getECigarettesIndicator(); + } + if ($data->isInitialized('hempCBDIndicator') && null !== $data->getHempCBDIndicator()) { + $dataArray['HempCBDIndicator'] = $data->getHempCBDIndicator(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateShipmentShipFromNormalizer.php b/src/Api/Normalizer/RateShipmentShipFromNormalizer.php index ffd77501..69e5f823 100644 --- a/src/Api/Normalizer/RateShipmentShipFromNormalizer.php +++ b/src/Api/Normalizer/RateShipmentShipFromNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateShipmentShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateShipmentShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class; + return $type === \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentShipFrom(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipFromAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateShipmentShipFrom(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentShipFrom::class => false]; + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipFromAddress::class, 'json', $context)); + unset($data['Address']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class RateShipmentShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class; + $dataArray = []; + if ($data->isInitialized('name') && null !== $data->getName()) { + $dataArray['Name'] = $data->getName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentShipFrom::class; + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentShipFrom(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipFromAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentShipFrom::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateShipmentShipFrom::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateShipmentShipToNormalizer.php b/src/Api/Normalizer/RateShipmentShipToNormalizer.php index ef6a5c6c..5f97b595 100644 --- a/src/Api/Normalizer/RateShipmentShipToNormalizer.php +++ b/src/Api/Normalizer/RateShipmentShipToNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateShipmentShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateShipmentShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentShipTo::class; + return $type === \ShipStream\Ups\Api\Model\RateShipmentShipTo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentShipTo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentShipTo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateShipmentShipTo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentShipTo::class => false]; + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipToAddress::class, 'json', $context)); + unset($data['Address']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class RateShipmentShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentShipTo::class; + $dataArray = []; + if ($data->isInitialized('name') && null !== $data->getName()) { + $dataArray['Name'] = $data->getName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentShipTo::class; + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentShipTo::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateShipmentShipTo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateShipmentShipmentServiceOptionsNormalizer.php b/src/Api/Normalizer/RateShipmentShipmentServiceOptionsNormalizer.php index 84e63cbd..be8e91ac 100644 --- a/src/Api/Normalizer/RateShipmentShipmentServiceOptionsNormalizer.php +++ b/src/Api/Normalizer/RateShipmentShipmentServiceOptionsNormalizer.php @@ -5,438 +5,218 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateShipmentShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateShipmentShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SaturdayPickupIndicator', $data)) { - $object->setSaturdayPickupIndicator($data['SaturdayPickupIndicator']); - unset($data['SaturdayPickupIndicator']); - } - if (\array_key_exists('SaturdayDeliveryIndicator', $data)) { - $object->setSaturdayDeliveryIndicator($data['SaturdayDeliveryIndicator']); - unset($data['SaturdayDeliveryIndicator']); - } - if (\array_key_exists('SundayDeliveryIndicator', $data)) { - $object->setSundayDeliveryIndicator($data['SundayDeliveryIndicator']); - unset($data['SundayDeliveryIndicator']); - } - if (\array_key_exists('AvailableServicesOption', $data)) { - $object->setAvailableServicesOption($data['AvailableServicesOption']); - unset($data['AvailableServicesOption']); - } - if (\array_key_exists('AccessPointCOD', $data)) { - $object->setAccessPointCOD($this->denormalizer->denormalize($data['AccessPointCOD'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class, 'json', $context)); - unset($data['AccessPointCOD']); - } - if (\array_key_exists('DeliverToAddresseeOnlyIndicator', $data)) { - $object->setDeliverToAddresseeOnlyIndicator($data['DeliverToAddresseeOnlyIndicator']); - unset($data['DeliverToAddresseeOnlyIndicator']); - } - if (\array_key_exists('DirectDeliveryOnlyIndicator', $data)) { - $object->setDirectDeliveryOnlyIndicator($data['DirectDeliveryOnlyIndicator']); - unset($data['DirectDeliveryOnlyIndicator']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('DeliveryConfirmation', $data)) { - $object->setDeliveryConfirmation($this->denormalizer->denormalize($data['DeliveryConfirmation'], \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class, 'json', $context)); - unset($data['DeliveryConfirmation']); - } - if (\array_key_exists('ReturnOfDocumentIndicator', $data)) { - $object->setReturnOfDocumentIndicator($data['ReturnOfDocumentIndicator']); - unset($data['ReturnOfDocumentIndicator']); - } - if (\array_key_exists('UPScarbonneutralIndicator', $data)) { - $object->setUPScarbonneutralIndicator($data['UPScarbonneutralIndicator']); - unset($data['UPScarbonneutralIndicator']); - } - if (\array_key_exists('CertificateOfOriginIndicator', $data)) { - $object->setCertificateOfOriginIndicator($data['CertificateOfOriginIndicator']); - unset($data['CertificateOfOriginIndicator']); - } - if (\array_key_exists('PickupOptions', $data)) { - $object->setPickupOptions($this->denormalizer->denormalize($data['PickupOptions'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class, 'json', $context)); - unset($data['PickupOptions']); - } - if (\array_key_exists('DeliveryOptions', $data)) { - $object->setDeliveryOptions($this->denormalizer->denormalize($data['DeliveryOptions'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class, 'json', $context)); - unset($data['DeliveryOptions']); - } - if (\array_key_exists('RestrictedArticles', $data)) { - $object->setRestrictedArticles($this->denormalizer->denormalize($data['RestrictedArticles'], \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class, 'json', $context)); - unset($data['RestrictedArticles']); - } - if (\array_key_exists('ShipperExportDeclarationIndicator', $data)) { - $object->setShipperExportDeclarationIndicator($data['ShipperExportDeclarationIndicator']); - unset($data['ShipperExportDeclarationIndicator']); - } - if (\array_key_exists('CommercialInvoiceRemovalIndicator', $data)) { - $object->setCommercialInvoiceRemovalIndicator($data['CommercialInvoiceRemovalIndicator']); - unset($data['CommercialInvoiceRemovalIndicator']); - } - if (\array_key_exists('ImportControl', $data)) { - $object->setImportControl($this->denormalizer->denormalize($data['ImportControl'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class, 'json', $context)); - unset($data['ImportControl']); - } - if (\array_key_exists('ReturnService', $data)) { - $object->setReturnService($this->denormalizer->denormalize($data['ReturnService'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class, 'json', $context)); - unset($data['ReturnService']); - } - if (\array_key_exists('SDLShipmentIndicator', $data)) { - $object->setSDLShipmentIndicator($data['SDLShipmentIndicator']); - unset($data['SDLShipmentIndicator']); - } - if (\array_key_exists('EPRAIndicator', $data)) { - $object->setEPRAIndicator($data['EPRAIndicator']); - unset($data['EPRAIndicator']); - } - if (\array_key_exists('InsideDelivery', $data)) { - $object->setInsideDelivery($data['InsideDelivery']); - unset($data['InsideDelivery']); - } - if (\array_key_exists('ItemDisposalIndicator', $data)) { - $object->setItemDisposalIndicator($data['ItemDisposalIndicator']); - unset($data['ItemDisposalIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('saturdayPickupIndicator') && null !== $object->getSaturdayPickupIndicator()) { - $data['SaturdayPickupIndicator'] = $object->getSaturdayPickupIndicator(); - } - if ($object->isInitialized('saturdayDeliveryIndicator') && null !== $object->getSaturdayDeliveryIndicator()) { - $data['SaturdayDeliveryIndicator'] = $object->getSaturdayDeliveryIndicator(); - } - if ($object->isInitialized('sundayDeliveryIndicator') && null !== $object->getSundayDeliveryIndicator()) { - $data['SundayDeliveryIndicator'] = $object->getSundayDeliveryIndicator(); - } - if ($object->isInitialized('availableServicesOption') && null !== $object->getAvailableServicesOption()) { - $data['AvailableServicesOption'] = $object->getAvailableServicesOption(); - } - if ($object->isInitialized('accessPointCOD') && null !== $object->getAccessPointCOD()) { - $data['AccessPointCOD'] = $this->normalizer->normalize($object->getAccessPointCOD(), 'json', $context); - } - if ($object->isInitialized('deliverToAddresseeOnlyIndicator') && null !== $object->getDeliverToAddresseeOnlyIndicator()) { - $data['DeliverToAddresseeOnlyIndicator'] = $object->getDeliverToAddresseeOnlyIndicator(); - } - if ($object->isInitialized('directDeliveryOnlyIndicator') && null !== $object->getDirectDeliveryOnlyIndicator()) { - $data['DirectDeliveryOnlyIndicator'] = $object->getDirectDeliveryOnlyIndicator(); - } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('deliveryConfirmation') && null !== $object->getDeliveryConfirmation()) { - $data['DeliveryConfirmation'] = $this->normalizer->normalize($object->getDeliveryConfirmation(), 'json', $context); - } - if ($object->isInitialized('returnOfDocumentIndicator') && null !== $object->getReturnOfDocumentIndicator()) { - $data['ReturnOfDocumentIndicator'] = $object->getReturnOfDocumentIndicator(); - } - if ($object->isInitialized('uPScarbonneutralIndicator') && null !== $object->getUPScarbonneutralIndicator()) { - $data['UPScarbonneutralIndicator'] = $object->getUPScarbonneutralIndicator(); - } - if ($object->isInitialized('certificateOfOriginIndicator') && null !== $object->getCertificateOfOriginIndicator()) { - $data['CertificateOfOriginIndicator'] = $object->getCertificateOfOriginIndicator(); - } - if ($object->isInitialized('pickupOptions') && null !== $object->getPickupOptions()) { - $data['PickupOptions'] = $this->normalizer->normalize($object->getPickupOptions(), 'json', $context); - } - if ($object->isInitialized('deliveryOptions') && null !== $object->getDeliveryOptions()) { - $data['DeliveryOptions'] = $this->normalizer->normalize($object->getDeliveryOptions(), 'json', $context); - } - if ($object->isInitialized('restrictedArticles') && null !== $object->getRestrictedArticles()) { - $data['RestrictedArticles'] = $this->normalizer->normalize($object->getRestrictedArticles(), 'json', $context); - } - if ($object->isInitialized('shipperExportDeclarationIndicator') && null !== $object->getShipperExportDeclarationIndicator()) { - $data['ShipperExportDeclarationIndicator'] = $object->getShipperExportDeclarationIndicator(); - } - if ($object->isInitialized('commercialInvoiceRemovalIndicator') && null !== $object->getCommercialInvoiceRemovalIndicator()) { - $data['CommercialInvoiceRemovalIndicator'] = $object->getCommercialInvoiceRemovalIndicator(); - } - if ($object->isInitialized('importControl') && null !== $object->getImportControl()) { - $data['ImportControl'] = $this->normalizer->normalize($object->getImportControl(), 'json', $context); - } - if ($object->isInitialized('returnService') && null !== $object->getReturnService()) { - $data['ReturnService'] = $this->normalizer->normalize($object->getReturnService(), 'json', $context); - } - if ($object->isInitialized('sDLShipmentIndicator') && null !== $object->getSDLShipmentIndicator()) { - $data['SDLShipmentIndicator'] = $object->getSDLShipmentIndicator(); - } - if ($object->isInitialized('ePRAIndicator') && null !== $object->getEPRAIndicator()) { - $data['EPRAIndicator'] = $object->getEPRAIndicator(); - } - if ($object->isInitialized('insideDelivery') && null !== $object->getInsideDelivery()) { - $data['InsideDelivery'] = $object->getInsideDelivery(); - } - if ($object->isInitialized('itemDisposalIndicator') && null !== $object->getItemDisposalIndicator()) { - $data['ItemDisposalIndicator'] = $object->getItemDisposalIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('SaturdayPickupIndicator', $data)) { + $object->setSaturdayPickupIndicator($data['SaturdayPickupIndicator']); + unset($data['SaturdayPickupIndicator']); + } + if (\array_key_exists('SaturdayDeliveryIndicator', $data)) { + $object->setSaturdayDeliveryIndicator($data['SaturdayDeliveryIndicator']); + unset($data['SaturdayDeliveryIndicator']); + } + if (\array_key_exists('SundayDeliveryIndicator', $data)) { + $object->setSundayDeliveryIndicator($data['SundayDeliveryIndicator']); + unset($data['SundayDeliveryIndicator']); + } + if (\array_key_exists('AvailableServicesOption', $data)) { + $object->setAvailableServicesOption($data['AvailableServicesOption']); + unset($data['AvailableServicesOption']); + } + if (\array_key_exists('AccessPointCOD', $data)) { + $object->setAccessPointCOD($this->denormalizer->denormalize($data['AccessPointCOD'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class, 'json', $context)); + unset($data['AccessPointCOD']); + } + if (\array_key_exists('DeliverToAddresseeOnlyIndicator', $data)) { + $object->setDeliverToAddresseeOnlyIndicator($data['DeliverToAddresseeOnlyIndicator']); + unset($data['DeliverToAddresseeOnlyIndicator']); + } + if (\array_key_exists('DirectDeliveryOnlyIndicator', $data)) { + $object->setDirectDeliveryOnlyIndicator($data['DirectDeliveryOnlyIndicator']); + unset($data['DirectDeliveryOnlyIndicator']); + } + if (\array_key_exists('COD', $data)) { + $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class, 'json', $context)); + unset($data['COD']); + } + if (\array_key_exists('DeliveryConfirmation', $data)) { + $object->setDeliveryConfirmation($this->denormalizer->denormalize($data['DeliveryConfirmation'], \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class, 'json', $context)); + unset($data['DeliveryConfirmation']); + } + if (\array_key_exists('ReturnOfDocumentIndicator', $data)) { + $object->setReturnOfDocumentIndicator($data['ReturnOfDocumentIndicator']); + unset($data['ReturnOfDocumentIndicator']); + } + if (\array_key_exists('UPScarbonneutralIndicator', $data)) { + $object->setUPScarbonneutralIndicator($data['UPScarbonneutralIndicator']); + unset($data['UPScarbonneutralIndicator']); + } + if (\array_key_exists('CertificateOfOriginIndicator', $data)) { + $object->setCertificateOfOriginIndicator($data['CertificateOfOriginIndicator']); + unset($data['CertificateOfOriginIndicator']); + } + if (\array_key_exists('PickupOptions', $data)) { + $object->setPickupOptions($this->denormalizer->denormalize($data['PickupOptions'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class, 'json', $context)); + unset($data['PickupOptions']); + } + if (\array_key_exists('DeliveryOptions', $data)) { + $object->setDeliveryOptions($this->denormalizer->denormalize($data['DeliveryOptions'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class, 'json', $context)); + unset($data['DeliveryOptions']); + } + if (\array_key_exists('RestrictedArticles', $data)) { + $object->setRestrictedArticles($this->denormalizer->denormalize($data['RestrictedArticles'], \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class, 'json', $context)); + unset($data['RestrictedArticles']); + } + if (\array_key_exists('ShipperExportDeclarationIndicator', $data)) { + $object->setShipperExportDeclarationIndicator($data['ShipperExportDeclarationIndicator']); + unset($data['ShipperExportDeclarationIndicator']); + } + if (\array_key_exists('CommercialInvoiceRemovalIndicator', $data)) { + $object->setCommercialInvoiceRemovalIndicator($data['CommercialInvoiceRemovalIndicator']); + unset($data['CommercialInvoiceRemovalIndicator']); + } + if (\array_key_exists('ImportControl', $data)) { + $object->setImportControl($this->denormalizer->denormalize($data['ImportControl'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class, 'json', $context)); + unset($data['ImportControl']); + } + if (\array_key_exists('ReturnService', $data)) { + $object->setReturnService($this->denormalizer->denormalize($data['ReturnService'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class, 'json', $context)); + unset($data['ReturnService']); + } + if (\array_key_exists('SDLShipmentIndicator', $data)) { + $object->setSDLShipmentIndicator($data['SDLShipmentIndicator']); + unset($data['SDLShipmentIndicator']); + } + if (\array_key_exists('EPRAIndicator', $data)) { + $object->setEPRAIndicator($data['EPRAIndicator']); + unset($data['EPRAIndicator']); + } + if (\array_key_exists('InsideDelivery', $data)) { + $object->setInsideDelivery($data['InsideDelivery']); + unset($data['InsideDelivery']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class => false]; + if (\array_key_exists('ItemDisposalIndicator', $data)) { + $object->setItemDisposalIndicator($data['ItemDisposalIndicator']); + unset($data['ItemDisposalIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class RateShipmentShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SaturdayPickupIndicator', $data)) { - $object->setSaturdayPickupIndicator($data['SaturdayPickupIndicator']); - unset($data['SaturdayPickupIndicator']); - } - if (\array_key_exists('SaturdayDeliveryIndicator', $data)) { - $object->setSaturdayDeliveryIndicator($data['SaturdayDeliveryIndicator']); - unset($data['SaturdayDeliveryIndicator']); - } - if (\array_key_exists('SundayDeliveryIndicator', $data)) { - $object->setSundayDeliveryIndicator($data['SundayDeliveryIndicator']); - unset($data['SundayDeliveryIndicator']); - } - if (\array_key_exists('AvailableServicesOption', $data)) { - $object->setAvailableServicesOption($data['AvailableServicesOption']); - unset($data['AvailableServicesOption']); - } - if (\array_key_exists('AccessPointCOD', $data)) { - $object->setAccessPointCOD($this->denormalizer->denormalize($data['AccessPointCOD'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class, 'json', $context)); - unset($data['AccessPointCOD']); - } - if (\array_key_exists('DeliverToAddresseeOnlyIndicator', $data)) { - $object->setDeliverToAddresseeOnlyIndicator($data['DeliverToAddresseeOnlyIndicator']); - unset($data['DeliverToAddresseeOnlyIndicator']); - } - if (\array_key_exists('DirectDeliveryOnlyIndicator', $data)) { - $object->setDirectDeliveryOnlyIndicator($data['DirectDeliveryOnlyIndicator']); - unset($data['DirectDeliveryOnlyIndicator']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('DeliveryConfirmation', $data)) { - $object->setDeliveryConfirmation($this->denormalizer->denormalize($data['DeliveryConfirmation'], \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsDeliveryConfirmation::class, 'json', $context)); - unset($data['DeliveryConfirmation']); - } - if (\array_key_exists('ReturnOfDocumentIndicator', $data)) { - $object->setReturnOfDocumentIndicator($data['ReturnOfDocumentIndicator']); - unset($data['ReturnOfDocumentIndicator']); - } - if (\array_key_exists('UPScarbonneutralIndicator', $data)) { - $object->setUPScarbonneutralIndicator($data['UPScarbonneutralIndicator']); - unset($data['UPScarbonneutralIndicator']); - } - if (\array_key_exists('CertificateOfOriginIndicator', $data)) { - $object->setCertificateOfOriginIndicator($data['CertificateOfOriginIndicator']); - unset($data['CertificateOfOriginIndicator']); - } - if (\array_key_exists('PickupOptions', $data)) { - $object->setPickupOptions($this->denormalizer->denormalize($data['PickupOptions'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class, 'json', $context)); - unset($data['PickupOptions']); - } - if (\array_key_exists('DeliveryOptions', $data)) { - $object->setDeliveryOptions($this->denormalizer->denormalize($data['DeliveryOptions'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class, 'json', $context)); - unset($data['DeliveryOptions']); - } - if (\array_key_exists('RestrictedArticles', $data)) { - $object->setRestrictedArticles($this->denormalizer->denormalize($data['RestrictedArticles'], \ShipStream\Ups\Api\Model\RateShipmentServiceOptionsRestrictedArticles::class, 'json', $context)); - unset($data['RestrictedArticles']); - } - if (\array_key_exists('ShipperExportDeclarationIndicator', $data)) { - $object->setShipperExportDeclarationIndicator($data['ShipperExportDeclarationIndicator']); - unset($data['ShipperExportDeclarationIndicator']); - } - if (\array_key_exists('CommercialInvoiceRemovalIndicator', $data)) { - $object->setCommercialInvoiceRemovalIndicator($data['CommercialInvoiceRemovalIndicator']); - unset($data['CommercialInvoiceRemovalIndicator']); - } - if (\array_key_exists('ImportControl', $data)) { - $object->setImportControl($this->denormalizer->denormalize($data['ImportControl'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class, 'json', $context)); - unset($data['ImportControl']); - } - if (\array_key_exists('ReturnService', $data)) { - $object->setReturnService($this->denormalizer->denormalize($data['ReturnService'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class, 'json', $context)); - unset($data['ReturnService']); - } - if (\array_key_exists('SDLShipmentIndicator', $data)) { - $object->setSDLShipmentIndicator($data['SDLShipmentIndicator']); - unset($data['SDLShipmentIndicator']); - } - if (\array_key_exists('EPRAIndicator', $data)) { - $object->setEPRAIndicator($data['EPRAIndicator']); - unset($data['EPRAIndicator']); - } - if (\array_key_exists('InsideDelivery', $data)) { - $object->setInsideDelivery($data['InsideDelivery']); - unset($data['InsideDelivery']); - } - if (\array_key_exists('ItemDisposalIndicator', $data)) { - $object->setItemDisposalIndicator($data['ItemDisposalIndicator']); - unset($data['ItemDisposalIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('saturdayPickupIndicator') && null !== $data->getSaturdayPickupIndicator()) { + $dataArray['SaturdayPickupIndicator'] = $data->getSaturdayPickupIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('saturdayPickupIndicator') && null !== $object->getSaturdayPickupIndicator()) { - $data['SaturdayPickupIndicator'] = $object->getSaturdayPickupIndicator(); - } - if ($object->isInitialized('saturdayDeliveryIndicator') && null !== $object->getSaturdayDeliveryIndicator()) { - $data['SaturdayDeliveryIndicator'] = $object->getSaturdayDeliveryIndicator(); - } - if ($object->isInitialized('sundayDeliveryIndicator') && null !== $object->getSundayDeliveryIndicator()) { - $data['SundayDeliveryIndicator'] = $object->getSundayDeliveryIndicator(); - } - if ($object->isInitialized('availableServicesOption') && null !== $object->getAvailableServicesOption()) { - $data['AvailableServicesOption'] = $object->getAvailableServicesOption(); - } - if ($object->isInitialized('accessPointCOD') && null !== $object->getAccessPointCOD()) { - $data['AccessPointCOD'] = $this->normalizer->normalize($object->getAccessPointCOD(), 'json', $context); - } - if ($object->isInitialized('deliverToAddresseeOnlyIndicator') && null !== $object->getDeliverToAddresseeOnlyIndicator()) { - $data['DeliverToAddresseeOnlyIndicator'] = $object->getDeliverToAddresseeOnlyIndicator(); - } - if ($object->isInitialized('directDeliveryOnlyIndicator') && null !== $object->getDirectDeliveryOnlyIndicator()) { - $data['DirectDeliveryOnlyIndicator'] = $object->getDirectDeliveryOnlyIndicator(); - } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('deliveryConfirmation') && null !== $object->getDeliveryConfirmation()) { - $data['DeliveryConfirmation'] = $this->normalizer->normalize($object->getDeliveryConfirmation(), 'json', $context); - } - if ($object->isInitialized('returnOfDocumentIndicator') && null !== $object->getReturnOfDocumentIndicator()) { - $data['ReturnOfDocumentIndicator'] = $object->getReturnOfDocumentIndicator(); - } - if ($object->isInitialized('uPScarbonneutralIndicator') && null !== $object->getUPScarbonneutralIndicator()) { - $data['UPScarbonneutralIndicator'] = $object->getUPScarbonneutralIndicator(); - } - if ($object->isInitialized('certificateOfOriginIndicator') && null !== $object->getCertificateOfOriginIndicator()) { - $data['CertificateOfOriginIndicator'] = $object->getCertificateOfOriginIndicator(); - } - if ($object->isInitialized('pickupOptions') && null !== $object->getPickupOptions()) { - $data['PickupOptions'] = $this->normalizer->normalize($object->getPickupOptions(), 'json', $context); - } - if ($object->isInitialized('deliveryOptions') && null !== $object->getDeliveryOptions()) { - $data['DeliveryOptions'] = $this->normalizer->normalize($object->getDeliveryOptions(), 'json', $context); - } - if ($object->isInitialized('restrictedArticles') && null !== $object->getRestrictedArticles()) { - $data['RestrictedArticles'] = $this->normalizer->normalize($object->getRestrictedArticles(), 'json', $context); - } - if ($object->isInitialized('shipperExportDeclarationIndicator') && null !== $object->getShipperExportDeclarationIndicator()) { - $data['ShipperExportDeclarationIndicator'] = $object->getShipperExportDeclarationIndicator(); - } - if ($object->isInitialized('commercialInvoiceRemovalIndicator') && null !== $object->getCommercialInvoiceRemovalIndicator()) { - $data['CommercialInvoiceRemovalIndicator'] = $object->getCommercialInvoiceRemovalIndicator(); - } - if ($object->isInitialized('importControl') && null !== $object->getImportControl()) { - $data['ImportControl'] = $this->normalizer->normalize($object->getImportControl(), 'json', $context); - } - if ($object->isInitialized('returnService') && null !== $object->getReturnService()) { - $data['ReturnService'] = $this->normalizer->normalize($object->getReturnService(), 'json', $context); - } - if ($object->isInitialized('sDLShipmentIndicator') && null !== $object->getSDLShipmentIndicator()) { - $data['SDLShipmentIndicator'] = $object->getSDLShipmentIndicator(); - } - if ($object->isInitialized('ePRAIndicator') && null !== $object->getEPRAIndicator()) { - $data['EPRAIndicator'] = $object->getEPRAIndicator(); - } - if ($object->isInitialized('insideDelivery') && null !== $object->getInsideDelivery()) { - $data['InsideDelivery'] = $object->getInsideDelivery(); - } - if ($object->isInitialized('itemDisposalIndicator') && null !== $object->getItemDisposalIndicator()) { - $data['ItemDisposalIndicator'] = $object->getItemDisposalIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('saturdayDeliveryIndicator') && null !== $data->getSaturdayDeliveryIndicator()) { + $dataArray['SaturdayDeliveryIndicator'] = $data->getSaturdayDeliveryIndicator(); + } + if ($data->isInitialized('sundayDeliveryIndicator') && null !== $data->getSundayDeliveryIndicator()) { + $dataArray['SundayDeliveryIndicator'] = $data->getSundayDeliveryIndicator(); + } + if ($data->isInitialized('availableServicesOption') && null !== $data->getAvailableServicesOption()) { + $dataArray['AvailableServicesOption'] = $data->getAvailableServicesOption(); + } + if ($data->isInitialized('accessPointCOD') && null !== $data->getAccessPointCOD()) { + $dataArray['AccessPointCOD'] = $this->normalizer->normalize($data->getAccessPointCOD(), 'json', $context); + } + if ($data->isInitialized('deliverToAddresseeOnlyIndicator') && null !== $data->getDeliverToAddresseeOnlyIndicator()) { + $dataArray['DeliverToAddresseeOnlyIndicator'] = $data->getDeliverToAddresseeOnlyIndicator(); + } + if ($data->isInitialized('directDeliveryOnlyIndicator') && null !== $data->getDirectDeliveryOnlyIndicator()) { + $dataArray['DirectDeliveryOnlyIndicator'] = $data->getDirectDeliveryOnlyIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class => false]; + if ($data->isInitialized('cOD') && null !== $data->getCOD()) { + $dataArray['COD'] = $this->normalizer->normalize($data->getCOD(), 'json', $context); } + if ($data->isInitialized('deliveryConfirmation') && null !== $data->getDeliveryConfirmation()) { + $dataArray['DeliveryConfirmation'] = $this->normalizer->normalize($data->getDeliveryConfirmation(), 'json', $context); + } + if ($data->isInitialized('returnOfDocumentIndicator') && null !== $data->getReturnOfDocumentIndicator()) { + $dataArray['ReturnOfDocumentIndicator'] = $data->getReturnOfDocumentIndicator(); + } + if ($data->isInitialized('uPScarbonneutralIndicator') && null !== $data->getUPScarbonneutralIndicator()) { + $dataArray['UPScarbonneutralIndicator'] = $data->getUPScarbonneutralIndicator(); + } + if ($data->isInitialized('certificateOfOriginIndicator') && null !== $data->getCertificateOfOriginIndicator()) { + $dataArray['CertificateOfOriginIndicator'] = $data->getCertificateOfOriginIndicator(); + } + if ($data->isInitialized('pickupOptions') && null !== $data->getPickupOptions()) { + $dataArray['PickupOptions'] = $this->normalizer->normalize($data->getPickupOptions(), 'json', $context); + } + if ($data->isInitialized('deliveryOptions') && null !== $data->getDeliveryOptions()) { + $dataArray['DeliveryOptions'] = $this->normalizer->normalize($data->getDeliveryOptions(), 'json', $context); + } + if ($data->isInitialized('restrictedArticles') && null !== $data->getRestrictedArticles()) { + $dataArray['RestrictedArticles'] = $this->normalizer->normalize($data->getRestrictedArticles(), 'json', $context); + } + if ($data->isInitialized('shipperExportDeclarationIndicator') && null !== $data->getShipperExportDeclarationIndicator()) { + $dataArray['ShipperExportDeclarationIndicator'] = $data->getShipperExportDeclarationIndicator(); + } + if ($data->isInitialized('commercialInvoiceRemovalIndicator') && null !== $data->getCommercialInvoiceRemovalIndicator()) { + $dataArray['CommercialInvoiceRemovalIndicator'] = $data->getCommercialInvoiceRemovalIndicator(); + } + if ($data->isInitialized('importControl') && null !== $data->getImportControl()) { + $dataArray['ImportControl'] = $this->normalizer->normalize($data->getImportControl(), 'json', $context); + } + if ($data->isInitialized('returnService') && null !== $data->getReturnService()) { + $dataArray['ReturnService'] = $this->normalizer->normalize($data->getReturnService(), 'json', $context); + } + if ($data->isInitialized('sDLShipmentIndicator') && null !== $data->getSDLShipmentIndicator()) { + $dataArray['SDLShipmentIndicator'] = $data->getSDLShipmentIndicator(); + } + if ($data->isInitialized('ePRAIndicator') && null !== $data->getEPRAIndicator()) { + $dataArray['EPRAIndicator'] = $data->getEPRAIndicator(); + } + if ($data->isInitialized('insideDelivery') && null !== $data->getInsideDelivery()) { + $dataArray['InsideDelivery'] = $data->getInsideDelivery(); + } + if ($data->isInitialized('itemDisposalIndicator') && null !== $data->getItemDisposalIndicator()) { + $dataArray['ItemDisposalIndicator'] = $data->getItemDisposalIndicator(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateShipmentShipmentServiceOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateShipmentShipperNormalizer.php b/src/Api/Normalizer/RateShipmentShipperNormalizer.php index 889206a7..dcbd9c46 100644 --- a/src/Api/Normalizer/RateShipmentShipperNormalizer.php +++ b/src/Api/Normalizer/RateShipmentShipperNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateShipmentShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateShipmentShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentShipper::class; + return $type === \ShipStream\Ups\Api\Model\RateShipmentShipper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentShipper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentShipper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentShipper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipperAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateShipmentShipper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('shipperNumber') && null !== $object->getShipperNumber()) { - $data['ShipperNumber'] = $object->getShipperNumber(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentShipper::class => false]; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipperAddress::class, 'json', $context)); + unset($data['Address']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class RateShipmentShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateShipmentShipper::class; + $dataArray = []; + if ($data->isInitialized('name') && null !== $data->getName()) { + $dataArray['Name'] = $data->getName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateShipmentShipper::class; + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateShipmentShipper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipperAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('shipperNumber') && null !== $data->getShipperNumber()) { + $dataArray['ShipperNumber'] = $data->getShipperNumber(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('shipperNumber') && null !== $object->getShipperNumber()) { - $data['ShipperNumber'] = $object->getShipperNumber(); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateShipmentShipper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateShipmentShipper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RateTypeNormalizer.php b/src/Api/Normalizer/RateTypeNormalizer.php index 06b451ac..ae4df9e0 100644 --- a/src/Api/Normalizer/RateTypeNormalizer.php +++ b/src/Api/Normalizer/RateTypeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RateTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateType::class; + return $type === \ShipStream\Ups\Api\Model\RateType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RateType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateType::class => false]; - } - } -} else { - class RateTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RateType::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RateType::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RateType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RateType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RateType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedPackageAccessorialNormalizer.php b/src/Api/Normalizer/RatedPackageAccessorialNormalizer.php index 711bc46e..d1d5f418 100644 --- a/src/Api/Normalizer/RatedPackageAccessorialNormalizer.php +++ b/src/Api/Normalizer/RatedPackageAccessorialNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedPackageAccessorialNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedPackageAccessorialNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class; + return $type === \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageAccessorial(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedPackageAccessorial(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageAccessorial::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RatedPackageAccessorialNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageAccessorial(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageAccessorial::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedPackageAccessorial::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedPackageBaseServiceChargeNormalizer.php b/src/Api/Normalizer/RatedPackageBaseServiceChargeNormalizer.php index 4be4f8ae..bfe590e4 100644 --- a/src/Api/Normalizer/RatedPackageBaseServiceChargeNormalizer.php +++ b/src/Api/Normalizer/RatedPackageBaseServiceChargeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedPackageBaseServiceChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedPackageBaseServiceChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class; + return $type === \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class => false]; - } - } -} else { - class RatedPackageBaseServiceChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedPackageBillingWeightNormalizer.php b/src/Api/Normalizer/RatedPackageBillingWeightNormalizer.php index d2e786d8..d06f9ece 100644 --- a/src/Api/Normalizer/RatedPackageBillingWeightNormalizer.php +++ b/src/Api/Normalizer/RatedPackageBillingWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedPackageBillingWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedPackageBillingWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class; + return $type === \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageBillingWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedPackageBillingWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class => false]; - } - } -} else { - class RatedPackageBillingWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageBillingWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Weight'] = $data->getWeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedPackageBillingWeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/RatedPackageBillingWeightUnitOfMeasurementNormalizer.php index 3d419ec8..f33397cc 100644 --- a/src/Api/Normalizer/RatedPackageBillingWeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/RatedPackageBillingWeightUnitOfMeasurementNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedPackageBillingWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedPackageBillingWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class => false]; - } - } -} else { - class RatedPackageBillingWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedPackageBillingWeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedPackageItemizedChargesNormalizer.php b/src/Api/Normalizer/RatedPackageItemizedChargesNormalizer.php index b16c0caf..cfe4556e 100644 --- a/src/Api/Normalizer/RatedPackageItemizedChargesNormalizer.php +++ b/src/Api/Normalizer/RatedPackageItemizedChargesNormalizer.php @@ -5,174 +5,86 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedPackageItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedPackageItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class; + return $type === \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('SubType', $data)) { - $object->setSubType($data['SubType']); - unset($data['SubType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - if ($object->isInitialized('subType') && null !== $object->getSubType()) { - $data['SubType'] = $object->getSubType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class => false]; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - } -} else { - class RatedPackageItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('SubType', $data)) { - $object->setSubType($data['SubType']); - unset($data['SubType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('SubType', $data)) { + $object->setSubType($data['SubType']); + unset($data['SubType']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - if ($object->isInitialized('subType') && null !== $object->getSubType()) { - $data['SubType'] = $object->getSubType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); + } + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + if ($data->isInitialized('subType') && null !== $data->getSubType()) { + $dataArray['SubType'] = $data->getSubType(); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedPackageNegotiatedChargesNormalizer.php b/src/Api/Normalizer/RatedPackageNegotiatedChargesNormalizer.php index 3700d563..375c0f15 100644 --- a/src/Api/Normalizer/RatedPackageNegotiatedChargesNormalizer.php +++ b/src/Api/Normalizer/RatedPackageNegotiatedChargesNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedPackageNegotiatedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedPackageNegotiatedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class; + return $type === \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values = []; - foreach ($data['ItemizedCharges'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values); - unset($data['ItemizedCharges']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values = []; - foreach ($object->getItemizedCharges() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ItemizedCharges'] = $values; + if (\array_key_exists('ItemizedCharges', $data)) { + $values = []; + foreach ($data['ItemizedCharges'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class, 'json', $context); } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setItemizedCharges($values); + unset($data['ItemizedCharges']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class RatedPackageNegotiatedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values = []; - foreach ($data['ItemizedCharges'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\NegotiatedChargesItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values); - unset($data['ItemizedCharges']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + $dataArray = []; + if ($data->isInitialized('itemizedCharges') && null !== $data->getItemizedCharges()) { + $values = []; + foreach ($data->getItemizedCharges() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['ItemizedCharges'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values = []; - foreach ($object->getItemizedCharges() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ItemizedCharges'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedPackageRateModifierNormalizer.php b/src/Api/Normalizer/RatedPackageRateModifierNormalizer.php index bd5ba95d..99a922b9 100644 --- a/src/Api/Normalizer/RatedPackageRateModifierNormalizer.php +++ b/src/Api/Normalizer/RatedPackageRateModifierNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedPackageRateModifierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedPackageRateModifierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class; + return $type === \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageRateModifier(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ModifierType', $data)) { - $object->setModifierType($data['ModifierType']); - unset($data['ModifierType']); - } - if (\array_key_exists('ModifierDesc', $data)) { - $object->setModifierDesc($data['ModifierDesc']); - unset($data['ModifierDesc']); - } - if (\array_key_exists('Amount', $data)) { - $object->setAmount($data['Amount']); - unset($data['Amount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedPackageRateModifier(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ModifierType'] = $object->getModifierType(); - $data['ModifierDesc'] = $object->getModifierDesc(); - $data['Amount'] = $object->getAmount(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ModifierType', $data)) { + $object->setModifierType($data['ModifierType']); + unset($data['ModifierType']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageRateModifier::class => false]; + if (\array_key_exists('ModifierDesc', $data)) { + $object->setModifierDesc($data['ModifierDesc']); + unset($data['ModifierDesc']); } - } -} else { - class RatedPackageRateModifierNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class; + if (\array_key_exists('Amount', $data)) { + $object->setAmount($data['Amount']); + unset($data['Amount']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageRateModifier(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ModifierType', $data)) { - $object->setModifierType($data['ModifierType']); - unset($data['ModifierType']); - } - if (\array_key_exists('ModifierDesc', $data)) { - $object->setModifierDesc($data['ModifierDesc']); - unset($data['ModifierDesc']); - } - if (\array_key_exists('Amount', $data)) { - $object->setAmount($data['Amount']); - unset($data['Amount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ModifierType'] = $object->getModifierType(); - $data['ModifierDesc'] = $object->getModifierDesc(); - $data['Amount'] = $object->getAmount(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ModifierType'] = $data->getModifierType(); + $dataArray['ModifierDesc'] = $data->getModifierDesc(); + $dataArray['Amount'] = $data->getAmount(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageRateModifier::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedPackageRateModifier::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedPackageServiceOptionsChargesNormalizer.php b/src/Api/Normalizer/RatedPackageServiceOptionsChargesNormalizer.php index 592f4818..02457ee2 100644 --- a/src/Api/Normalizer/RatedPackageServiceOptionsChargesNormalizer.php +++ b/src/Api/Normalizer/RatedPackageServiceOptionsChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedPackageServiceOptionsChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedPackageServiceOptionsChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class; + return $type === \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class => false]; - } - } -} else { - class RatedPackageServiceOptionsChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedPackageSimpleRateNormalizer.php b/src/Api/Normalizer/RatedPackageSimpleRateNormalizer.php index bd4d7958..940ab9e2 100644 --- a/src/Api/Normalizer/RatedPackageSimpleRateNormalizer.php +++ b/src/Api/Normalizer/RatedPackageSimpleRateNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedPackageSimpleRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedPackageSimpleRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class; + return $type === \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageSimpleRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedPackageSimpleRate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RatedPackageSimpleRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageSimpleRate(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedPackageTotalChargesNormalizer.php b/src/Api/Normalizer/RatedPackageTotalChargesNormalizer.php index f2e31c57..33c0aebe 100644 --- a/src/Api/Normalizer/RatedPackageTotalChargesNormalizer.php +++ b/src/Api/Normalizer/RatedPackageTotalChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedPackageTotalChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedPackageTotalChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class; + return $type === \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageTotalCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedPackageTotalCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class => false]; - } - } -} else { - class RatedPackageTotalChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageTotalCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedPackageTransportationChargesNormalizer.php b/src/Api/Normalizer/RatedPackageTransportationChargesNormalizer.php index 8c1f2d93..80a04e5a 100644 --- a/src/Api/Normalizer/RatedPackageTransportationChargesNormalizer.php +++ b/src/Api/Normalizer/RatedPackageTransportationChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedPackageTransportationChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedPackageTransportationChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class; + return $type === \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class => false]; - } - } -} else { - class RatedPackageTransportationChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentBaseServiceChargeNormalizer.php b/src/Api/Normalizer/RatedShipmentBaseServiceChargeNormalizer.php index 63d82eea..af2983fa 100644 --- a/src/Api/Normalizer/RatedShipmentBaseServiceChargeNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentBaseServiceChargeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentBaseServiceChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentBaseServiceChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class => false]; - } - } -} else { - class RatedShipmentBaseServiceChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentBaseServiceCharge::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentBillingWeightNormalizer.php b/src/Api/Normalizer/RatedShipmentBillingWeightNormalizer.php index e3bdc016..fe97b6e4 100644 --- a/src/Api/Normalizer/RatedShipmentBillingWeightNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentBillingWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentBillingWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentBillingWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class => false]; - } - } -} else { - class RatedShipmentBillingWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentBillingWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Weight'] = $data->getWeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentBillingWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentDisclaimerNormalizer.php b/src/Api/Normalizer/RatedShipmentDisclaimerNormalizer.php index 56eda83c..a1803214 100644 --- a/src/Api/Normalizer/RatedShipmentDisclaimerNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentDisclaimerNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentDisclaimerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentDisclaimerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class => false]; - } - } -} else { - class RatedShipmentDisclaimerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentDisclaimer(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentDisclaimer::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentFRSShipmentDataNormalizer.php b/src/Api/Normalizer/RatedShipmentFRSShipmentDataNormalizer.php index cedd9ded..5951e4a7 100644 --- a/src/Api/Normalizer/RatedShipmentFRSShipmentDataNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentFRSShipmentDataNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentFRSShipmentDataNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentFRSShipmentDataNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransportationCharges', $data)) { - $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class, 'json', $context)); - unset($data['TransportationCharges']); - } - if (\array_key_exists('FreightDensityRate', $data)) { - $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class, 'json', $context)); - unset($data['FreightDensityRate']); - } - if (\array_key_exists('HandlingUnits', $data)) { - $values = []; - foreach ($data['HandlingUnits'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class, 'json', $context); - } - $object->setHandlingUnits($values); - unset($data['HandlingUnits']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['TransportationCharges'] = $this->normalizer->normalize($object->getTransportationCharges(), 'json', $context); - if ($object->isInitialized('freightDensityRate') && null !== $object->getFreightDensityRate()) { - $data['FreightDensityRate'] = $this->normalizer->normalize($object->getFreightDensityRate(), 'json', $context); - } - if ($object->isInitialized('handlingUnits') && null !== $object->getHandlingUnits()) { - $values = []; - foreach ($object->getHandlingUnits() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['HandlingUnits'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('TransportationCharges', $data)) { + $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class, 'json', $context)); + unset($data['TransportationCharges']); + } + if (\array_key_exists('FreightDensityRate', $data)) { + $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class, 'json', $context)); + unset($data['FreightDensityRate']); + } + if (\array_key_exists('HandlingUnits', $data)) { + $values = []; + foreach ($data['HandlingUnits'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class, 'json', $context); } - return $data; + $object->setHandlingUnits($values); + unset($data['HandlingUnits']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class RatedShipmentFRSShipmentDataNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class; + $dataArray = []; + $dataArray['TransportationCharges'] = $this->normalizer->normalize($data->getTransportationCharges(), 'json', $context); + if ($data->isInitialized('freightDensityRate') && null !== $data->getFreightDensityRate()) { + $dataArray['FreightDensityRate'] = $this->normalizer->normalize($data->getFreightDensityRate(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransportationCharges', $data)) { - $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class, 'json', $context)); - unset($data['TransportationCharges']); - } - if (\array_key_exists('FreightDensityRate', $data)) { - $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class, 'json', $context)); - unset($data['FreightDensityRate']); - } - if (\array_key_exists('HandlingUnits', $data)) { - $values = []; - foreach ($data['HandlingUnits'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class, 'json', $context); - } - $object->setHandlingUnits($values); - unset($data['HandlingUnits']); + if ($data->isInitialized('handlingUnits') && null !== $data->getHandlingUnits()) { + $values = []; + foreach ($data->getHandlingUnits() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray['HandlingUnits'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['TransportationCharges'] = $this->normalizer->normalize($object->getTransportationCharges(), 'json', $context); - if ($object->isInitialized('freightDensityRate') && null !== $object->getFreightDensityRate()) { - $data['FreightDensityRate'] = $this->normalizer->normalize($object->getFreightDensityRate(), 'json', $context); - } - if ($object->isInitialized('handlingUnits') && null !== $object->getHandlingUnits()) { - $values = []; - foreach ($object->getHandlingUnits() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['HandlingUnits'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentFRSShipmentData::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentItemizedChargesNormalizer.php b/src/Api/Normalizer/RatedShipmentItemizedChargesNormalizer.php index 6495d1ed..c575a4ad 100644 --- a/src/Api/Normalizer/RatedShipmentItemizedChargesNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentItemizedChargesNormalizer.php @@ -5,174 +5,86 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('SubType', $data)) { - $object->setSubType($data['SubType']); - unset($data['SubType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - if ($object->isInitialized('subType') && null !== $object->getSubType()) { - $data['SubType'] = $object->getSubType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class => false]; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - } -} else { - class RatedShipmentItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('SubType', $data)) { - $object->setSubType($data['SubType']); - unset($data['SubType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('SubType', $data)) { + $object->setSubType($data['SubType']); + unset($data['SubType']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - if ($object->isInitialized('subType') && null !== $object->getSubType()) { - $data['SubType'] = $object->getSubType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); + } + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + if ($data->isInitialized('subType') && null !== $data->getSubType()) { + $dataArray['SubType'] = $data->getSubType(); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentItemizedCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentNegotiatedRateChargesNormalizer.php b/src/Api/Normalizer/RatedShipmentNegotiatedRateChargesNormalizer.php index 915284c6..cf407a85 100644 --- a/src/Api/Normalizer/RatedShipmentNegotiatedRateChargesNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentNegotiatedRateChargesNormalizer.php @@ -5,200 +5,99 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentNegotiatedRateChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentNegotiatedRateChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values = []; - foreach ($data['ItemizedCharges'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values); - unset($data['ItemizedCharges']); - } - if (\array_key_exists('TaxCharges', $data)) { - $values_1 = []; - foreach ($data['TaxCharges'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class, 'json', $context); - } - $object->setTaxCharges($values_1); - unset($data['TaxCharges']); - } - if (\array_key_exists('TotalCharge', $data)) { - $object->setTotalCharge($this->denormalizer->denormalize($data['TotalCharge'], \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class, 'json', $context)); - unset($data['TotalCharge']); - } - if (\array_key_exists('TotalChargesWithTaxes', $data)) { - $object->setTotalChargesWithTaxes($this->denormalizer->denormalize($data['TotalChargesWithTaxes'], \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class, 'json', $context)); - unset($data['TotalChargesWithTaxes']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values = []; - foreach ($object->getItemizedCharges() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ItemizedCharges'] = $values; - } - if ($object->isInitialized('taxCharges') && null !== $object->getTaxCharges()) { - $values_1 = []; - foreach ($object->getTaxCharges() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['TaxCharges'] = $values_1; - } - $data['TotalCharge'] = $this->normalizer->normalize($object->getTotalCharge(), 'json', $context); - if ($object->isInitialized('totalChargesWithTaxes') && null !== $object->getTotalChargesWithTaxes()) { - $data['TotalChargesWithTaxes'] = $this->normalizer->normalize($object->getTotalChargesWithTaxes(), 'json', $context); + if (\array_key_exists('ItemizedCharges', $data)) { + $values = []; + foreach ($data['ItemizedCharges'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; + $object->setItemizedCharges($values); + unset($data['ItemizedCharges']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class => false]; + if (\array_key_exists('TaxCharges', $data)) { + $values_1 = []; + foreach ($data['TaxCharges'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class, 'json', $context); + } + $object->setTaxCharges($values_1); + unset($data['TaxCharges']); } - } -} else { - class RatedShipmentNegotiatedRateChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class; + if (\array_key_exists('TotalCharge', $data)) { + $object->setTotalCharge($this->denormalizer->denormalize($data['TotalCharge'], \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class, 'json', $context)); + unset($data['TotalCharge']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class; + if (\array_key_exists('TotalChargesWithTaxes', $data)) { + $object->setTotalChargesWithTaxes($this->denormalizer->denormalize($data['TotalChargesWithTaxes'], \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class, 'json', $context)); + unset($data['TotalChargesWithTaxes']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values = []; - foreach ($data['ItemizedCharges'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values); - unset($data['ItemizedCharges']); - } - if (\array_key_exists('TaxCharges', $data)) { - $values_1 = []; - foreach ($data['TaxCharges'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class, 'json', $context); - } - $object->setTaxCharges($values_1); - unset($data['TaxCharges']); - } - if (\array_key_exists('TotalCharge', $data)) { - $object->setTotalCharge($this->denormalizer->denormalize($data['TotalCharge'], \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class, 'json', $context)); - unset($data['TotalCharge']); - } - if (\array_key_exists('TotalChargesWithTaxes', $data)) { - $object->setTotalChargesWithTaxes($this->denormalizer->denormalize($data['TotalChargesWithTaxes'], \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class, 'json', $context)); - unset($data['TotalChargesWithTaxes']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values = []; - foreach ($object->getItemizedCharges() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ItemizedCharges'] = $values; - } - if ($object->isInitialized('taxCharges') && null !== $object->getTaxCharges()) { - $values_1 = []; - foreach ($object->getTaxCharges() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['TaxCharges'] = $values_1; - } - $data['TotalCharge'] = $this->normalizer->normalize($object->getTotalCharge(), 'json', $context); - if ($object->isInitialized('totalChargesWithTaxes') && null !== $object->getTotalChargesWithTaxes()) { - $data['TotalChargesWithTaxes'] = $this->normalizer->normalize($object->getTotalChargesWithTaxes(), 'json', $context); + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('itemizedCharges') && null !== $data->getItemizedCharges()) { + $values = []; + foreach ($data->getItemizedCharges() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $dataArray['ItemizedCharges'] = $values; + } + if ($data->isInitialized('taxCharges') && null !== $data->getTaxCharges()) { + $values_1 = []; + foreach ($data->getTaxCharges() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['TaxCharges'] = $values_1; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class => false]; + $dataArray['TotalCharge'] = $this->normalizer->normalize($data->getTotalCharge(), 'json', $context); + if ($data->isInitialized('totalChargesWithTaxes') && null !== $data->getTotalChargesWithTaxes()) { + $dataArray['TotalChargesWithTaxes'] = $this->normalizer->normalize($data->getTotalChargesWithTaxes(), 'json', $context); } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentNegotiatedRateCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentRatedPackageNormalizer.php b/src/Api/Normalizer/RatedShipmentRatedPackageNormalizer.php index d75c3432..822fda65 100644 --- a/src/Api/Normalizer/RatedShipmentRatedPackageNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentRatedPackageNormalizer.php @@ -5,318 +5,158 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentRatedPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentRatedPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BaseServiceCharge', $data)) { - $object->setBaseServiceCharge($this->denormalizer->denormalize($data['BaseServiceCharge'], \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class, 'json', $context)); - unset($data['BaseServiceCharge']); - } - if (\array_key_exists('TransportationCharges', $data)) { - $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class, 'json', $context)); - unset($data['TransportationCharges']); - } - if (\array_key_exists('ServiceOptionsCharges', $data)) { - $object->setServiceOptionsCharges($this->denormalizer->denormalize($data['ServiceOptionsCharges'], \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class, 'json', $context)); - unset($data['ServiceOptionsCharges']); - } - if (\array_key_exists('TotalCharges', $data)) { - $object->setTotalCharges($this->denormalizer->denormalize($data['TotalCharges'], \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class, 'json', $context)); - unset($data['TotalCharges']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - if (\array_key_exists('BillingWeight', $data)) { - $object->setBillingWeight($this->denormalizer->denormalize($data['BillingWeight'], \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class, 'json', $context)); - unset($data['BillingWeight']); - } - if (\array_key_exists('Accessorial', $data)) { - $values = []; - foreach ($data['Accessorial'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class, 'json', $context); - } - $object->setAccessorial($values); - unset($data['Accessorial']); - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values_1 = []; - foreach ($data['ItemizedCharges'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values_1); - unset($data['ItemizedCharges']); - } - if (\array_key_exists('NegotiatedCharges', $data)) { - $object->setNegotiatedCharges($this->denormalizer->denormalize($data['NegotiatedCharges'], \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class, 'json', $context)); - unset($data['NegotiatedCharges']); - } - if (\array_key_exists('SimpleRate', $data)) { - $object->setSimpleRate($this->denormalizer->denormalize($data['SimpleRate'], \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class, 'json', $context)); - unset($data['SimpleRate']); - } - if (\array_key_exists('RateModifier', $data)) { - $values_2 = []; - foreach ($data['RateModifier'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class, 'json', $context); - } - $object->setRateModifier($values_2); - unset($data['RateModifier']); - } - foreach ($data as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_3; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('baseServiceCharge') && null !== $object->getBaseServiceCharge()) { - $data['BaseServiceCharge'] = $this->normalizer->normalize($object->getBaseServiceCharge(), 'json', $context); - } - if ($object->isInitialized('transportationCharges') && null !== $object->getTransportationCharges()) { - $data['TransportationCharges'] = $this->normalizer->normalize($object->getTransportationCharges(), 'json', $context); - } - if ($object->isInitialized('serviceOptionsCharges') && null !== $object->getServiceOptionsCharges()) { - $data['ServiceOptionsCharges'] = $this->normalizer->normalize($object->getServiceOptionsCharges(), 'json', $context); - } - if ($object->isInitialized('totalCharges') && null !== $object->getTotalCharges()) { - $data['TotalCharges'] = $this->normalizer->normalize($object->getTotalCharges(), 'json', $context); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['Weight'] = $object->getWeight(); - } - if ($object->isInitialized('billingWeight') && null !== $object->getBillingWeight()) { - $data['BillingWeight'] = $this->normalizer->normalize($object->getBillingWeight(), 'json', $context); - } - if ($object->isInitialized('accessorial') && null !== $object->getAccessorial()) { - $values = []; - foreach ($object->getAccessorial() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Accessorial'] = $values; - } - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values_1 = []; - foreach ($object->getItemizedCharges() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ItemizedCharges'] = $values_1; - } - if ($object->isInitialized('negotiatedCharges') && null !== $object->getNegotiatedCharges()) { - $data['NegotiatedCharges'] = $this->normalizer->normalize($object->getNegotiatedCharges(), 'json', $context); - } - if ($object->isInitialized('simpleRate') && null !== $object->getSimpleRate()) { - $data['SimpleRate'] = $this->normalizer->normalize($object->getSimpleRate(), 'json', $context); + if (\array_key_exists('BaseServiceCharge', $data)) { + $object->setBaseServiceCharge($this->denormalizer->denormalize($data['BaseServiceCharge'], \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class, 'json', $context)); + unset($data['BaseServiceCharge']); + } + if (\array_key_exists('TransportationCharges', $data)) { + $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class, 'json', $context)); + unset($data['TransportationCharges']); + } + if (\array_key_exists('ServiceOptionsCharges', $data)) { + $object->setServiceOptionsCharges($this->denormalizer->denormalize($data['ServiceOptionsCharges'], \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class, 'json', $context)); + unset($data['ServiceOptionsCharges']); + } + if (\array_key_exists('TotalCharges', $data)) { + $object->setTotalCharges($this->denormalizer->denormalize($data['TotalCharges'], \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class, 'json', $context)); + unset($data['TotalCharges']); + } + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); + } + if (\array_key_exists('BillingWeight', $data)) { + $object->setBillingWeight($this->denormalizer->denormalize($data['BillingWeight'], \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class, 'json', $context)); + unset($data['BillingWeight']); + } + if (\array_key_exists('Accessorial', $data)) { + $values = []; + foreach ($data['Accessorial'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class, 'json', $context); } - if ($object->isInitialized('rateModifier') && null !== $object->getRateModifier()) { - $values_2 = []; - foreach ($object->getRateModifier() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['RateModifier'] = $values_2; + $object->setAccessorial($values); + unset($data['Accessorial']); + } + if (\array_key_exists('ItemizedCharges', $data)) { + $values_1 = []; + foreach ($data['ItemizedCharges'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class, 'json', $context); } - foreach ($object as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_3; - } + $object->setItemizedCharges($values_1); + unset($data['ItemizedCharges']); + } + if (\array_key_exists('NegotiatedCharges', $data)) { + $object->setNegotiatedCharges($this->denormalizer->denormalize($data['NegotiatedCharges'], \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class, 'json', $context)); + unset($data['NegotiatedCharges']); + } + if (\array_key_exists('SimpleRate', $data)) { + $object->setSimpleRate($this->denormalizer->denormalize($data['SimpleRate'], \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class, 'json', $context)); + unset($data['SimpleRate']); + } + if (\array_key_exists('RateModifier', $data)) { + $values_2 = []; + foreach ($data['RateModifier'] as $value_2) { + $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class, 'json', $context); } - return $data; + $object->setRateModifier($values_2); + unset($data['RateModifier']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class => false]; + foreach ($data as $key => $value_3) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_3; + } } + return $object; } -} else { - class RatedShipmentRatedPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class; + $dataArray = []; + if ($data->isInitialized('baseServiceCharge') && null !== $data->getBaseServiceCharge()) { + $dataArray['BaseServiceCharge'] = $this->normalizer->normalize($data->getBaseServiceCharge(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class; + if ($data->isInitialized('transportationCharges') && null !== $data->getTransportationCharges()) { + $dataArray['TransportationCharges'] = $this->normalizer->normalize($data->getTransportationCharges(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentRatedPackage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BaseServiceCharge', $data)) { - $object->setBaseServiceCharge($this->denormalizer->denormalize($data['BaseServiceCharge'], \ShipStream\Ups\Api\Model\RatedPackageBaseServiceCharge::class, 'json', $context)); - unset($data['BaseServiceCharge']); - } - if (\array_key_exists('TransportationCharges', $data)) { - $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\RatedPackageTransportationCharges::class, 'json', $context)); - unset($data['TransportationCharges']); - } - if (\array_key_exists('ServiceOptionsCharges', $data)) { - $object->setServiceOptionsCharges($this->denormalizer->denormalize($data['ServiceOptionsCharges'], \ShipStream\Ups\Api\Model\RatedPackageServiceOptionsCharges::class, 'json', $context)); - unset($data['ServiceOptionsCharges']); - } - if (\array_key_exists('TotalCharges', $data)) { - $object->setTotalCharges($this->denormalizer->denormalize($data['TotalCharges'], \ShipStream\Ups\Api\Model\RatedPackageTotalCharges::class, 'json', $context)); - unset($data['TotalCharges']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - if (\array_key_exists('BillingWeight', $data)) { - $object->setBillingWeight($this->denormalizer->denormalize($data['BillingWeight'], \ShipStream\Ups\Api\Model\RatedPackageBillingWeight::class, 'json', $context)); - unset($data['BillingWeight']); - } - if (\array_key_exists('Accessorial', $data)) { - $values = []; - foreach ($data['Accessorial'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\RatedPackageAccessorial::class, 'json', $context); - } - $object->setAccessorial($values); - unset($data['Accessorial']); - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values_1 = []; - foreach ($data['ItemizedCharges'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\RatedPackageItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values_1); - unset($data['ItemizedCharges']); - } - if (\array_key_exists('NegotiatedCharges', $data)) { - $object->setNegotiatedCharges($this->denormalizer->denormalize($data['NegotiatedCharges'], \ShipStream\Ups\Api\Model\RatedPackageNegotiatedCharges::class, 'json', $context)); - unset($data['NegotiatedCharges']); - } - if (\array_key_exists('SimpleRate', $data)) { - $object->setSimpleRate($this->denormalizer->denormalize($data['SimpleRate'], \ShipStream\Ups\Api\Model\RatedPackageSimpleRate::class, 'json', $context)); - unset($data['SimpleRate']); - } - if (\array_key_exists('RateModifier', $data)) { - $values_2 = []; - foreach ($data['RateModifier'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\RatedPackageRateModifier::class, 'json', $context); - } - $object->setRateModifier($values_2); - unset($data['RateModifier']); - } - foreach ($data as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_3; - } - } - return $object; + if ($data->isInitialized('serviceOptionsCharges') && null !== $data->getServiceOptionsCharges()) { + $dataArray['ServiceOptionsCharges'] = $this->normalizer->normalize($data->getServiceOptionsCharges(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('baseServiceCharge') && null !== $object->getBaseServiceCharge()) { - $data['BaseServiceCharge'] = $this->normalizer->normalize($object->getBaseServiceCharge(), 'json', $context); - } - if ($object->isInitialized('transportationCharges') && null !== $object->getTransportationCharges()) { - $data['TransportationCharges'] = $this->normalizer->normalize($object->getTransportationCharges(), 'json', $context); - } - if ($object->isInitialized('serviceOptionsCharges') && null !== $object->getServiceOptionsCharges()) { - $data['ServiceOptionsCharges'] = $this->normalizer->normalize($object->getServiceOptionsCharges(), 'json', $context); - } - if ($object->isInitialized('totalCharges') && null !== $object->getTotalCharges()) { - $data['TotalCharges'] = $this->normalizer->normalize($object->getTotalCharges(), 'json', $context); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['Weight'] = $object->getWeight(); - } - if ($object->isInitialized('billingWeight') && null !== $object->getBillingWeight()) { - $data['BillingWeight'] = $this->normalizer->normalize($object->getBillingWeight(), 'json', $context); - } - if ($object->isInitialized('accessorial') && null !== $object->getAccessorial()) { - $values = []; - foreach ($object->getAccessorial() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Accessorial'] = $values; - } - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values_1 = []; - foreach ($object->getItemizedCharges() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ItemizedCharges'] = $values_1; - } - if ($object->isInitialized('negotiatedCharges') && null !== $object->getNegotiatedCharges()) { - $data['NegotiatedCharges'] = $this->normalizer->normalize($object->getNegotiatedCharges(), 'json', $context); - } - if ($object->isInitialized('simpleRate') && null !== $object->getSimpleRate()) { - $data['SimpleRate'] = $this->normalizer->normalize($object->getSimpleRate(), 'json', $context); + if ($data->isInitialized('totalCharges') && null !== $data->getTotalCharges()) { + $dataArray['TotalCharges'] = $this->normalizer->normalize($data->getTotalCharges(), 'json', $context); + } + if ($data->isInitialized('weight') && null !== $data->getWeight()) { + $dataArray['Weight'] = $data->getWeight(); + } + if ($data->isInitialized('billingWeight') && null !== $data->getBillingWeight()) { + $dataArray['BillingWeight'] = $this->normalizer->normalize($data->getBillingWeight(), 'json', $context); + } + if ($data->isInitialized('accessorial') && null !== $data->getAccessorial()) { + $values = []; + foreach ($data->getAccessorial() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - if ($object->isInitialized('rateModifier') && null !== $object->getRateModifier()) { - $values_2 = []; - foreach ($object->getRateModifier() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['RateModifier'] = $values_2; + $dataArray['Accessorial'] = $values; + } + if ($data->isInitialized('itemizedCharges') && null !== $data->getItemizedCharges()) { + $values_1 = []; + foreach ($data->getItemizedCharges() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - foreach ($object as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_3; - } + $dataArray['ItemizedCharges'] = $values_1; + } + if ($data->isInitialized('negotiatedCharges') && null !== $data->getNegotiatedCharges()) { + $dataArray['NegotiatedCharges'] = $this->normalizer->normalize($data->getNegotiatedCharges(), 'json', $context); + } + if ($data->isInitialized('simpleRate') && null !== $data->getSimpleRate()) { + $dataArray['SimpleRate'] = $this->normalizer->normalize($data->getSimpleRate(), 'json', $context); + } + if ($data->isInitialized('rateModifier') && null !== $data->getRateModifier()) { + $values_2 = []; + foreach ($data->getRateModifier() as $value_2) { + $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); } - return $data; + $dataArray['RateModifier'] = $values_2; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class => false]; + foreach ($data as $key => $value_3) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_3; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentRatedPackage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentRatedShipmentAlertNormalizer.php b/src/Api/Normalizer/RatedShipmentRatedShipmentAlertNormalizer.php index 3359ac84..335e35f6 100644 --- a/src/Api/Normalizer/RatedShipmentRatedShipmentAlertNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentRatedShipmentAlertNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentRatedShipmentAlertNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentRatedShipmentAlertNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class => false]; - } - } -} else { - class RatedShipmentRatedShipmentAlertNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentRatedShipmentAlert::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentServiceNormalizer.php b/src/Api/Normalizer/RatedShipmentServiceNormalizer.php index dd90995a..fb4fa1ef 100644 --- a/src/Api/Normalizer/RatedShipmentServiceNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentServiceNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentService::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentService::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentService::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentService::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentService(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentService::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RatedShipmentServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentService::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentService::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentService::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentService::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentServiceOptionsChargesNormalizer.php b/src/Api/Normalizer/RatedShipmentServiceOptionsChargesNormalizer.php index fe0de991..42b85bd1 100644 --- a/src/Api/Normalizer/RatedShipmentServiceOptionsChargesNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentServiceOptionsChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentServiceOptionsChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentServiceOptionsChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class => false]; - } - } -} else { - class RatedShipmentServiceOptionsChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentServiceOptionsCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentTaxChargesNormalizer.php b/src/Api/Normalizer/RatedShipmentTaxChargesNormalizer.php index 8b0bd0de..78b30d4e 100644 --- a/src/Api/Normalizer/RatedShipmentTaxChargesNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentTaxChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentTaxChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentTaxChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $object->getType(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class => false]; - } - } -} else { - class RatedShipmentTaxChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class; + if (\array_key_exists('Type', $data)) { + $object->setType($data['Type']); + unset($data['Type']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentTaxCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $object->getType(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Type'] = $data->getType(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentTaxCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentTimeInTransitNormalizer.php b/src/Api/Normalizer/RatedShipmentTimeInTransitNormalizer.php index b49ae859..3677b4fa 100644 --- a/src/Api/Normalizer/RatedShipmentTimeInTransitNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentTimeInTransitNormalizer.php @@ -5,192 +5,95 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentTimeInTransitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentTimeInTransitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - if (\array_key_exists('DocumentsOnlyIndicator', $data)) { - $object->setDocumentsOnlyIndicator($data['DocumentsOnlyIndicator']); - unset($data['DocumentsOnlyIndicator']); - } - if (\array_key_exists('PackageBillType', $data)) { - $object->setPackageBillType($data['PackageBillType']); - unset($data['PackageBillType']); - } - if (\array_key_exists('ServiceSummary', $data)) { - $object->setServiceSummary($this->denormalizer->denormalize($data['ServiceSummary'], \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class, 'json', $context)); - unset($data['ServiceSummary']); - } - if (\array_key_exists('AutoDutyCode', $data)) { - $object->setAutoDutyCode($data['AutoDutyCode']); - unset($data['AutoDutyCode']); - } - if (\array_key_exists('Disclaimer', $data)) { - $object->setDisclaimer($data['Disclaimer']); - unset($data['Disclaimer']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PickupDate'] = $object->getPickupDate(); - if ($object->isInitialized('documentsOnlyIndicator') && null !== $object->getDocumentsOnlyIndicator()) { - $data['DocumentsOnlyIndicator'] = $object->getDocumentsOnlyIndicator(); - } - if ($object->isInitialized('packageBillType') && null !== $object->getPackageBillType()) { - $data['PackageBillType'] = $object->getPackageBillType(); - } - $data['ServiceSummary'] = $this->normalizer->normalize($object->getServiceSummary(), 'json', $context); - if ($object->isInitialized('autoDutyCode') && null !== $object->getAutoDutyCode()) { - $data['AutoDutyCode'] = $object->getAutoDutyCode(); - } - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $data['Disclaimer'] = $object->getDisclaimer(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('PickupDate', $data)) { + $object->setPickupDate($data['PickupDate']); + unset($data['PickupDate']); + } + if (\array_key_exists('DocumentsOnlyIndicator', $data)) { + $object->setDocumentsOnlyIndicator($data['DocumentsOnlyIndicator']); + unset($data['DocumentsOnlyIndicator']); + } + if (\array_key_exists('PackageBillType', $data)) { + $object->setPackageBillType($data['PackageBillType']); + unset($data['PackageBillType']); + } + if (\array_key_exists('ServiceSummary', $data)) { + $object->setServiceSummary($this->denormalizer->denormalize($data['ServiceSummary'], \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class, 'json', $context)); + unset($data['ServiceSummary']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class => false]; + if (\array_key_exists('AutoDutyCode', $data)) { + $object->setAutoDutyCode($data['AutoDutyCode']); + unset($data['AutoDutyCode']); } + if (\array_key_exists('Disclaimer', $data)) { + $object->setDisclaimer($data['Disclaimer']); + unset($data['Disclaimer']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class RatedShipmentTimeInTransitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class; + $dataArray = []; + $dataArray['PickupDate'] = $data->getPickupDate(); + if ($data->isInitialized('documentsOnlyIndicator') && null !== $data->getDocumentsOnlyIndicator()) { + $dataArray['DocumentsOnlyIndicator'] = $data->getDocumentsOnlyIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class; + if ($data->isInitialized('packageBillType') && null !== $data->getPackageBillType()) { + $dataArray['PackageBillType'] = $data->getPackageBillType(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - if (\array_key_exists('DocumentsOnlyIndicator', $data)) { - $object->setDocumentsOnlyIndicator($data['DocumentsOnlyIndicator']); - unset($data['DocumentsOnlyIndicator']); - } - if (\array_key_exists('PackageBillType', $data)) { - $object->setPackageBillType($data['PackageBillType']); - unset($data['PackageBillType']); - } - if (\array_key_exists('ServiceSummary', $data)) { - $object->setServiceSummary($this->denormalizer->denormalize($data['ServiceSummary'], \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class, 'json', $context)); - unset($data['ServiceSummary']); - } - if (\array_key_exists('AutoDutyCode', $data)) { - $object->setAutoDutyCode($data['AutoDutyCode']); - unset($data['AutoDutyCode']); - } - if (\array_key_exists('Disclaimer', $data)) { - $object->setDisclaimer($data['Disclaimer']); - unset($data['Disclaimer']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray['ServiceSummary'] = $this->normalizer->normalize($data->getServiceSummary(), 'json', $context); + if ($data->isInitialized('autoDutyCode') && null !== $data->getAutoDutyCode()) { + $dataArray['AutoDutyCode'] = $data->getAutoDutyCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PickupDate'] = $object->getPickupDate(); - if ($object->isInitialized('documentsOnlyIndicator') && null !== $object->getDocumentsOnlyIndicator()) { - $data['DocumentsOnlyIndicator'] = $object->getDocumentsOnlyIndicator(); - } - if ($object->isInitialized('packageBillType') && null !== $object->getPackageBillType()) { - $data['PackageBillType'] = $object->getPackageBillType(); - } - $data['ServiceSummary'] = $this->normalizer->normalize($object->getServiceSummary(), 'json', $context); - if ($object->isInitialized('autoDutyCode') && null !== $object->getAutoDutyCode()) { - $data['AutoDutyCode'] = $object->getAutoDutyCode(); - } - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $data['Disclaimer'] = $object->getDisclaimer(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('disclaimer') && null !== $data->getDisclaimer()) { + $dataArray['Disclaimer'] = $data->getDisclaimer(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentTimeInTransit::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentTotalChargesNormalizer.php b/src/Api/Normalizer/RatedShipmentTotalChargesNormalizer.php index 8930eaa6..4457f32f 100644 --- a/src/Api/Normalizer/RatedShipmentTotalChargesNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentTotalChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentTotalChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentTotalChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class => false]; - } - } -} else { - class RatedShipmentTotalChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentTotalCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentTotalCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentTotalChargesWithTaxesNormalizer.php b/src/Api/Normalizer/RatedShipmentTotalChargesWithTaxesNormalizer.php index bee89897..eccd1a9c 100644 --- a/src/Api/Normalizer/RatedShipmentTotalChargesWithTaxesNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentTotalChargesWithTaxesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentTotalChargesWithTaxesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentTotalChargesWithTaxesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class => false]; - } - } -} else { - class RatedShipmentTotalChargesWithTaxesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentTotalChargesWithTaxes::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RatedShipmentTransportationChargesNormalizer.php b/src/Api/Normalizer/RatedShipmentTransportationChargesNormalizer.php index b977ae2d..74bb2fa3 100644 --- a/src/Api/Normalizer/RatedShipmentTransportationChargesNormalizer.php +++ b/src/Api/Normalizer/RatedShipmentTransportationChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentTransportationChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RatedShipmentTransportationChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class; + return $type === \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class => false]; - } - } -} else { - class RatedShipmentTransportationChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RatedShipmentTransportationCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ReceiptImageImageFormatNormalizer.php b/src/Api/Normalizer/ReceiptImageImageFormatNormalizer.php index 3590f77c..234e40b0 100644 --- a/src/Api/Normalizer/ReceiptImageImageFormatNormalizer.php +++ b/src/Api/Normalizer/ReceiptImageImageFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ReceiptImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ReceiptImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ReceiptImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ReceiptImageImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ReceiptImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ReceiptImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ReceiptImageNormalizer.php b/src/Api/Normalizer/ReceiptImageNormalizer.php index 3f2acddf..6a2a8038 100644 --- a/src/Api/Normalizer/ReceiptImageNormalizer.php +++ b/src/Api/Normalizer/ReceiptImageNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ReceiptImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ReceiptImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ReceiptImage::class; + return $type === \ShipStream\Ups\Api\Model\ReceiptImage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReceiptImage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReceiptImage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ReceiptImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ReceiptImage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ReceiptImage::class => false]; - } - } -} else { - class ReceiptImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ReceiptImage::class; + if (\array_key_exists('ImageFormat', $data)) { + $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class, 'json', $context)); + unset($data['ImageFormat']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReceiptImage::class; + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ReceiptImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ReceiptImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ImageFormat'] = $this->normalizer->normalize($data->getImageFormat(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ReceiptImage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ReceiptImage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ReceiptSpecificationImageFormatNormalizer.php b/src/Api/Normalizer/ReceiptSpecificationImageFormatNormalizer.php index f9a2eaf8..c22b2362 100644 --- a/src/Api/Normalizer/ReceiptSpecificationImageFormatNormalizer.php +++ b/src/Api/Normalizer/ReceiptSpecificationImageFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ReceiptSpecificationImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ReceiptSpecificationImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ReceiptSpecificationImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ReferenceNumberNormalizer.php b/src/Api/Normalizer/ReferenceNumberNormalizer.php index 4ee02486..965a9a55 100644 --- a/src/Api/Normalizer/ReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/ReferenceNumberNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\ReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('number', $data)) { - $object->setNumber($data['number']); - unset($data['number']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['number'] = $object->getNumber(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('number', $data)) { + $object->setNumber($data['number']); + unset($data['number']); + } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ReferenceNumber::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ReferenceNumber::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReferenceNumber::class; + $dataArray = []; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['number'] = $data->getNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('number', $data)) { - $object->setNumber($data['number']); - unset($data['number']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('type') && null !== $data->getType()) { + $dataArray['type'] = $data->getType(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['number'] = $object->getNumber(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ReferenceValuesReferenceNumberNormalizer.php b/src/Api/Normalizer/ReferenceValuesReferenceNumberNormalizer.php index 4ca9df39..002d216f 100644 --- a/src/Api/Normalizer/ReferenceValuesReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/ReferenceValuesReferenceNumberNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ReferenceValuesReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ReferenceValuesReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ReferenceValuesReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ReferenceValuesReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ReferenceWeightNormalizer.php b/src/Api/Normalizer/ReferenceWeightNormalizer.php index 9508ace9..3809290c 100644 --- a/src/Api/Normalizer/ReferenceWeightNormalizer.php +++ b/src/Api/Normalizer/ReferenceWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ReferenceWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ReferenceWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ReferenceWeight::class; + return $type === \ShipStream\Ups\Api\Model\ReferenceWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReferenceWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReferenceWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ReferenceWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ReferenceWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ReferenceWeight::class => false]; - } - } -} else { - class ReferenceWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ReferenceWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ReferenceWeight::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ReferenceWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ReferenceWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ReferenceWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RefreshTokenSuccessResponseNormalizer.php b/src/Api/Normalizer/RefreshTokenSuccessResponseNormalizer.php index 09bf7bed..0527ce24 100644 --- a/src/Api/Normalizer/RefreshTokenSuccessResponseNormalizer.php +++ b/src/Api/Normalizer/RefreshTokenSuccessResponseNormalizer.php @@ -5,284 +5,141 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RefreshTokenSuccessResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RefreshTokenSuccessResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class; + return $type === \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('refresh_token_expires_in', $data)) { - $object->setRefreshTokenExpiresIn($data['refresh_token_expires_in']); - unset($data['refresh_token_expires_in']); - } - if (\array_key_exists('refresh_token_status', $data)) { - $object->setRefreshTokenStatus($data['refresh_token_status']); - unset($data['refresh_token_status']); - } - if (\array_key_exists('token_type', $data)) { - $object->setTokenType($data['token_type']); - unset($data['token_type']); - } - if (\array_key_exists('issued_at', $data)) { - $object->setIssuedAt($data['issued_at']); - unset($data['issued_at']); - } - if (\array_key_exists('client_id', $data)) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } - if (\array_key_exists('access_token', $data)) { - $object->setAccessToken($data['access_token']); - unset($data['access_token']); - } - if (\array_key_exists('refresh_token', $data)) { - $object->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - if (\array_key_exists('scope', $data)) { - $object->setScope($data['scope']); - unset($data['scope']); - } - if (\array_key_exists('refresh_token_issued_at', $data)) { - $object->setRefreshTokenIssuedAt($data['refresh_token_issued_at']); - unset($data['refresh_token_issued_at']); - } - if (\array_key_exists('expires_in', $data)) { - $object->setExpiresIn($data['expires_in']); - unset($data['expires_in']); - } - if (\array_key_exists('refresh_count', $data)) { - $object->setRefreshCount($data['refresh_count']); - unset($data['refresh_count']); - } - if (\array_key_exists('status', $data)) { - $object->setStatus($data['status']); - unset($data['status']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('refreshTokenExpiresIn') && null !== $object->getRefreshTokenExpiresIn()) { - $data['refresh_token_expires_in'] = $object->getRefreshTokenExpiresIn(); - } - if ($object->isInitialized('refreshTokenStatus') && null !== $object->getRefreshTokenStatus()) { - $data['refresh_token_status'] = $object->getRefreshTokenStatus(); - } - if ($object->isInitialized('tokenType') && null !== $object->getTokenType()) { - $data['token_type'] = $object->getTokenType(); - } - if ($object->isInitialized('issuedAt') && null !== $object->getIssuedAt()) { - $data['issued_at'] = $object->getIssuedAt(); - } - if ($object->isInitialized('clientId') && null !== $object->getClientId()) { - $data['client_id'] = $object->getClientId(); - } - if ($object->isInitialized('accessToken') && null !== $object->getAccessToken()) { - $data['access_token'] = $object->getAccessToken(); - } - if ($object->isInitialized('refreshToken') && null !== $object->getRefreshToken()) { - $data['refresh_token'] = $object->getRefreshToken(); - } - if ($object->isInitialized('scope') && null !== $object->getScope()) { - $data['scope'] = $object->getScope(); - } - if ($object->isInitialized('refreshTokenIssuedAt') && null !== $object->getRefreshTokenIssuedAt()) { - $data['refresh_token_issued_at'] = $object->getRefreshTokenIssuedAt(); - } - if ($object->isInitialized('expiresIn') && null !== $object->getExpiresIn()) { - $data['expires_in'] = $object->getExpiresIn(); - } - if ($object->isInitialized('refreshCount') && null !== $object->getRefreshCount()) { - $data['refresh_count'] = $object->getRefreshCount(); - } - if ($object->isInitialized('status') && null !== $object->getStatus()) { - $data['status'] = $object->getStatus(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('refresh_token_expires_in', $data)) { + $object->setRefreshTokenExpiresIn($data['refresh_token_expires_in']); + unset($data['refresh_token_expires_in']); + } + if (\array_key_exists('refresh_token_status', $data)) { + $object->setRefreshTokenStatus($data['refresh_token_status']); + unset($data['refresh_token_status']); + } + if (\array_key_exists('token_type', $data)) { + $object->setTokenType($data['token_type']); + unset($data['token_type']); + } + if (\array_key_exists('issued_at', $data)) { + $object->setIssuedAt($data['issued_at']); + unset($data['issued_at']); + } + if (\array_key_exists('client_id', $data)) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } + if (\array_key_exists('access_token', $data)) { + $object->setAccessToken($data['access_token']); + unset($data['access_token']); + } + if (\array_key_exists('refresh_token', $data)) { + $object->setRefreshToken($data['refresh_token']); + unset($data['refresh_token']); + } + if (\array_key_exists('scope', $data)) { + $object->setScope($data['scope']); + unset($data['scope']); + } + if (\array_key_exists('refresh_token_issued_at', $data)) { + $object->setRefreshTokenIssuedAt($data['refresh_token_issued_at']); + unset($data['refresh_token_issued_at']); + } + if (\array_key_exists('expires_in', $data)) { + $object->setExpiresIn($data['expires_in']); + unset($data['expires_in']); + } + if (\array_key_exists('refresh_count', $data)) { + $object->setRefreshCount($data['refresh_count']); + unset($data['refresh_count']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class => false]; + if (\array_key_exists('status', $data)) { + $object->setStatus($data['status']); + unset($data['status']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class RefreshTokenSuccessResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class; + $dataArray = []; + if ($data->isInitialized('refreshTokenExpiresIn') && null !== $data->getRefreshTokenExpiresIn()) { + $dataArray['refresh_token_expires_in'] = $data->getRefreshTokenExpiresIn(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class; + if ($data->isInitialized('refreshTokenStatus') && null !== $data->getRefreshTokenStatus()) { + $dataArray['refresh_token_status'] = $data->getRefreshTokenStatus(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('refresh_token_expires_in', $data)) { - $object->setRefreshTokenExpiresIn($data['refresh_token_expires_in']); - unset($data['refresh_token_expires_in']); - } - if (\array_key_exists('refresh_token_status', $data)) { - $object->setRefreshTokenStatus($data['refresh_token_status']); - unset($data['refresh_token_status']); - } - if (\array_key_exists('token_type', $data)) { - $object->setTokenType($data['token_type']); - unset($data['token_type']); - } - if (\array_key_exists('issued_at', $data)) { - $object->setIssuedAt($data['issued_at']); - unset($data['issued_at']); - } - if (\array_key_exists('client_id', $data)) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } - if (\array_key_exists('access_token', $data)) { - $object->setAccessToken($data['access_token']); - unset($data['access_token']); - } - if (\array_key_exists('refresh_token', $data)) { - $object->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - if (\array_key_exists('scope', $data)) { - $object->setScope($data['scope']); - unset($data['scope']); - } - if (\array_key_exists('refresh_token_issued_at', $data)) { - $object->setRefreshTokenIssuedAt($data['refresh_token_issued_at']); - unset($data['refresh_token_issued_at']); - } - if (\array_key_exists('expires_in', $data)) { - $object->setExpiresIn($data['expires_in']); - unset($data['expires_in']); - } - if (\array_key_exists('refresh_count', $data)) { - $object->setRefreshCount($data['refresh_count']); - unset($data['refresh_count']); - } - if (\array_key_exists('status', $data)) { - $object->setStatus($data['status']); - unset($data['status']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('tokenType') && null !== $data->getTokenType()) { + $dataArray['token_type'] = $data->getTokenType(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('refreshTokenExpiresIn') && null !== $object->getRefreshTokenExpiresIn()) { - $data['refresh_token_expires_in'] = $object->getRefreshTokenExpiresIn(); - } - if ($object->isInitialized('refreshTokenStatus') && null !== $object->getRefreshTokenStatus()) { - $data['refresh_token_status'] = $object->getRefreshTokenStatus(); - } - if ($object->isInitialized('tokenType') && null !== $object->getTokenType()) { - $data['token_type'] = $object->getTokenType(); - } - if ($object->isInitialized('issuedAt') && null !== $object->getIssuedAt()) { - $data['issued_at'] = $object->getIssuedAt(); - } - if ($object->isInitialized('clientId') && null !== $object->getClientId()) { - $data['client_id'] = $object->getClientId(); - } - if ($object->isInitialized('accessToken') && null !== $object->getAccessToken()) { - $data['access_token'] = $object->getAccessToken(); - } - if ($object->isInitialized('refreshToken') && null !== $object->getRefreshToken()) { - $data['refresh_token'] = $object->getRefreshToken(); - } - if ($object->isInitialized('scope') && null !== $object->getScope()) { - $data['scope'] = $object->getScope(); - } - if ($object->isInitialized('refreshTokenIssuedAt') && null !== $object->getRefreshTokenIssuedAt()) { - $data['refresh_token_issued_at'] = $object->getRefreshTokenIssuedAt(); - } - if ($object->isInitialized('expiresIn') && null !== $object->getExpiresIn()) { - $data['expires_in'] = $object->getExpiresIn(); - } - if ($object->isInitialized('refreshCount') && null !== $object->getRefreshCount()) { - $data['refresh_count'] = $object->getRefreshCount(); - } - if ($object->isInitialized('status') && null !== $object->getStatus()) { - $data['status'] = $object->getStatus(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('issuedAt') && null !== $data->getIssuedAt()) { + $dataArray['issued_at'] = $data->getIssuedAt(); + } + if ($data->isInitialized('clientId') && null !== $data->getClientId()) { + $dataArray['client_id'] = $data->getClientId(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class => false]; + if ($data->isInitialized('accessToken') && null !== $data->getAccessToken()) { + $dataArray['access_token'] = $data->getAccessToken(); } + if ($data->isInitialized('refreshToken') && null !== $data->getRefreshToken()) { + $dataArray['refresh_token'] = $data->getRefreshToken(); + } + if ($data->isInitialized('scope') && null !== $data->getScope()) { + $dataArray['scope'] = $data->getScope(); + } + if ($data->isInitialized('refreshTokenIssuedAt') && null !== $data->getRefreshTokenIssuedAt()) { + $dataArray['refresh_token_issued_at'] = $data->getRefreshTokenIssuedAt(); + } + if ($data->isInitialized('expiresIn') && null !== $data->getExpiresIn()) { + $dataArray['expires_in'] = $data->getExpiresIn(); + } + if ($data->isInitialized('refreshCount') && null !== $data->getRefreshCount()) { + $dataArray['refresh_count'] = $data->getRefreshCount(); + } + if ($data->isInitialized('status') && null !== $data->getStatus()) { + $dataArray['status'] = $data->getStatus(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RefreshTokenSuccessResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RemitToAddressNormalizer.php b/src/Api/Normalizer/RemitToAddressNormalizer.php index 2f0d289b..df815a53 100644 --- a/src/Api/Normalizer/RemitToAddressNormalizer.php +++ b/src/Api/Normalizer/RemitToAddressNormalizer.php @@ -5,204 +5,101 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RemitToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RemitToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RemitToAddress::class; + return $type === \ShipStream\Ups\Api\Model\RemitToAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RemitToAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RemitToAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RemitToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\RemitToAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RemitToAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('Town', $data)) { + $object->setTown($data['Town']); + unset($data['Town']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class RemitToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RemitToAddress::class; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RemitToAddress::class; + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RemitToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['Town'] = $data->getTown(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RemitToAddress::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RemitToAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RemitToPhoneNormalizer.php b/src/Api/Normalizer/RemitToPhoneNormalizer.php index 248165c2..60b96edb 100644 --- a/src/Api/Normalizer/RemitToPhoneNormalizer.php +++ b/src/Api/Normalizer/RemitToPhoneNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RemitToPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RemitToPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RemitToPhone::class; + return $type === \ShipStream\Ups\Api\Model\RemitToPhone::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RemitToPhone::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RemitToPhone::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RemitToPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RemitToPhone(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Extension', $data)) { + $object->setExtension($data['Extension']); + unset($data['Extension']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RemitToPhone::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RemitToPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RemitToPhone::class; + $dataArray = []; + $dataArray['Number'] = $data->getNumber(); + if ($data->isInitialized('extension') && null !== $data->getExtension()) { + $dataArray['Extension'] = $data->getExtension(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RemitToPhone::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RemitToPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RemitToPhone::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RemitToPhone::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RequestShipmentItemsNormalizer.php b/src/Api/Normalizer/RequestShipmentItemsNormalizer.php index 14bd3ea7..8f525b62 100644 --- a/src/Api/Normalizer/RequestShipmentItemsNormalizer.php +++ b/src/Api/Normalizer/RequestShipmentItemsNormalizer.php @@ -5,244 +5,121 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RequestShipmentItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RequestShipmentItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RequestShipmentItems::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RequestShipmentItems::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RequestShipmentItems(); - if (\array_key_exists('grossWeight', $data) && \is_int($data['grossWeight'])) { - $data['grossWeight'] = (double) $data['grossWeight']; - } - if (\array_key_exists('priceEach', $data) && \is_int($data['priceEach'])) { - $data['priceEach'] = (double) $data['priceEach']; - } - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('commodityId', $data)) { - $object->setCommodityId($data['commodityId']); - unset($data['commodityId']); - } - if (\array_key_exists('grossWeight', $data)) { - $object->setGrossWeight($data['grossWeight']); - unset($data['grossWeight']); - } - if (\array_key_exists('grossWeightUnit', $data)) { - $object->setGrossWeightUnit($data['grossWeightUnit']); - unset($data['grossWeightUnit']); - } - if (\array_key_exists('priceEach', $data)) { - $object->setPriceEach($data['priceEach']); - unset($data['priceEach']); - } - if (\array_key_exists('commodityCurrencyCode', $data)) { - $object->setCommodityCurrencyCode($data['commodityCurrencyCode']); - unset($data['commodityCurrencyCode']); - } - if (\array_key_exists('quantity', $data)) { - $object->setQuantity($data['quantity']); - unset($data['quantity']); - } - if (\array_key_exists('UOM', $data)) { - $object->setUOM($data['UOM']); - unset($data['UOM']); - } - if (\array_key_exists('hsCode', $data)) { - $object->setHsCode($data['hsCode']); - unset($data['hsCode']); - } - if (\array_key_exists('description', $data)) { - $object->setDescription($data['description']); - unset($data['description']); - } - if (\array_key_exists('originCountryCode', $data)) { - $object->setOriginCountryCode($data['originCountryCode']); - unset($data['originCountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\RequestShipmentItems::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RequestShipmentItems::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\RequestShipmentItems(); + if (\array_key_exists('grossWeight', $data) && \is_int($data['grossWeight'])) { + $data['grossWeight'] = (double) $data['grossWeight']; + } + if (\array_key_exists('priceEach', $data) && \is_int($data['priceEach'])) { + $data['priceEach'] = (double) $data['priceEach']; + } + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['commodityId'] = $object->getCommodityId(); - if ($object->isInitialized('grossWeight') && null !== $object->getGrossWeight()) { - $data['grossWeight'] = $object->getGrossWeight(); - } - if ($object->isInitialized('grossWeightUnit') && null !== $object->getGrossWeightUnit()) { - $data['grossWeightUnit'] = $object->getGrossWeightUnit(); - } - $data['priceEach'] = $object->getPriceEach(); - $data['commodityCurrencyCode'] = $object->getCommodityCurrencyCode(); - $data['quantity'] = $object->getQuantity(); - $data['UOM'] = $object->getUOM(); - if ($object->isInitialized('hsCode') && null !== $object->getHsCode()) { - $data['hsCode'] = $object->getHsCode(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - $data['originCountryCode'] = $object->getOriginCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('commodityId', $data)) { + $object->setCommodityId($data['commodityId']); + unset($data['commodityId']); + } + if (\array_key_exists('grossWeight', $data)) { + $object->setGrossWeight($data['grossWeight']); + unset($data['grossWeight']); + } + if (\array_key_exists('grossWeightUnit', $data)) { + $object->setGrossWeightUnit($data['grossWeightUnit']); + unset($data['grossWeightUnit']); + } + if (\array_key_exists('priceEach', $data)) { + $object->setPriceEach($data['priceEach']); + unset($data['priceEach']); + } + if (\array_key_exists('commodityCurrencyCode', $data)) { + $object->setCommodityCurrencyCode($data['commodityCurrencyCode']); + unset($data['commodityCurrencyCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RequestShipmentItems::class => false]; + if (\array_key_exists('quantity', $data)) { + $object->setQuantity($data['quantity']); + unset($data['quantity']); } + if (\array_key_exists('UOM', $data)) { + $object->setUOM($data['UOM']); + unset($data['UOM']); + } + if (\array_key_exists('hsCode', $data)) { + $object->setHsCode($data['hsCode']); + unset($data['hsCode']); + } + if (\array_key_exists('description', $data)) { + $object->setDescription($data['description']); + unset($data['description']); + } + if (\array_key_exists('originCountryCode', $data)) { + $object->setOriginCountryCode($data['originCountryCode']); + unset($data['originCountryCode']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class RequestShipmentItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RequestShipmentItems::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RequestShipmentItems::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RequestShipmentItems(); - if (\array_key_exists('grossWeight', $data) && \is_int($data['grossWeight'])) { - $data['grossWeight'] = (double) $data['grossWeight']; - } - if (\array_key_exists('priceEach', $data) && \is_int($data['priceEach'])) { - $data['priceEach'] = (double) $data['priceEach']; - } - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('commodityId', $data)) { - $object->setCommodityId($data['commodityId']); - unset($data['commodityId']); - } - if (\array_key_exists('grossWeight', $data)) { - $object->setGrossWeight($data['grossWeight']); - unset($data['grossWeight']); - } - if (\array_key_exists('grossWeightUnit', $data)) { - $object->setGrossWeightUnit($data['grossWeightUnit']); - unset($data['grossWeightUnit']); - } - if (\array_key_exists('priceEach', $data)) { - $object->setPriceEach($data['priceEach']); - unset($data['priceEach']); - } - if (\array_key_exists('commodityCurrencyCode', $data)) { - $object->setCommodityCurrencyCode($data['commodityCurrencyCode']); - unset($data['commodityCurrencyCode']); - } - if (\array_key_exists('quantity', $data)) { - $object->setQuantity($data['quantity']); - unset($data['quantity']); - } - if (\array_key_exists('UOM', $data)) { - $object->setUOM($data['UOM']); - unset($data['UOM']); - } - if (\array_key_exists('hsCode', $data)) { - $object->setHsCode($data['hsCode']); - unset($data['hsCode']); - } - if (\array_key_exists('description', $data)) { - $object->setDescription($data['description']); - unset($data['description']); - } - if (\array_key_exists('originCountryCode', $data)) { - $object->setOriginCountryCode($data['originCountryCode']); - unset($data['originCountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['commodityId'] = $data->getCommodityId(); + if ($data->isInitialized('grossWeight') && null !== $data->getGrossWeight()) { + $dataArray['grossWeight'] = $data->getGrossWeight(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['commodityId'] = $object->getCommodityId(); - if ($object->isInitialized('grossWeight') && null !== $object->getGrossWeight()) { - $data['grossWeight'] = $object->getGrossWeight(); - } - if ($object->isInitialized('grossWeightUnit') && null !== $object->getGrossWeightUnit()) { - $data['grossWeightUnit'] = $object->getGrossWeightUnit(); - } - $data['priceEach'] = $object->getPriceEach(); - $data['commodityCurrencyCode'] = $object->getCommodityCurrencyCode(); - $data['quantity'] = $object->getQuantity(); - $data['UOM'] = $object->getUOM(); - if ($object->isInitialized('hsCode') && null !== $object->getHsCode()) { - $data['hsCode'] = $object->getHsCode(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - $data['originCountryCode'] = $object->getOriginCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('grossWeightUnit') && null !== $data->getGrossWeightUnit()) { + $dataArray['grossWeightUnit'] = $data->getGrossWeightUnit(); + } + $dataArray['priceEach'] = $data->getPriceEach(); + $dataArray['commodityCurrencyCode'] = $data->getCommodityCurrencyCode(); + $dataArray['quantity'] = $data->getQuantity(); + $dataArray['UOM'] = $data->getUOM(); + if ($data->isInitialized('hsCode') && null !== $data->getHsCode()) { + $dataArray['hsCode'] = $data->getHsCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RequestShipmentItems::class => false]; + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['description'] = $data->getDescription(); } + $dataArray['originCountryCode'] = $data->getOriginCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RequestShipmentItems::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RequestTransactionReferenceNormalizer.php b/src/Api/Normalizer/RequestTransactionReferenceNormalizer.php index 97ab5fef..7493b951 100644 --- a/src/Api/Normalizer/RequestTransactionReferenceNormalizer.php +++ b/src/Api/Normalizer/RequestTransactionReferenceNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RequestTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RequestTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RequestTransactionReference::class; + return $type === \ShipStream\Ups\Api\Model\RequestTransactionReference::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RequestTransactionReference::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RequestTransactionReference::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RequestTransactionReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CustomerContext', $data)) { - $object->setCustomerContext($data['CustomerContext']); - unset($data['CustomerContext']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RequestTransactionReference(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('customerContext') && null !== $object->getCustomerContext()) { - $data['CustomerContext'] = $object->getCustomerContext(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CustomerContext', $data)) { + $object->setCustomerContext($data['CustomerContext']); + unset($data['CustomerContext']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RequestTransactionReference::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RequestTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RequestTransactionReference::class; + $dataArray = []; + if ($data->isInitialized('customerContext') && null !== $data->getCustomerContext()) { + $dataArray['CustomerContext'] = $data->getCustomerContext(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RequestTransactionReference::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RequestTransactionReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CustomerContext', $data)) { - $object->setCustomerContext($data['CustomerContext']); - unset($data['CustomerContext']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('customerContext') && null !== $object->getCustomerContext()) { - $data['CustomerContext'] = $object->getCustomerContext(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RequestTransactionReference::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RequestTransactionReference::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/RequesterPhoneNormalizer.php b/src/Api/Normalizer/RequesterPhoneNormalizer.php index 98016417..9b45ccd4 100644 --- a/src/Api/Normalizer/RequesterPhoneNormalizer.php +++ b/src/Api/Normalizer/RequesterPhoneNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RequesterPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class RequesterPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RequesterPhone::class; + return $type === \ShipStream\Ups\Api\Model\RequesterPhone::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RequesterPhone::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RequesterPhone::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RequesterPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\RequesterPhone(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Extension', $data)) { + $object->setExtension($data['Extension']); + unset($data['Extension']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RequesterPhone::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class RequesterPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\RequesterPhone::class; + $dataArray = []; + $dataArray['Number'] = $data->getNumber(); + if ($data->isInitialized('extension') && null !== $data->getExtension()) { + $dataArray['Extension'] = $data->getExtension(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\RequesterPhone::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\RequesterPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\RequesterPhone::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\RequesterPhone::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ResponseAlertDetailNormalizer.php b/src/Api/Normalizer/ResponseAlertDetailNormalizer.php index c3471e3b..8de1fbb2 100644 --- a/src/Api/Normalizer/ResponseAlertDetailNormalizer.php +++ b/src/Api/Normalizer/ResponseAlertDetailNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ResponseAlertDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ResponseAlertDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ResponseAlertDetail::class; + return $type === \ShipStream\Ups\Api\Model\ResponseAlertDetail::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseAlertDetail::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseAlertDetail::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ResponseAlertDetail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('ElementLevelInformation', $data)) { - $object->setElementLevelInformation($this->denormalizer->denormalize($data['ElementLevelInformation'], \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class, 'json', $context)); - unset($data['ElementLevelInformation']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ResponseAlertDetail(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - if ($object->isInitialized('elementLevelInformation') && null !== $object->getElementLevelInformation()) { - $data['ElementLevelInformation'] = $this->normalizer->normalize($object->getElementLevelInformation(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ResponseAlertDetail::class => false]; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - } -} else { - class ResponseAlertDetailNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ResponseAlertDetail::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseAlertDetail::class; + if (\array_key_exists('ElementLevelInformation', $data)) { + $object->setElementLevelInformation($this->denormalizer->denormalize($data['ElementLevelInformation'], \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class, 'json', $context)); + unset($data['ElementLevelInformation']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ResponseAlertDetail(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('ElementLevelInformation', $data)) { - $object->setElementLevelInformation($this->denormalizer->denormalize($data['ElementLevelInformation'], \ShipStream\Ups\Api\Model\AlertDetailElementLevelInformation::class, 'json', $context)); - unset($data['ElementLevelInformation']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - if ($object->isInitialized('elementLevelInformation') && null !== $object->getElementLevelInformation()) { - $data['ElementLevelInformation'] = $this->normalizer->normalize($object->getElementLevelInformation(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + if ($data->isInitialized('elementLevelInformation') && null !== $data->getElementLevelInformation()) { + $dataArray['ElementLevelInformation'] = $this->normalizer->normalize($data->getElementLevelInformation(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ResponseAlertDetail::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ResponseAlertDetail::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ResponseAlertNormalizer.php b/src/Api/Normalizer/ResponseAlertNormalizer.php index 540c5614..e737f326 100644 --- a/src/Api/Normalizer/ResponseAlertNormalizer.php +++ b/src/Api/Normalizer/ResponseAlertNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ResponseAlertNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ResponseAlertNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ResponseAlert::class; + return $type === \ShipStream\Ups\Api\Model\ResponseAlert::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseAlert::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseAlert::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ResponseAlert(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ResponseAlert(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ResponseAlert::class => false]; - } - } -} else { - class ResponseAlertNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ResponseAlert::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseAlert::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ResponseAlert(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ResponseAlert::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ResponseAlert::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ResponseErrorNormalizer.php b/src/Api/Normalizer/ResponseErrorNormalizer.php index de4ca431..5f999e0d 100644 --- a/src/Api/Normalizer/ResponseErrorNormalizer.php +++ b/src/Api/Normalizer/ResponseErrorNormalizer.php @@ -5,228 +5,113 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ResponseErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ResponseErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ResponseError::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseError::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ResponseError(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ErrorSeverity', $data)) { - $object->setErrorSeverity($data['ErrorSeverity']); - unset($data['ErrorSeverity']); - } - if (\array_key_exists('ErrorCode', $data)) { - $object->setErrorCode($data['ErrorCode']); - unset($data['ErrorCode']); - } - if (\array_key_exists('ErrorDescription', $data)) { - $object->setErrorDescription($data['ErrorDescription']); - unset($data['ErrorDescription']); - } - if (\array_key_exists('MinimumRetrySeconds', $data)) { - $object->setMinimumRetrySeconds($data['MinimumRetrySeconds']); - unset($data['MinimumRetrySeconds']); - } - if (\array_key_exists('ErrorLocation', $data)) { - $values = []; - foreach ($data['ErrorLocation'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ErrorErrorLocation::class, 'json', $context); - } - $object->setErrorLocation($values); - unset($data['ErrorLocation']); - } - if (\array_key_exists('ErrorDigest', $data)) { - $values_1 = []; - foreach ($data['ErrorDigest'] as $value_1) { - $values_1[] = $value_1; - } - $object->setErrorDigest($values_1); - unset($data['ErrorDigest']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + return $type === \ShipStream\Ups\Api\Model\ResponseError::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseError::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ResponseError(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('errorSeverity') && null !== $object->getErrorSeverity()) { - $data['ErrorSeverity'] = $object->getErrorSeverity(); - } - if ($object->isInitialized('errorCode') && null !== $object->getErrorCode()) { - $data['ErrorCode'] = $object->getErrorCode(); - } - if ($object->isInitialized('errorDescription') && null !== $object->getErrorDescription()) { - $data['ErrorDescription'] = $object->getErrorDescription(); - } - if ($object->isInitialized('minimumRetrySeconds') && null !== $object->getMinimumRetrySeconds()) { - $data['MinimumRetrySeconds'] = $object->getMinimumRetrySeconds(); - } + if (\array_key_exists('ErrorSeverity', $data)) { + $object->setErrorSeverity($data['ErrorSeverity']); + unset($data['ErrorSeverity']); + } + if (\array_key_exists('ErrorCode', $data)) { + $object->setErrorCode($data['ErrorCode']); + unset($data['ErrorCode']); + } + if (\array_key_exists('ErrorDescription', $data)) { + $object->setErrorDescription($data['ErrorDescription']); + unset($data['ErrorDescription']); + } + if (\array_key_exists('MinimumRetrySeconds', $data)) { + $object->setMinimumRetrySeconds($data['MinimumRetrySeconds']); + unset($data['MinimumRetrySeconds']); + } + if (\array_key_exists('ErrorLocation', $data)) { $values = []; - foreach ($object->getErrorLocation() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ErrorLocation'] = $values; - if ($object->isInitialized('errorDigest') && null !== $object->getErrorDigest()) { - $values_1 = []; - foreach ($object->getErrorDigest() as $value_1) { - $values_1[] = $value_1; - } - $data['ErrorDigest'] = $values_1; + foreach ($data['ErrorLocation'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ErrorErrorLocation::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setErrorLocation($values); + unset($data['ErrorLocation']); + } + if (\array_key_exists('ErrorDigest', $data)) { + $values_1 = []; + foreach ($data['ErrorDigest'] as $value_1) { + $values_1[] = $value_1; } - return $data; + $object->setErrorDigest($values_1); + unset($data['ErrorDigest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ResponseError::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } } + return $object; } -} else { - class ResponseErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ResponseError::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseError::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ResponseError(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ErrorSeverity', $data)) { - $object->setErrorSeverity($data['ErrorSeverity']); - unset($data['ErrorSeverity']); - } - if (\array_key_exists('ErrorCode', $data)) { - $object->setErrorCode($data['ErrorCode']); - unset($data['ErrorCode']); - } - if (\array_key_exists('ErrorDescription', $data)) { - $object->setErrorDescription($data['ErrorDescription']); - unset($data['ErrorDescription']); - } - if (\array_key_exists('MinimumRetrySeconds', $data)) { - $object->setMinimumRetrySeconds($data['MinimumRetrySeconds']); - unset($data['MinimumRetrySeconds']); - } - if (\array_key_exists('ErrorLocation', $data)) { - $values = []; - foreach ($data['ErrorLocation'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ErrorErrorLocation::class, 'json', $context); - } - $object->setErrorLocation($values); - unset($data['ErrorLocation']); - } - if (\array_key_exists('ErrorDigest', $data)) { - $values_1 = []; - foreach ($data['ErrorDigest'] as $value_1) { - $values_1[] = $value_1; - } - $object->setErrorDigest($values_1); - unset($data['ErrorDigest']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('errorSeverity') && null !== $data->getErrorSeverity()) { + $dataArray['ErrorSeverity'] = $data->getErrorSeverity(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('errorSeverity') && null !== $object->getErrorSeverity()) { - $data['ErrorSeverity'] = $object->getErrorSeverity(); - } - if ($object->isInitialized('errorCode') && null !== $object->getErrorCode()) { - $data['ErrorCode'] = $object->getErrorCode(); - } - if ($object->isInitialized('errorDescription') && null !== $object->getErrorDescription()) { - $data['ErrorDescription'] = $object->getErrorDescription(); - } - if ($object->isInitialized('minimumRetrySeconds') && null !== $object->getMinimumRetrySeconds()) { - $data['MinimumRetrySeconds'] = $object->getMinimumRetrySeconds(); - } - $values = []; - foreach ($object->getErrorLocation() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ErrorLocation'] = $values; - if ($object->isInitialized('errorDigest') && null !== $object->getErrorDigest()) { - $values_1 = []; - foreach ($object->getErrorDigest() as $value_1) { - $values_1[] = $value_1; - } - $data['ErrorDigest'] = $values_1; - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + if ($data->isInitialized('errorCode') && null !== $data->getErrorCode()) { + $dataArray['ErrorCode'] = $data->getErrorCode(); + } + if ($data->isInitialized('errorDescription') && null !== $data->getErrorDescription()) { + $dataArray['ErrorDescription'] = $data->getErrorDescription(); + } + if ($data->isInitialized('minimumRetrySeconds') && null !== $data->getMinimumRetrySeconds()) { + $dataArray['MinimumRetrySeconds'] = $data->getMinimumRetrySeconds(); + } + $values = []; + foreach ($data->getErrorLocation() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['ErrorLocation'] = $values; + if ($data->isInitialized('errorDigest') && null !== $data->getErrorDigest()) { + $values_1 = []; + foreach ($data->getErrorDigest() as $value_1) { + $values_1[] = $value_1; } - return $data; + $dataArray['ErrorDigest'] = $values_1; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ResponseError::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ResponseError::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ResponseResponseStatusNormalizer.php b/src/Api/Normalizer/ResponseResponseStatusNormalizer.php index 176b6db2..2b35bfa8 100644 --- a/src/Api/Normalizer/ResponseResponseStatusNormalizer.php +++ b/src/Api/Normalizer/ResponseResponseStatusNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ResponseResponseStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ResponseResponseStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ResponseResponseStatus::class; + return $type === \ShipStream\Ups\Api\Model\ResponseResponseStatus::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseResponseStatus::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseResponseStatus::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ResponseResponseStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ResponseResponseStatus(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ResponseResponseStatus::class => false]; - } - } -} else { - class ResponseResponseStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ResponseResponseStatus::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseResponseStatus::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ResponseResponseStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ResponseResponseStatus::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ResponseResponseStatus::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ResponseShipmentItemsNormalizer.php b/src/Api/Normalizer/ResponseShipmentItemsNormalizer.php index 1aa43108..c1b0b2f3 100644 --- a/src/Api/Normalizer/ResponseShipmentItemsNormalizer.php +++ b/src/Api/Normalizer/ResponseShipmentItemsNormalizer.php @@ -5,224 +5,114 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ResponseShipmentItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ResponseShipmentItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ResponseShipmentItems::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseShipmentItems::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ResponseShipmentItems(); - if (\array_key_exists('commodityDuty', $data) && \is_int($data['commodityDuty'])) { - $data['commodityDuty'] = (double) $data['commodityDuty']; - } - if (\array_key_exists('totalCommodityTaxAndFee', $data) && \is_int($data['totalCommodityTaxAndFee'])) { - $data['totalCommodityTaxAndFee'] = (double) $data['totalCommodityTaxAndFee']; - } - if (\array_key_exists('commodityVAT', $data) && \is_int($data['commodityVAT'])) { - $data['commodityVAT'] = (double) $data['commodityVAT']; - } - if (\array_key_exists('totalCommodityDutyAndTax', $data) && \is_int($data['totalCommodityDutyAndTax'])) { - $data['totalCommodityDutyAndTax'] = (double) $data['totalCommodityDutyAndTax']; - } - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('commodityID', $data)) { - $object->setCommodityID($data['commodityID']); - unset($data['commodityID']); - } - if (\array_key_exists('hsCode', $data)) { - $object->setHsCode($data['hsCode']); - unset($data['hsCode']); - } - if (\array_key_exists('commodityDuty', $data)) { - $object->setCommodityDuty($data['commodityDuty']); - unset($data['commodityDuty']); - } - if (\array_key_exists('totalCommodityTaxAndFee', $data)) { - $object->setTotalCommodityTaxAndFee($data['totalCommodityTaxAndFee']); - unset($data['totalCommodityTaxAndFee']); - } - if (\array_key_exists('commodityVAT', $data)) { - $object->setCommodityVAT($data['commodityVAT']); - unset($data['commodityVAT']); - } - if (\array_key_exists('totalCommodityDutyAndTax', $data)) { - $object->setTotalCommodityDutyAndTax($data['totalCommodityDutyAndTax']); - unset($data['totalCommodityDutyAndTax']); - } - if (\array_key_exists('commodityCurrencyCode', $data)) { - $object->setCommodityCurrencyCode($data['commodityCurrencyCode']); - unset($data['commodityCurrencyCode']); - } - if (\array_key_exists('isCalculable', $data)) { - $object->setIsCalculable($data['isCalculable']); - unset($data['isCalculable']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ResponseShipmentItems::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseShipmentItems::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ResponseShipmentItems(); + if (\array_key_exists('commodityDuty', $data) && \is_int($data['commodityDuty'])) { + $data['commodityDuty'] = (double) $data['commodityDuty']; + } + if (\array_key_exists('totalCommodityTaxAndFee', $data) && \is_int($data['totalCommodityTaxAndFee'])) { + $data['totalCommodityTaxAndFee'] = (double) $data['totalCommodityTaxAndFee']; + } + if (\array_key_exists('commodityVAT', $data) && \is_int($data['commodityVAT'])) { + $data['commodityVAT'] = (double) $data['commodityVAT']; + } + if (\array_key_exists('totalCommodityDutyAndTax', $data) && \is_int($data['totalCommodityDutyAndTax'])) { + $data['totalCommodityDutyAndTax'] = (double) $data['totalCommodityDutyAndTax']; + } + if (\array_key_exists('isCalculable', $data) && \is_int($data['isCalculable'])) { + $data['isCalculable'] = (bool) $data['isCalculable']; + } + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['commodityID'] = $object->getCommodityID(); - $data['hsCode'] = $object->getHsCode(); - $data['commodityDuty'] = $object->getCommodityDuty(); - if ($object->isInitialized('totalCommodityTaxAndFee') && null !== $object->getTotalCommodityTaxAndFee()) { - $data['totalCommodityTaxAndFee'] = $object->getTotalCommodityTaxAndFee(); - } - $data['commodityVAT'] = $object->getCommodityVAT(); - $data['totalCommodityDutyAndTax'] = $object->getTotalCommodityDutyAndTax(); - $data['commodityCurrencyCode'] = $object->getCommodityCurrencyCode(); - $data['isCalculable'] = $object->getIsCalculable(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('commodityID', $data)) { + $object->setCommodityID($data['commodityID']); + unset($data['commodityID']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ResponseShipmentItems::class => false]; + if (\array_key_exists('hsCode', $data)) { + $object->setHsCode($data['hsCode']); + unset($data['hsCode']); } + if (\array_key_exists('commodityDuty', $data)) { + $object->setCommodityDuty($data['commodityDuty']); + unset($data['commodityDuty']); + } + if (\array_key_exists('totalCommodityTaxAndFee', $data)) { + $object->setTotalCommodityTaxAndFee($data['totalCommodityTaxAndFee']); + unset($data['totalCommodityTaxAndFee']); + } + if (\array_key_exists('commodityVAT', $data)) { + $object->setCommodityVAT($data['commodityVAT']); + unset($data['commodityVAT']); + } + if (\array_key_exists('totalCommodityDutyAndTax', $data)) { + $object->setTotalCommodityDutyAndTax($data['totalCommodityDutyAndTax']); + unset($data['totalCommodityDutyAndTax']); + } + if (\array_key_exists('commodityCurrencyCode', $data)) { + $object->setCommodityCurrencyCode($data['commodityCurrencyCode']); + unset($data['commodityCurrencyCode']); + } + if (\array_key_exists('isCalculable', $data)) { + $object->setIsCalculable($data['isCalculable']); + unset($data['isCalculable']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ResponseShipmentItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ResponseShipmentItems::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseShipmentItems::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ResponseShipmentItems(); - if (\array_key_exists('commodityDuty', $data) && \is_int($data['commodityDuty'])) { - $data['commodityDuty'] = (double) $data['commodityDuty']; - } - if (\array_key_exists('totalCommodityTaxAndFee', $data) && \is_int($data['totalCommodityTaxAndFee'])) { - $data['totalCommodityTaxAndFee'] = (double) $data['totalCommodityTaxAndFee']; - } - if (\array_key_exists('commodityVAT', $data) && \is_int($data['commodityVAT'])) { - $data['commodityVAT'] = (double) $data['commodityVAT']; - } - if (\array_key_exists('totalCommodityDutyAndTax', $data) && \is_int($data['totalCommodityDutyAndTax'])) { - $data['totalCommodityDutyAndTax'] = (double) $data['totalCommodityDutyAndTax']; - } - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('commodityID', $data)) { - $object->setCommodityID($data['commodityID']); - unset($data['commodityID']); - } - if (\array_key_exists('hsCode', $data)) { - $object->setHsCode($data['hsCode']); - unset($data['hsCode']); - } - if (\array_key_exists('commodityDuty', $data)) { - $object->setCommodityDuty($data['commodityDuty']); - unset($data['commodityDuty']); - } - if (\array_key_exists('totalCommodityTaxAndFee', $data)) { - $object->setTotalCommodityTaxAndFee($data['totalCommodityTaxAndFee']); - unset($data['totalCommodityTaxAndFee']); - } - if (\array_key_exists('commodityVAT', $data)) { - $object->setCommodityVAT($data['commodityVAT']); - unset($data['commodityVAT']); - } - if (\array_key_exists('totalCommodityDutyAndTax', $data)) { - $object->setTotalCommodityDutyAndTax($data['totalCommodityDutyAndTax']); - unset($data['totalCommodityDutyAndTax']); - } - if (\array_key_exists('commodityCurrencyCode', $data)) { - $object->setCommodityCurrencyCode($data['commodityCurrencyCode']); - unset($data['commodityCurrencyCode']); - } - if (\array_key_exists('isCalculable', $data)) { - $object->setIsCalculable($data['isCalculable']); - unset($data['isCalculable']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['commodityID'] = $data->getCommodityID(); + $dataArray['hsCode'] = $data->getHsCode(); + $dataArray['commodityDuty'] = $data->getCommodityDuty(); + if ($data->isInitialized('totalCommodityTaxAndFee') && null !== $data->getTotalCommodityTaxAndFee()) { + $dataArray['totalCommodityTaxAndFee'] = $data->getTotalCommodityTaxAndFee(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['commodityID'] = $object->getCommodityID(); - $data['hsCode'] = $object->getHsCode(); - $data['commodityDuty'] = $object->getCommodityDuty(); - if ($object->isInitialized('totalCommodityTaxAndFee') && null !== $object->getTotalCommodityTaxAndFee()) { - $data['totalCommodityTaxAndFee'] = $object->getTotalCommodityTaxAndFee(); - } - $data['commodityVAT'] = $object->getCommodityVAT(); - $data['totalCommodityDutyAndTax'] = $object->getTotalCommodityDutyAndTax(); - $data['commodityCurrencyCode'] = $object->getCommodityCurrencyCode(); - $data['isCalculable'] = $object->getIsCalculable(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + $dataArray['commodityVAT'] = $data->getCommodityVAT(); + $dataArray['totalCommodityDutyAndTax'] = $data->getTotalCommodityDutyAndTax(); + $dataArray['commodityCurrencyCode'] = $data->getCommodityCurrencyCode(); + $dataArray['isCalculable'] = $data->getIsCalculable(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ResponseShipmentItems::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ResponseShipmentItems::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ResponseTransactionReferenceNormalizer.php b/src/Api/Normalizer/ResponseTransactionReferenceNormalizer.php index a4a2e72c..6d62030b 100644 --- a/src/Api/Normalizer/ResponseTransactionReferenceNormalizer.php +++ b/src/Api/Normalizer/ResponseTransactionReferenceNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ResponseTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ResponseTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ResponseTransactionReference::class; + return $type === \ShipStream\Ups\Api\Model\ResponseTransactionReference::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseTransactionReference::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseTransactionReference::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ResponseTransactionReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CustomerContext', $data)) { - $object->setCustomerContext($data['CustomerContext']); - unset($data['CustomerContext']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ResponseTransactionReference(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('customerContext') && null !== $object->getCustomerContext()) { - $data['CustomerContext'] = $object->getCustomerContext(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CustomerContext', $data)) { + $object->setCustomerContext($data['CustomerContext']); + unset($data['CustomerContext']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ResponseTransactionReference::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ResponseTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ResponseTransactionReference::class; + $dataArray = []; + if ($data->isInitialized('customerContext') && null !== $data->getCustomerContext()) { + $dataArray['CustomerContext'] = $data->getCustomerContext(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ResponseTransactionReference::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ResponseTransactionReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CustomerContext', $data)) { - $object->setCustomerContext($data['CustomerContext']); - unset($data['CustomerContext']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('customerContext') && null !== $object->getCustomerContext()) { - $data['CustomerContext'] = $object->getCustomerContext(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ResponseTransactionReference::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ResponseTransactionReference::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SHIPRequestWrapperNormalizer.php b/src/Api/Normalizer/SHIPRequestWrapperNormalizer.php index 7f434c02..13dcc405 100644 --- a/src/Api/Normalizer/SHIPRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/SHIPRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SHIPRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SHIPRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SHIPRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\SHIPRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SHIPRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SHIPRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SHIPRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentRequest', $data)) { - $object->setShipmentRequest($this->denormalizer->denormalize($data['ShipmentRequest'], \ShipStream\Ups\Api\Model\ShipmentRequest::class, 'json', $context)); - unset($data['ShipmentRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SHIPRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ShipmentRequest'] = $this->normalizer->normalize($object->getShipmentRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ShipmentRequest', $data)) { + $object->setShipmentRequest($this->denormalizer->denormalize($data['ShipmentRequest'], \ShipStream\Ups\Api\Model\ShipmentRequest::class, 'json', $context)); + unset($data['ShipmentRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SHIPRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class SHIPRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SHIPRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SHIPRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SHIPRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['ShipmentRequest'] = $this->normalizer->normalize($data->getShipmentRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('ShipmentRequest', $data)) { - $object->setShipmentRequest($this->denormalizer->denormalize($data['ShipmentRequest'], \ShipStream\Ups\Api\Model\ShipmentRequest::class, 'json', $context)); - unset($data['ShipmentRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ShipmentRequest'] = $this->normalizer->normalize($object->getShipmentRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SHIPRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SHIPRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SHIPResponseWrapperNormalizer.php b/src/Api/Normalizer/SHIPResponseWrapperNormalizer.php index 0e54ba34..75843920 100644 --- a/src/Api/Normalizer/SHIPResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/SHIPResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SHIPResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SHIPResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SHIPResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\SHIPResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SHIPResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SHIPResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SHIPResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentResponse', $data)) { - $object->setShipmentResponse($this->denormalizer->denormalize($data['ShipmentResponse'], \ShipStream\Ups\Api\Model\ShipmentResponse::class, 'json', $context)); - unset($data['ShipmentResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SHIPResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ShipmentResponse'] = $this->normalizer->normalize($object->getShipmentResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ShipmentResponse', $data)) { + $object->setShipmentResponse($this->denormalizer->denormalize($data['ShipmentResponse'], \ShipStream\Ups\Api\Model\ShipmentResponse::class, 'json', $context)); + unset($data['ShipmentResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SHIPResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class SHIPResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SHIPResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SHIPResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SHIPResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['ShipmentResponse'] = $this->normalizer->normalize($data->getShipmentResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('ShipmentResponse', $data)) { - $object->setShipmentResponse($this->denormalizer->denormalize($data['ShipmentResponse'], \ShipStream\Ups\Api\Model\ShipmentResponse::class, 'json', $context)); - unset($data['ShipmentResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ShipmentResponse'] = $this->normalizer->normalize($object->getShipmentResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SHIPResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SHIPResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ScheduleBUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/ScheduleBUnitOfMeasurementNormalizer.php index f2794922..abcd9bd4 100644 --- a/src/Api/Normalizer/ScheduleBUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/ScheduleBUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ScheduleBUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ScheduleBUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ScheduleBUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ScheduleBUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SearchOptionOptionCodeNormalizer.php b/src/Api/Normalizer/SearchOptionOptionCodeNormalizer.php index be7a0936..e2df3cd7 100644 --- a/src/Api/Normalizer/SearchOptionOptionCodeNormalizer.php +++ b/src/Api/Normalizer/SearchOptionOptionCodeNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SearchOptionOptionCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SearchOptionOptionCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class; + return $type === \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SearchOptionOptionCode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SearchOptionOptionCode(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SearchOptionOptionCode::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class SearchOptionOptionCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchOptionOptionCode::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SearchOptionOptionCode(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SearchOptionOptionCode::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SearchOptionOptionCode::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SearchOptionOptionTypeNormalizer.php b/src/Api/Normalizer/SearchOptionOptionTypeNormalizer.php index 279bb96e..9dc24e2e 100644 --- a/src/Api/Normalizer/SearchOptionOptionTypeNormalizer.php +++ b/src/Api/Normalizer/SearchOptionOptionTypeNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SearchOptionOptionTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SearchOptionOptionTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SearchOptionOptionType::class; + return $type === \ShipStream\Ups\Api\Model\SearchOptionOptionType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchOptionOptionType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchOptionOptionType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SearchOptionOptionType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SearchOptionOptionType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SearchOptionOptionType::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class SearchOptionOptionTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SearchOptionOptionType::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchOptionOptionType::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SearchOptionOptionType(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SearchOptionOptionType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SearchOptionOptionType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SearchOptionRelationNormalizer.php b/src/Api/Normalizer/SearchOptionRelationNormalizer.php index 64bac06a..76503c3d 100644 --- a/src/Api/Normalizer/SearchOptionRelationNormalizer.php +++ b/src/Api/Normalizer/SearchOptionRelationNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SearchOptionRelationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SearchOptionRelationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SearchOptionRelation::class; + return $type === \ShipStream\Ups\Api\Model\SearchOptionRelation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchOptionRelation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchOptionRelation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SearchOptionRelation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SearchOptionRelation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SearchOptionRelation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class SearchOptionRelationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SearchOptionRelation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchOptionRelation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SearchOptionRelation(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SearchOptionRelation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SearchOptionRelation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SearchResultsAvailableLocationAttributesNormalizer.php b/src/Api/Normalizer/SearchResultsAvailableLocationAttributesNormalizer.php index 09c22d35..732a43b2 100644 --- a/src/Api/Normalizer/SearchResultsAvailableLocationAttributesNormalizer.php +++ b/src/Api/Normalizer/SearchResultsAvailableLocationAttributesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SearchResultsAvailableLocationAttributesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SearchResultsAvailableLocationAttributesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class; + return $type === \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('OptionType', $data)) { - $object->setOptionType($this->denormalizer->denormalize($data['OptionType'], \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class, 'json', $context)); - unset($data['OptionType']); - } - if (\array_key_exists('OptionCode', $data)) { - $object->setOptionCode($this->denormalizer->denormalize($data['OptionCode'], \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class, 'json', $context)); - unset($data['OptionCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['OptionType'] = $this->normalizer->normalize($object->getOptionType(), 'json', $context); - $data['OptionCode'] = $this->normalizer->normalize($object->getOptionCode(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class => false]; - } - } -} else { - class SearchResultsAvailableLocationAttributesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class; + if (\array_key_exists('OptionType', $data)) { + $object->setOptionType($this->denormalizer->denormalize($data['OptionType'], \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class, 'json', $context)); + unset($data['OptionType']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class; + if (\array_key_exists('OptionCode', $data)) { + $object->setOptionCode($this->denormalizer->denormalize($data['OptionCode'], \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class, 'json', $context)); + unset($data['OptionCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('OptionType', $data)) { - $object->setOptionType($this->denormalizer->denormalize($data['OptionType'], \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionType::class, 'json', $context)); - unset($data['OptionType']); - } - if (\array_key_exists('OptionCode', $data)) { - $object->setOptionCode($this->denormalizer->denormalize($data['OptionCode'], \ShipStream\Ups\Api\Model\AvailableLocationAttributesOptionCode::class, 'json', $context)); - unset($data['OptionCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['OptionType'] = $this->normalizer->normalize($object->getOptionType(), 'json', $context); - $data['OptionCode'] = $this->normalizer->normalize($object->getOptionCode(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['OptionType'] = $this->normalizer->normalize($data->getOptionType(), 'json', $context); + $dataArray['OptionCode'] = $this->normalizer->normalize($data->getOptionCode(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SearchResultsAvailableLocationAttributes::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SearchResultsDropLocationNormalizer.php b/src/Api/Normalizer/SearchResultsDropLocationNormalizer.php index 847d1299..bd0bad82 100644 --- a/src/Api/Normalizer/SearchResultsDropLocationNormalizer.php +++ b/src/Api/Normalizer/SearchResultsDropLocationNormalizer.php @@ -5,726 +5,362 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SearchResultsDropLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SearchResultsDropLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SearchResultsDropLocation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LocationID', $data)) { - $object->setLocationID($data['LocationID']); - unset($data['LocationID']); - } - if (\array_key_exists('OriginOrDestination', $data)) { - $object->setOriginOrDestination($data['OriginOrDestination']); - unset($data['OriginOrDestination']); - } - if (\array_key_exists('IVR', $data)) { - $object->setIVR($this->denormalizer->denormalize($data['IVR'], \ShipStream\Ups\Api\Model\DropLocationIVR::class, 'json', $context)); - unset($data['IVR']); - } - if (\array_key_exists('Geocode', $data)) { - $object->setGeocode($this->denormalizer->denormalize($data['Geocode'], \ShipStream\Ups\Api\Model\DropLocationGeocode::class, 'json', $context)); - unset($data['Geocode']); - } - if (\array_key_exists('AddressKeyFormat', $data)) { - $object->setAddressKeyFormat($this->denormalizer->denormalize($data['AddressKeyFormat'], \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class, 'json', $context)); - unset($data['AddressKeyFormat']); - } - if (\array_key_exists('PhoneNumber', $data)) { - $values = []; - foreach ($data['PhoneNumber'] as $value) { - $values[] = $value; - } - $object->setPhoneNumber($values); - unset($data['PhoneNumber']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('LocationAttribute', $data)) { - $values_1 = []; - foreach ($data['LocationAttribute'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class, 'json', $context); - } - $object->setLocationAttribute($values_1); - unset($data['LocationAttribute']); - } - if (\array_key_exists('Distance', $data)) { - $object->setDistance($this->denormalizer->denormalize($data['Distance'], \ShipStream\Ups\Api\Model\DropLocationDistance::class, 'json', $context)); - unset($data['Distance']); - } - if (\array_key_exists('SpecialInstructions', $data)) { - $values_2 = []; - foreach ($data['SpecialInstructions'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class, 'json', $context); - } - $object->setSpecialInstructions($values_2); - unset($data['SpecialInstructions']); - } - if (\array_key_exists('LatestGroundDropOffTime', $data)) { - $values_3 = []; - foreach ($data['LatestGroundDropOffTime'] as $value_3) { - $values_3[] = $value_3; - } - $object->setLatestGroundDropOffTime($values_3); - unset($data['LatestGroundDropOffTime']); - } - if (\array_key_exists('LatestAirDropOffTime', $data)) { - $values_4 = []; - foreach ($data['LatestAirDropOffTime'] as $value_4) { - $values_4[] = $value_4; - } - $object->setLatestAirDropOffTime($values_4); - unset($data['LatestAirDropOffTime']); - } - if (\array_key_exists('AdditionalChargeIndicator', $data)) { - $object->setAdditionalChargeIndicator($data['AdditionalChargeIndicator']); - unset($data['AdditionalChargeIndicator']); - } - if (\array_key_exists('StandardHoursOfOperation', $data)) { - $object->setStandardHoursOfOperation($data['StandardHoursOfOperation']); - unset($data['StandardHoursOfOperation']); - } - if (\array_key_exists('NonStandardHoursOfOperation', $data)) { - $object->setNonStandardHoursOfOperation($data['NonStandardHoursOfOperation']); - unset($data['NonStandardHoursOfOperation']); - } - if (\array_key_exists('WillCallHoursOfOperation', $data)) { - $object->setWillCallHoursOfOperation($data['WillCallHoursOfOperation']); - unset($data['WillCallHoursOfOperation']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('HomePageURL', $data)) { - $object->setHomePageURL($data['HomePageURL']); - unset($data['HomePageURL']); - } - if (\array_key_exists('Comments', $data)) { - $object->setComments($data['Comments']); - unset($data['Comments']); - } - if (\array_key_exists('AdditionalComments', $data)) { - $object->setAdditionalComments($this->denormalizer->denormalize($data['AdditionalComments'], \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class, 'json', $context)); - unset($data['AdditionalComments']); - } - if (\array_key_exists('Disclaimer', $data)) { - $values_5 = []; - foreach ($data['Disclaimer'] as $value_5) { - $values_5[] = $value_5; - } - $object->setDisclaimer($values_5); - unset($data['Disclaimer']); - } - if (\array_key_exists('SLIC', $data)) { - $object->setSLIC($data['SLIC']); - unset($data['SLIC']); - } - if (\array_key_exists('Timezone', $data)) { - $object->setTimezone($data['Timezone']); - unset($data['Timezone']); - } - if (\array_key_exists('FacilityType', $data)) { - $object->setFacilityType($data['FacilityType']); - unset($data['FacilityType']); - } - if (\array_key_exists('OperatingHours', $data)) { - $object->setOperatingHours($this->denormalizer->denormalize($data['OperatingHours'], \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class, 'json', $context)); - unset($data['OperatingHours']); - } - if (\array_key_exists('LocalizedInstruction', $data)) { - $values_6 = []; - foreach ($data['LocalizedInstruction'] as $value_6) { - $values_6[] = $this->denormalizer->denormalize($value_6, \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class, 'json', $context); - } - $object->setLocalizedInstruction($values_6); - unset($data['LocalizedInstruction']); - } - if (\array_key_exists('PromotionInformation', $data)) { - $values_7 = []; - foreach ($data['PromotionInformation'] as $value_7) { - $values_7[] = $this->denormalizer->denormalize($value_7, \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class, 'json', $context); - } - $object->setPromotionInformation($values_7); - unset($data['PromotionInformation']); - } - if (\array_key_exists('SortCode', $data)) { - $object->setSortCode($this->denormalizer->denormalize($data['SortCode'], \ShipStream\Ups\Api\Model\DropLocationSortCode::class, 'json', $context)); - unset($data['SortCode']); - } - if (\array_key_exists('ServiceOfferingList', $data)) { - $object->setServiceOfferingList($this->denormalizer->denormalize($data['ServiceOfferingList'], \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class, 'json', $context)); - unset($data['ServiceOfferingList']); - } - if (\array_key_exists('DisplayPhoneNumberIndicator', $data)) { - $object->setDisplayPhoneNumberIndicator($data['DisplayPhoneNumberIndicator']); - unset($data['DisplayPhoneNumberIndicator']); - } - if (\array_key_exists('AccessPointInformation', $data)) { - $object->setAccessPointInformation($this->denormalizer->denormalize($data['AccessPointInformation'], \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class, 'json', $context)); - unset($data['AccessPointInformation']); - } - if (\array_key_exists('LocationImage', $data)) { - $object->setLocationImage($this->denormalizer->denormalize($data['LocationImage'], \ShipStream\Ups\Api\Model\DropLocationLocationImage::class, 'json', $context)); - unset($data['LocationImage']); - } - if (\array_key_exists('LocationNewIndicator', $data)) { - $object->setLocationNewIndicator($data['LocationNewIndicator']); - unset($data['LocationNewIndicator']); - } - if (\array_key_exists('PromotionalLinkURL', $data)) { - $object->setPromotionalLinkURL($data['PromotionalLinkURL']); - unset($data['PromotionalLinkURL']); - } - if (\array_key_exists('FeaturedRank', $data)) { - $object->setFeaturedRank($data['FeaturedRank']); - unset($data['FeaturedRank']); - } - if (\array_key_exists('WillCallLocationIndicator', $data)) { - $object->setWillCallLocationIndicator($data['WillCallLocationIndicator']); - unset($data['WillCallLocationIndicator']); - } - foreach ($data as $key => $value_8) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_8; - } - } + return $type === \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\SearchResultsDropLocation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['LocationID'] = $object->getLocationID(); - $data['OriginOrDestination'] = $object->getOriginOrDestination(); - $data['IVR'] = $this->normalizer->normalize($object->getIVR(), 'json', $context); - $data['Geocode'] = $this->normalizer->normalize($object->getGeocode(), 'json', $context); - $data['AddressKeyFormat'] = $this->normalizer->normalize($object->getAddressKeyFormat(), 'json', $context); + if (\array_key_exists('LocationID', $data)) { + $object->setLocationID($data['LocationID']); + unset($data['LocationID']); + } + if (\array_key_exists('OriginOrDestination', $data)) { + $object->setOriginOrDestination($data['OriginOrDestination']); + unset($data['OriginOrDestination']); + } + if (\array_key_exists('IVR', $data)) { + $object->setIVR($this->denormalizer->denormalize($data['IVR'], \ShipStream\Ups\Api\Model\DropLocationIVR::class, 'json', $context)); + unset($data['IVR']); + } + if (\array_key_exists('Geocode', $data)) { + $object->setGeocode($this->denormalizer->denormalize($data['Geocode'], \ShipStream\Ups\Api\Model\DropLocationGeocode::class, 'json', $context)); + unset($data['Geocode']); + } + if (\array_key_exists('AddressKeyFormat', $data)) { + $object->setAddressKeyFormat($this->denormalizer->denormalize($data['AddressKeyFormat'], \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class, 'json', $context)); + unset($data['AddressKeyFormat']); + } + if (\array_key_exists('PhoneNumber', $data)) { $values = []; - foreach ($object->getPhoneNumber() as $value) { + foreach ($data['PhoneNumber'] as $value) { $values[] = $value; } - $data['PhoneNumber'] = $values; - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } + $object->setPhoneNumber($values); + unset($data['PhoneNumber']); + } + if (\array_key_exists('FaxNumber', $data)) { + $object->setFaxNumber($data['FaxNumber']); + unset($data['FaxNumber']); + } + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); + } + if (\array_key_exists('LocationAttribute', $data)) { $values_1 = []; - foreach ($object->getLocationAttribute() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['LocationAttribute'] = $values_1; - $data['Distance'] = $this->normalizer->normalize($object->getDistance(), 'json', $context); - if ($object->isInitialized('specialInstructions') && null !== $object->getSpecialInstructions()) { - $values_2 = []; - foreach ($object->getSpecialInstructions() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['SpecialInstructions'] = $values_2; - } - if ($object->isInitialized('latestGroundDropOffTime') && null !== $object->getLatestGroundDropOffTime()) { - $values_3 = []; - foreach ($object->getLatestGroundDropOffTime() as $value_3) { - $values_3[] = $value_3; - } - $data['LatestGroundDropOffTime'] = $values_3; - } - if ($object->isInitialized('latestAirDropOffTime') && null !== $object->getLatestAirDropOffTime()) { - $values_4 = []; - foreach ($object->getLatestAirDropOffTime() as $value_4) { - $values_4[] = $value_4; - } - $data['LatestAirDropOffTime'] = $values_4; - } - if ($object->isInitialized('additionalChargeIndicator') && null !== $object->getAdditionalChargeIndicator()) { - $data['AdditionalChargeIndicator'] = $object->getAdditionalChargeIndicator(); - } - if ($object->isInitialized('standardHoursOfOperation') && null !== $object->getStandardHoursOfOperation()) { - $data['StandardHoursOfOperation'] = $object->getStandardHoursOfOperation(); - } - if ($object->isInitialized('nonStandardHoursOfOperation') && null !== $object->getNonStandardHoursOfOperation()) { - $data['NonStandardHoursOfOperation'] = $object->getNonStandardHoursOfOperation(); - } - if ($object->isInitialized('willCallHoursOfOperation') && null !== $object->getWillCallHoursOfOperation()) { - $data['WillCallHoursOfOperation'] = $object->getWillCallHoursOfOperation(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('homePageURL') && null !== $object->getHomePageURL()) { - $data['HomePageURL'] = $object->getHomePageURL(); + foreach ($data['LocationAttribute'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class, 'json', $context); } - if ($object->isInitialized('comments') && null !== $object->getComments()) { - $data['Comments'] = $object->getComments(); - } - if ($object->isInitialized('additionalComments') && null !== $object->getAdditionalComments()) { - $data['AdditionalComments'] = $this->normalizer->normalize($object->getAdditionalComments(), 'json', $context); - } - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $values_5 = []; - foreach ($object->getDisclaimer() as $value_5) { - $values_5[] = $value_5; - } - $data['Disclaimer'] = $values_5; - } - if ($object->isInitialized('sLIC') && null !== $object->getSLIC()) { - $data['SLIC'] = $object->getSLIC(); - } - $data['Timezone'] = $object->getTimezone(); - if ($object->isInitialized('facilityType') && null !== $object->getFacilityType()) { - $data['FacilityType'] = $object->getFacilityType(); - } - if ($object->isInitialized('operatingHours') && null !== $object->getOperatingHours()) { - $data['OperatingHours'] = $this->normalizer->normalize($object->getOperatingHours(), 'json', $context); - } - if ($object->isInitialized('localizedInstruction') && null !== $object->getLocalizedInstruction()) { - $values_6 = []; - foreach ($object->getLocalizedInstruction() as $value_6) { - $values_6[] = $this->normalizer->normalize($value_6, 'json', $context); - } - $data['LocalizedInstruction'] = $values_6; - } - if ($object->isInitialized('promotionInformation') && null !== $object->getPromotionInformation()) { - $values_7 = []; - foreach ($object->getPromotionInformation() as $value_7) { - $values_7[] = $this->normalizer->normalize($value_7, 'json', $context); - } - $data['PromotionInformation'] = $values_7; - } - if ($object->isInitialized('sortCode') && null !== $object->getSortCode()) { - $data['SortCode'] = $this->normalizer->normalize($object->getSortCode(), 'json', $context); - } - if ($object->isInitialized('serviceOfferingList') && null !== $object->getServiceOfferingList()) { - $data['ServiceOfferingList'] = $this->normalizer->normalize($object->getServiceOfferingList(), 'json', $context); - } - if ($object->isInitialized('displayPhoneNumberIndicator') && null !== $object->getDisplayPhoneNumberIndicator()) { - $data['DisplayPhoneNumberIndicator'] = $object->getDisplayPhoneNumberIndicator(); - } - if ($object->isInitialized('accessPointInformation') && null !== $object->getAccessPointInformation()) { - $data['AccessPointInformation'] = $this->normalizer->normalize($object->getAccessPointInformation(), 'json', $context); - } - if ($object->isInitialized('locationImage') && null !== $object->getLocationImage()) { - $data['LocationImage'] = $this->normalizer->normalize($object->getLocationImage(), 'json', $context); + $object->setLocationAttribute($values_1); + unset($data['LocationAttribute']); + } + if (\array_key_exists('Distance', $data)) { + $object->setDistance($this->denormalizer->denormalize($data['Distance'], \ShipStream\Ups\Api\Model\DropLocationDistance::class, 'json', $context)); + unset($data['Distance']); + } + if (\array_key_exists('SpecialInstructions', $data)) { + $values_2 = []; + foreach ($data['SpecialInstructions'] as $value_2) { + $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class, 'json', $context); } - if ($object->isInitialized('locationNewIndicator') && null !== $object->getLocationNewIndicator()) { - $data['LocationNewIndicator'] = $object->getLocationNewIndicator(); + $object->setSpecialInstructions($values_2); + unset($data['SpecialInstructions']); + } + if (\array_key_exists('LatestGroundDropOffTime', $data)) { + $values_3 = []; + foreach ($data['LatestGroundDropOffTime'] as $value_3) { + $values_3[] = $value_3; } - if ($object->isInitialized('promotionalLinkURL') && null !== $object->getPromotionalLinkURL()) { - $data['PromotionalLinkURL'] = $object->getPromotionalLinkURL(); + $object->setLatestGroundDropOffTime($values_3); + unset($data['LatestGroundDropOffTime']); + } + if (\array_key_exists('LatestAirDropOffTime', $data)) { + $values_4 = []; + foreach ($data['LatestAirDropOffTime'] as $value_4) { + $values_4[] = $value_4; } - if ($object->isInitialized('featuredRank') && null !== $object->getFeaturedRank()) { - $data['FeaturedRank'] = $object->getFeaturedRank(); + $object->setLatestAirDropOffTime($values_4); + unset($data['LatestAirDropOffTime']); + } + if (\array_key_exists('AdditionalChargeIndicator', $data)) { + $object->setAdditionalChargeIndicator($data['AdditionalChargeIndicator']); + unset($data['AdditionalChargeIndicator']); + } + if (\array_key_exists('StandardHoursOfOperation', $data)) { + $object->setStandardHoursOfOperation($data['StandardHoursOfOperation']); + unset($data['StandardHoursOfOperation']); + } + if (\array_key_exists('NonStandardHoursOfOperation', $data)) { + $object->setNonStandardHoursOfOperation($data['NonStandardHoursOfOperation']); + unset($data['NonStandardHoursOfOperation']); + } + if (\array_key_exists('WillCallHoursOfOperation', $data)) { + $object->setWillCallHoursOfOperation($data['WillCallHoursOfOperation']); + unset($data['WillCallHoursOfOperation']); + } + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('HomePageURL', $data)) { + $object->setHomePageURL($data['HomePageURL']); + unset($data['HomePageURL']); + } + if (\array_key_exists('Comments', $data)) { + $object->setComments($data['Comments']); + unset($data['Comments']); + } + if (\array_key_exists('AdditionalComments', $data)) { + $object->setAdditionalComments($this->denormalizer->denormalize($data['AdditionalComments'], \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class, 'json', $context)); + unset($data['AdditionalComments']); + } + if (\array_key_exists('Disclaimer', $data)) { + $values_5 = []; + foreach ($data['Disclaimer'] as $value_5) { + $values_5[] = $value_5; } - if ($object->isInitialized('willCallLocationIndicator') && null !== $object->getWillCallLocationIndicator()) { - $data['WillCallLocationIndicator'] = $object->getWillCallLocationIndicator(); + $object->setDisclaimer($values_5); + unset($data['Disclaimer']); + } + if (\array_key_exists('SLIC', $data)) { + $object->setSLIC($data['SLIC']); + unset($data['SLIC']); + } + if (\array_key_exists('Timezone', $data)) { + $object->setTimezone($data['Timezone']); + unset($data['Timezone']); + } + if (\array_key_exists('FacilityType', $data)) { + $object->setFacilityType($data['FacilityType']); + unset($data['FacilityType']); + } + if (\array_key_exists('OperatingHours', $data)) { + $object->setOperatingHours($this->denormalizer->denormalize($data['OperatingHours'], \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class, 'json', $context)); + unset($data['OperatingHours']); + } + if (\array_key_exists('LocalizedInstruction', $data)) { + $values_6 = []; + foreach ($data['LocalizedInstruction'] as $value_6) { + $values_6[] = $this->denormalizer->denormalize($value_6, \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class, 'json', $context); } - foreach ($object as $key => $value_8) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_8; - } + $object->setLocalizedInstruction($values_6); + unset($data['LocalizedInstruction']); + } + if (\array_key_exists('PromotionInformation', $data)) { + $values_7 = []; + foreach ($data['PromotionInformation'] as $value_7) { + $values_7[] = $this->denormalizer->denormalize($value_7, \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class, 'json', $context); } - return $data; + $object->setPromotionInformation($values_7); + unset($data['PromotionInformation']); + } + if (\array_key_exists('SortCode', $data)) { + $object->setSortCode($this->denormalizer->denormalize($data['SortCode'], \ShipStream\Ups\Api\Model\DropLocationSortCode::class, 'json', $context)); + unset($data['SortCode']); + } + if (\array_key_exists('ServiceOfferingList', $data)) { + $object->setServiceOfferingList($this->denormalizer->denormalize($data['ServiceOfferingList'], \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class, 'json', $context)); + unset($data['ServiceOfferingList']); + } + if (\array_key_exists('DisplayPhoneNumberIndicator', $data)) { + $object->setDisplayPhoneNumberIndicator($data['DisplayPhoneNumberIndicator']); + unset($data['DisplayPhoneNumberIndicator']); + } + if (\array_key_exists('AccessPointInformation', $data)) { + $object->setAccessPointInformation($this->denormalizer->denormalize($data['AccessPointInformation'], \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class, 'json', $context)); + unset($data['AccessPointInformation']); + } + if (\array_key_exists('LocationImage', $data)) { + $object->setLocationImage($this->denormalizer->denormalize($data['LocationImage'], \ShipStream\Ups\Api\Model\DropLocationLocationImage::class, 'json', $context)); + unset($data['LocationImage']); + } + if (\array_key_exists('LocationNewIndicator', $data)) { + $object->setLocationNewIndicator($data['LocationNewIndicator']); + unset($data['LocationNewIndicator']); + } + if (\array_key_exists('PromotionalLinkURL', $data)) { + $object->setPromotionalLinkURL($data['PromotionalLinkURL']); + unset($data['PromotionalLinkURL']); + } + if (\array_key_exists('FeaturedRank', $data)) { + $object->setFeaturedRank($data['FeaturedRank']); + unset($data['FeaturedRank']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SearchResultsDropLocation::class => false]; + if (\array_key_exists('WillCallLocationIndicator', $data)) { + $object->setWillCallLocationIndicator($data['WillCallLocationIndicator']); + unset($data['WillCallLocationIndicator']); } + foreach ($data as $key => $value_8) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_8; + } + } + return $object; } -} else { - class SearchResultsDropLocationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchResultsDropLocation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SearchResultsDropLocation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LocationID', $data)) { - $object->setLocationID($data['LocationID']); - unset($data['LocationID']); - } - if (\array_key_exists('OriginOrDestination', $data)) { - $object->setOriginOrDestination($data['OriginOrDestination']); - unset($data['OriginOrDestination']); - } - if (\array_key_exists('IVR', $data)) { - $object->setIVR($this->denormalizer->denormalize($data['IVR'], \ShipStream\Ups\Api\Model\DropLocationIVR::class, 'json', $context)); - unset($data['IVR']); - } - if (\array_key_exists('Geocode', $data)) { - $object->setGeocode($this->denormalizer->denormalize($data['Geocode'], \ShipStream\Ups\Api\Model\DropLocationGeocode::class, 'json', $context)); - unset($data['Geocode']); - } - if (\array_key_exists('AddressKeyFormat', $data)) { - $object->setAddressKeyFormat($this->denormalizer->denormalize($data['AddressKeyFormat'], \ShipStream\Ups\Api\Model\DropLocationAddressKeyFormat::class, 'json', $context)); - unset($data['AddressKeyFormat']); - } - if (\array_key_exists('PhoneNumber', $data)) { - $values = []; - foreach ($data['PhoneNumber'] as $value) { - $values[] = $value; - } - $object->setPhoneNumber($values); - unset($data['PhoneNumber']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('LocationAttribute', $data)) { - $values_1 = []; - foreach ($data['LocationAttribute'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\DropLocationLocationAttribute::class, 'json', $context); - } - $object->setLocationAttribute($values_1); - unset($data['LocationAttribute']); - } - if (\array_key_exists('Distance', $data)) { - $object->setDistance($this->denormalizer->denormalize($data['Distance'], \ShipStream\Ups\Api\Model\DropLocationDistance::class, 'json', $context)); - unset($data['Distance']); - } - if (\array_key_exists('SpecialInstructions', $data)) { - $values_2 = []; - foreach ($data['SpecialInstructions'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\DropLocationSpecialInstructions::class, 'json', $context); - } - $object->setSpecialInstructions($values_2); - unset($data['SpecialInstructions']); - } - if (\array_key_exists('LatestGroundDropOffTime', $data)) { - $values_3 = []; - foreach ($data['LatestGroundDropOffTime'] as $value_3) { - $values_3[] = $value_3; - } - $object->setLatestGroundDropOffTime($values_3); - unset($data['LatestGroundDropOffTime']); - } - if (\array_key_exists('LatestAirDropOffTime', $data)) { - $values_4 = []; - foreach ($data['LatestAirDropOffTime'] as $value_4) { - $values_4[] = $value_4; - } - $object->setLatestAirDropOffTime($values_4); - unset($data['LatestAirDropOffTime']); - } - if (\array_key_exists('AdditionalChargeIndicator', $data)) { - $object->setAdditionalChargeIndicator($data['AdditionalChargeIndicator']); - unset($data['AdditionalChargeIndicator']); - } - if (\array_key_exists('StandardHoursOfOperation', $data)) { - $object->setStandardHoursOfOperation($data['StandardHoursOfOperation']); - unset($data['StandardHoursOfOperation']); - } - if (\array_key_exists('NonStandardHoursOfOperation', $data)) { - $object->setNonStandardHoursOfOperation($data['NonStandardHoursOfOperation']); - unset($data['NonStandardHoursOfOperation']); - } - if (\array_key_exists('WillCallHoursOfOperation', $data)) { - $object->setWillCallHoursOfOperation($data['WillCallHoursOfOperation']); - unset($data['WillCallHoursOfOperation']); - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('HomePageURL', $data)) { - $object->setHomePageURL($data['HomePageURL']); - unset($data['HomePageURL']); - } - if (\array_key_exists('Comments', $data)) { - $object->setComments($data['Comments']); - unset($data['Comments']); - } - if (\array_key_exists('AdditionalComments', $data)) { - $object->setAdditionalComments($this->denormalizer->denormalize($data['AdditionalComments'], \ShipStream\Ups\Api\Model\DropLocationAdditionalComments::class, 'json', $context)); - unset($data['AdditionalComments']); - } - if (\array_key_exists('Disclaimer', $data)) { - $values_5 = []; - foreach ($data['Disclaimer'] as $value_5) { - $values_5[] = $value_5; - } - $object->setDisclaimer($values_5); - unset($data['Disclaimer']); - } - if (\array_key_exists('SLIC', $data)) { - $object->setSLIC($data['SLIC']); - unset($data['SLIC']); - } - if (\array_key_exists('Timezone', $data)) { - $object->setTimezone($data['Timezone']); - unset($data['Timezone']); - } - if (\array_key_exists('FacilityType', $data)) { - $object->setFacilityType($data['FacilityType']); - unset($data['FacilityType']); - } - if (\array_key_exists('OperatingHours', $data)) { - $object->setOperatingHours($this->denormalizer->denormalize($data['OperatingHours'], \ShipStream\Ups\Api\Model\DropLocationOperatingHours::class, 'json', $context)); - unset($data['OperatingHours']); - } - if (\array_key_exists('LocalizedInstruction', $data)) { - $values_6 = []; - foreach ($data['LocalizedInstruction'] as $value_6) { - $values_6[] = $this->denormalizer->denormalize($value_6, \ShipStream\Ups\Api\Model\DropLocationLocalizedInstruction::class, 'json', $context); - } - $object->setLocalizedInstruction($values_6); - unset($data['LocalizedInstruction']); - } - if (\array_key_exists('PromotionInformation', $data)) { - $values_7 = []; - foreach ($data['PromotionInformation'] as $value_7) { - $values_7[] = $this->denormalizer->denormalize($value_7, \ShipStream\Ups\Api\Model\DropLocationPromotionInformation::class, 'json', $context); - } - $object->setPromotionInformation($values_7); - unset($data['PromotionInformation']); - } - if (\array_key_exists('SortCode', $data)) { - $object->setSortCode($this->denormalizer->denormalize($data['SortCode'], \ShipStream\Ups\Api\Model\DropLocationSortCode::class, 'json', $context)); - unset($data['SortCode']); - } - if (\array_key_exists('ServiceOfferingList', $data)) { - $object->setServiceOfferingList($this->denormalizer->denormalize($data['ServiceOfferingList'], \ShipStream\Ups\Api\Model\DropLocationServiceOfferingList::class, 'json', $context)); - unset($data['ServiceOfferingList']); - } - if (\array_key_exists('DisplayPhoneNumberIndicator', $data)) { - $object->setDisplayPhoneNumberIndicator($data['DisplayPhoneNumberIndicator']); - unset($data['DisplayPhoneNumberIndicator']); - } - if (\array_key_exists('AccessPointInformation', $data)) { - $object->setAccessPointInformation($this->denormalizer->denormalize($data['AccessPointInformation'], \ShipStream\Ups\Api\Model\DropLocationAccessPointInformation::class, 'json', $context)); - unset($data['AccessPointInformation']); - } - if (\array_key_exists('LocationImage', $data)) { - $object->setLocationImage($this->denormalizer->denormalize($data['LocationImage'], \ShipStream\Ups\Api\Model\DropLocationLocationImage::class, 'json', $context)); - unset($data['LocationImage']); - } - if (\array_key_exists('LocationNewIndicator', $data)) { - $object->setLocationNewIndicator($data['LocationNewIndicator']); - unset($data['LocationNewIndicator']); - } - if (\array_key_exists('PromotionalLinkURL', $data)) { - $object->setPromotionalLinkURL($data['PromotionalLinkURL']); - unset($data['PromotionalLinkURL']); - } - if (\array_key_exists('FeaturedRank', $data)) { - $object->setFeaturedRank($data['FeaturedRank']); - unset($data['FeaturedRank']); - } - if (\array_key_exists('WillCallLocationIndicator', $data)) { - $object->setWillCallLocationIndicator($data['WillCallLocationIndicator']); - unset($data['WillCallLocationIndicator']); - } - foreach ($data as $key => $value_8) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_8; - } - } - return $object; + $dataArray = []; + $dataArray['LocationID'] = $data->getLocationID(); + $dataArray['OriginOrDestination'] = $data->getOriginOrDestination(); + $dataArray['IVR'] = $this->normalizer->normalize($data->getIVR(), 'json', $context); + $dataArray['Geocode'] = $this->normalizer->normalize($data->getGeocode(), 'json', $context); + $dataArray['AddressKeyFormat'] = $this->normalizer->normalize($data->getAddressKeyFormat(), 'json', $context); + $values = []; + foreach ($data->getPhoneNumber() as $value) { + $values[] = $value; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['LocationID'] = $object->getLocationID(); - $data['OriginOrDestination'] = $object->getOriginOrDestination(); - $data['IVR'] = $this->normalizer->normalize($object->getIVR(), 'json', $context); - $data['Geocode'] = $this->normalizer->normalize($object->getGeocode(), 'json', $context); - $data['AddressKeyFormat'] = $this->normalizer->normalize($object->getAddressKeyFormat(), 'json', $context); - $values = []; - foreach ($object->getPhoneNumber() as $value) { - $values[] = $value; - } - $data['PhoneNumber'] = $values; - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - $values_1 = []; - foreach ($object->getLocationAttribute() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['LocationAttribute'] = $values_1; - $data['Distance'] = $this->normalizer->normalize($object->getDistance(), 'json', $context); - if ($object->isInitialized('specialInstructions') && null !== $object->getSpecialInstructions()) { - $values_2 = []; - foreach ($object->getSpecialInstructions() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['SpecialInstructions'] = $values_2; - } - if ($object->isInitialized('latestGroundDropOffTime') && null !== $object->getLatestGroundDropOffTime()) { - $values_3 = []; - foreach ($object->getLatestGroundDropOffTime() as $value_3) { - $values_3[] = $value_3; - } - $data['LatestGroundDropOffTime'] = $values_3; - } - if ($object->isInitialized('latestAirDropOffTime') && null !== $object->getLatestAirDropOffTime()) { - $values_4 = []; - foreach ($object->getLatestAirDropOffTime() as $value_4) { - $values_4[] = $value_4; - } - $data['LatestAirDropOffTime'] = $values_4; - } - if ($object->isInitialized('additionalChargeIndicator') && null !== $object->getAdditionalChargeIndicator()) { - $data['AdditionalChargeIndicator'] = $object->getAdditionalChargeIndicator(); - } - if ($object->isInitialized('standardHoursOfOperation') && null !== $object->getStandardHoursOfOperation()) { - $data['StandardHoursOfOperation'] = $object->getStandardHoursOfOperation(); - } - if ($object->isInitialized('nonStandardHoursOfOperation') && null !== $object->getNonStandardHoursOfOperation()) { - $data['NonStandardHoursOfOperation'] = $object->getNonStandardHoursOfOperation(); - } - if ($object->isInitialized('willCallHoursOfOperation') && null !== $object->getWillCallHoursOfOperation()) { - $data['WillCallHoursOfOperation'] = $object->getWillCallHoursOfOperation(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('homePageURL') && null !== $object->getHomePageURL()) { - $data['HomePageURL'] = $object->getHomePageURL(); - } - if ($object->isInitialized('comments') && null !== $object->getComments()) { - $data['Comments'] = $object->getComments(); - } - if ($object->isInitialized('additionalComments') && null !== $object->getAdditionalComments()) { - $data['AdditionalComments'] = $this->normalizer->normalize($object->getAdditionalComments(), 'json', $context); - } - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $values_5 = []; - foreach ($object->getDisclaimer() as $value_5) { - $values_5[] = $value_5; - } - $data['Disclaimer'] = $values_5; - } - if ($object->isInitialized('sLIC') && null !== $object->getSLIC()) { - $data['SLIC'] = $object->getSLIC(); - } - $data['Timezone'] = $object->getTimezone(); - if ($object->isInitialized('facilityType') && null !== $object->getFacilityType()) { - $data['FacilityType'] = $object->getFacilityType(); - } - if ($object->isInitialized('operatingHours') && null !== $object->getOperatingHours()) { - $data['OperatingHours'] = $this->normalizer->normalize($object->getOperatingHours(), 'json', $context); - } - if ($object->isInitialized('localizedInstruction') && null !== $object->getLocalizedInstruction()) { - $values_6 = []; - foreach ($object->getLocalizedInstruction() as $value_6) { - $values_6[] = $this->normalizer->normalize($value_6, 'json', $context); - } - $data['LocalizedInstruction'] = $values_6; - } - if ($object->isInitialized('promotionInformation') && null !== $object->getPromotionInformation()) { - $values_7 = []; - foreach ($object->getPromotionInformation() as $value_7) { - $values_7[] = $this->normalizer->normalize($value_7, 'json', $context); - } - $data['PromotionInformation'] = $values_7; - } - if ($object->isInitialized('sortCode') && null !== $object->getSortCode()) { - $data['SortCode'] = $this->normalizer->normalize($object->getSortCode(), 'json', $context); - } - if ($object->isInitialized('serviceOfferingList') && null !== $object->getServiceOfferingList()) { - $data['ServiceOfferingList'] = $this->normalizer->normalize($object->getServiceOfferingList(), 'json', $context); - } - if ($object->isInitialized('displayPhoneNumberIndicator') && null !== $object->getDisplayPhoneNumberIndicator()) { - $data['DisplayPhoneNumberIndicator'] = $object->getDisplayPhoneNumberIndicator(); - } - if ($object->isInitialized('accessPointInformation') && null !== $object->getAccessPointInformation()) { - $data['AccessPointInformation'] = $this->normalizer->normalize($object->getAccessPointInformation(), 'json', $context); - } - if ($object->isInitialized('locationImage') && null !== $object->getLocationImage()) { - $data['LocationImage'] = $this->normalizer->normalize($object->getLocationImage(), 'json', $context); - } - if ($object->isInitialized('locationNewIndicator') && null !== $object->getLocationNewIndicator()) { - $data['LocationNewIndicator'] = $object->getLocationNewIndicator(); + $dataArray['PhoneNumber'] = $values; + if ($data->isInitialized('faxNumber') && null !== $data->getFaxNumber()) { + $dataArray['FaxNumber'] = $data->getFaxNumber(); + } + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); + } + $values_1 = []; + foreach ($data->getLocationAttribute() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + } + $dataArray['LocationAttribute'] = $values_1; + $dataArray['Distance'] = $this->normalizer->normalize($data->getDistance(), 'json', $context); + if ($data->isInitialized('specialInstructions') && null !== $data->getSpecialInstructions()) { + $values_2 = []; + foreach ($data->getSpecialInstructions() as $value_2) { + $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); + } + $dataArray['SpecialInstructions'] = $values_2; + } + if ($data->isInitialized('latestGroundDropOffTime') && null !== $data->getLatestGroundDropOffTime()) { + $values_3 = []; + foreach ($data->getLatestGroundDropOffTime() as $value_3) { + $values_3[] = $value_3; } - if ($object->isInitialized('promotionalLinkURL') && null !== $object->getPromotionalLinkURL()) { - $data['PromotionalLinkURL'] = $object->getPromotionalLinkURL(); + $dataArray['LatestGroundDropOffTime'] = $values_3; + } + if ($data->isInitialized('latestAirDropOffTime') && null !== $data->getLatestAirDropOffTime()) { + $values_4 = []; + foreach ($data->getLatestAirDropOffTime() as $value_4) { + $values_4[] = $value_4; } - if ($object->isInitialized('featuredRank') && null !== $object->getFeaturedRank()) { - $data['FeaturedRank'] = $object->getFeaturedRank(); + $dataArray['LatestAirDropOffTime'] = $values_4; + } + if ($data->isInitialized('additionalChargeIndicator') && null !== $data->getAdditionalChargeIndicator()) { + $dataArray['AdditionalChargeIndicator'] = $data->getAdditionalChargeIndicator(); + } + if ($data->isInitialized('standardHoursOfOperation') && null !== $data->getStandardHoursOfOperation()) { + $dataArray['StandardHoursOfOperation'] = $data->getStandardHoursOfOperation(); + } + if ($data->isInitialized('nonStandardHoursOfOperation') && null !== $data->getNonStandardHoursOfOperation()) { + $dataArray['NonStandardHoursOfOperation'] = $data->getNonStandardHoursOfOperation(); + } + if ($data->isInitialized('willCallHoursOfOperation') && null !== $data->getWillCallHoursOfOperation()) { + $dataArray['WillCallHoursOfOperation'] = $data->getWillCallHoursOfOperation(); + } + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); + } + if ($data->isInitialized('homePageURL') && null !== $data->getHomePageURL()) { + $dataArray['HomePageURL'] = $data->getHomePageURL(); + } + if ($data->isInitialized('comments') && null !== $data->getComments()) { + $dataArray['Comments'] = $data->getComments(); + } + if ($data->isInitialized('additionalComments') && null !== $data->getAdditionalComments()) { + $dataArray['AdditionalComments'] = $this->normalizer->normalize($data->getAdditionalComments(), 'json', $context); + } + if ($data->isInitialized('disclaimer') && null !== $data->getDisclaimer()) { + $values_5 = []; + foreach ($data->getDisclaimer() as $value_5) { + $values_5[] = $value_5; } - if ($object->isInitialized('willCallLocationIndicator') && null !== $object->getWillCallLocationIndicator()) { - $data['WillCallLocationIndicator'] = $object->getWillCallLocationIndicator(); + $dataArray['Disclaimer'] = $values_5; + } + if ($data->isInitialized('sLIC') && null !== $data->getSLIC()) { + $dataArray['SLIC'] = $data->getSLIC(); + } + $dataArray['Timezone'] = $data->getTimezone(); + if ($data->isInitialized('facilityType') && null !== $data->getFacilityType()) { + $dataArray['FacilityType'] = $data->getFacilityType(); + } + if ($data->isInitialized('operatingHours') && null !== $data->getOperatingHours()) { + $dataArray['OperatingHours'] = $this->normalizer->normalize($data->getOperatingHours(), 'json', $context); + } + if ($data->isInitialized('localizedInstruction') && null !== $data->getLocalizedInstruction()) { + $values_6 = []; + foreach ($data->getLocalizedInstruction() as $value_6) { + $values_6[] = $this->normalizer->normalize($value_6, 'json', $context); } - foreach ($object as $key => $value_8) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_8; - } + $dataArray['LocalizedInstruction'] = $values_6; + } + if ($data->isInitialized('promotionInformation') && null !== $data->getPromotionInformation()) { + $values_7 = []; + foreach ($data->getPromotionInformation() as $value_7) { + $values_7[] = $this->normalizer->normalize($value_7, 'json', $context); } - return $data; + $dataArray['PromotionInformation'] = $values_7; + } + if ($data->isInitialized('sortCode') && null !== $data->getSortCode()) { + $dataArray['SortCode'] = $this->normalizer->normalize($data->getSortCode(), 'json', $context); + } + if ($data->isInitialized('serviceOfferingList') && null !== $data->getServiceOfferingList()) { + $dataArray['ServiceOfferingList'] = $this->normalizer->normalize($data->getServiceOfferingList(), 'json', $context); + } + if ($data->isInitialized('displayPhoneNumberIndicator') && null !== $data->getDisplayPhoneNumberIndicator()) { + $dataArray['DisplayPhoneNumberIndicator'] = $data->getDisplayPhoneNumberIndicator(); + } + if ($data->isInitialized('accessPointInformation') && null !== $data->getAccessPointInformation()) { + $dataArray['AccessPointInformation'] = $this->normalizer->normalize($data->getAccessPointInformation(), 'json', $context); + } + if ($data->isInitialized('locationImage') && null !== $data->getLocationImage()) { + $dataArray['LocationImage'] = $this->normalizer->normalize($data->getLocationImage(), 'json', $context); + } + if ($data->isInitialized('locationNewIndicator') && null !== $data->getLocationNewIndicator()) { + $dataArray['LocationNewIndicator'] = $data->getLocationNewIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SearchResultsDropLocation::class => false]; + if ($data->isInitialized('promotionalLinkURL') && null !== $data->getPromotionalLinkURL()) { + $dataArray['PromotionalLinkURL'] = $data->getPromotionalLinkURL(); } + if ($data->isInitialized('featuredRank') && null !== $data->getFeaturedRank()) { + $dataArray['FeaturedRank'] = $data->getFeaturedRank(); + } + if ($data->isInitialized('willCallLocationIndicator') && null !== $data->getWillCallLocationIndicator()) { + $dataArray['WillCallLocationIndicator'] = $data->getWillCallLocationIndicator(); + } + foreach ($data as $key => $value_8) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_8; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SearchResultsDropLocation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SearchResultsGeocodeCandidateNormalizer.php b/src/Api/Normalizer/SearchResultsGeocodeCandidateNormalizer.php index d27c35cb..d97ac292 100644 --- a/src/Api/Normalizer/SearchResultsGeocodeCandidateNormalizer.php +++ b/src/Api/Normalizer/SearchResultsGeocodeCandidateNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SearchResultsGeocodeCandidateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SearchResultsGeocodeCandidateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class; + return $type === \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressKeyFormat', $data)) { - $object->setAddressKeyFormat($this->denormalizer->denormalize($data['AddressKeyFormat'], \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class, 'json', $context)); - unset($data['AddressKeyFormat']); - } - if (\array_key_exists('Geocode', $data)) { - $object->setGeocode($this->denormalizer->denormalize($data['Geocode'], \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class, 'json', $context)); - unset($data['Geocode']); - } - if (\array_key_exists('LandmarkName', $data)) { - $object->setLandmarkName($data['LandmarkName']); - unset($data['LandmarkName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AddressKeyFormat'] = $this->normalizer->normalize($object->getAddressKeyFormat(), 'json', $context); - $data['Geocode'] = $this->normalizer->normalize($object->getGeocode(), 'json', $context); - if ($object->isInitialized('landmarkName') && null !== $object->getLandmarkName()) { - $data['LandmarkName'] = $object->getLandmarkName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class => false]; + if (\array_key_exists('AddressKeyFormat', $data)) { + $object->setAddressKeyFormat($this->denormalizer->denormalize($data['AddressKeyFormat'], \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class, 'json', $context)); + unset($data['AddressKeyFormat']); } - } -} else { - class SearchResultsGeocodeCandidateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class; + if (\array_key_exists('Geocode', $data)) { + $object->setGeocode($this->denormalizer->denormalize($data['Geocode'], \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class, 'json', $context)); + unset($data['Geocode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class; + if (\array_key_exists('LandmarkName', $data)) { + $object->setLandmarkName($data['LandmarkName']); + unset($data['LandmarkName']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressKeyFormat', $data)) { - $object->setAddressKeyFormat($this->denormalizer->denormalize($data['AddressKeyFormat'], \ShipStream\Ups\Api\Model\GeocodeCandidateAddressKeyFormat::class, 'json', $context)); - unset($data['AddressKeyFormat']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('Geocode', $data)) { - $object->setGeocode($this->denormalizer->denormalize($data['Geocode'], \ShipStream\Ups\Api\Model\GeocodeCandidateGeocode::class, 'json', $context)); - unset($data['Geocode']); - } - if (\array_key_exists('LandmarkName', $data)) { - $object->setLandmarkName($data['LandmarkName']); - unset($data['LandmarkName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AddressKeyFormat'] = $this->normalizer->normalize($object->getAddressKeyFormat(), 'json', $context); - $data['Geocode'] = $this->normalizer->normalize($object->getGeocode(), 'json', $context); - if ($object->isInitialized('landmarkName') && null !== $object->getLandmarkName()) { - $data['LandmarkName'] = $object->getLandmarkName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['AddressKeyFormat'] = $this->normalizer->normalize($data->getAddressKeyFormat(), 'json', $context); + $dataArray['Geocode'] = $this->normalizer->normalize($data->getGeocode(), 'json', $context); + if ($data->isInitialized('landmarkName') && null !== $data->getLandmarkName()) { + $dataArray['LandmarkName'] = $data->getLandmarkName(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SearchResultsGeocodeCandidate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SecurityV1OauthRefreshPostBodyNormalizer.php b/src/Api/Normalizer/SecurityV1OauthRefreshPostBodyNormalizer.php index efd61fdf..6fc6382b 100644 --- a/src/Api/Normalizer/SecurityV1OauthRefreshPostBodyNormalizer.php +++ b/src/Api/Normalizer/SecurityV1OauthRefreshPostBodyNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SecurityV1OauthRefreshPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SecurityV1OauthRefreshPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class; + return $type === \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('grant_type', $data)) { - $object->setGrantType($data['grant_type']); - unset($data['grant_type']); - } - if (\array_key_exists('refresh_token', $data)) { - $object->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['grant_type'] = $object->getGrantType(); - $data['refresh_token'] = $object->getRefreshToken(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class => false]; - } - } -} else { - class SecurityV1OauthRefreshPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class; + if (\array_key_exists('grant_type', $data)) { + $object->setGrantType($data['grant_type']); + unset($data['grant_type']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class; + if (\array_key_exists('refresh_token', $data)) { + $object->setRefreshToken($data['refresh_token']); + unset($data['refresh_token']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('grant_type', $data)) { - $object->setGrantType($data['grant_type']); - unset($data['grant_type']); - } - if (\array_key_exists('refresh_token', $data)) { - $object->setRefreshToken($data['refresh_token']); - unset($data['refresh_token']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['grant_type'] = $object->getGrantType(); - $data['refresh_token'] = $object->getRefreshToken(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['grant_type'] = $data->getGrantType(); + $dataArray['refresh_token'] = $data->getRefreshToken(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SecurityV1OauthRefreshPostBody::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SecurityV1OauthTokenPostBodyNormalizer.php b/src/Api/Normalizer/SecurityV1OauthTokenPostBodyNormalizer.php index dc5b47de..afed2c36 100644 --- a/src/Api/Normalizer/SecurityV1OauthTokenPostBodyNormalizer.php +++ b/src/Api/Normalizer/SecurityV1OauthTokenPostBodyNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SecurityV1OauthTokenPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SecurityV1OauthTokenPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class; + return $type === \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('grant_type', $data)) { - $object->setGrantType($data['grant_type']); - unset($data['grant_type']); - } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('redirect_uri', $data)) { - $object->setRedirectUri($data['redirect_uri']); - unset($data['redirect_uri']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['grant_type'] = $object->getGrantType(); - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('redirectUri') && null !== $object->getRedirectUri()) { - $data['redirect_uri'] = $object->getRedirectUri(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('grant_type', $data)) { + $object->setGrantType($data['grant_type']); + unset($data['grant_type']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class => false]; + if (\array_key_exists('code', $data)) { + $object->setCode($data['code']); + unset($data['code']); } + if (\array_key_exists('redirect_uri', $data)) { + $object->setRedirectUri($data['redirect_uri']); + unset($data['redirect_uri']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class SecurityV1OauthTokenPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class; + $dataArray = []; + $dataArray['grant_type'] = $data->getGrantType(); + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['code'] = $data->getCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class; + if ($data->isInitialized('redirectUri') && null !== $data->getRedirectUri()) { + $dataArray['redirect_uri'] = $data->getRedirectUri(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('grant_type', $data)) { - $object->setGrantType($data['grant_type']); - unset($data['grant_type']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('redirect_uri', $data)) { - $object->setRedirectUri($data['redirect_uri']); - unset($data['redirect_uri']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['grant_type'] = $object->getGrantType(); - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('redirectUri') && null !== $object->getRedirectUri()) { - $data['redirect_uri'] = $object->getRedirectUri(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SecurityV1OauthTokenPostBody::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ServiceCenterLocationDropOffFacilitiesNormalizer.php b/src/Api/Normalizer/ServiceCenterLocationDropOffFacilitiesNormalizer.php index 975a6c2f..a5c25df0 100644 --- a/src/Api/Normalizer/ServiceCenterLocationDropOffFacilitiesNormalizer.php +++ b/src/Api/Normalizer/ServiceCenterLocationDropOffFacilitiesNormalizer.php @@ -5,254 +5,126 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ServiceCenterLocationDropOffFacilitiesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ServiceCenterLocationDropOffFacilitiesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class; + return $type === \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('SLIC', $data)) { - $object->setSLIC($data['SLIC']); - unset($data['SLIC']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('Timezone', $data)) { - $object->setTimezone($data['Timezone']); - unset($data['Timezone']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($data['Phone']); - unset($data['Phone']); - } - if (\array_key_exists('Fax', $data)) { - $object->setFax($data['Fax']); - unset($data['Fax']); - } - if (\array_key_exists('FacilityTime', $data)) { - $object->setFacilityTime($this->denormalizer->denormalize($data['FacilityTime'], \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class, 'json', $context)); - unset($data['FacilityTime']); - } - if (\array_key_exists('OriginOrDestination', $data)) { - $object->setOriginOrDestination($data['OriginOrDestination']); - unset($data['OriginOrDestination']); - } - if (\array_key_exists('LocalizedInstruction', $data)) { - $values = []; - foreach ($data['LocalizedInstruction'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class, 'json', $context); - } - $object->setLocalizedInstruction($values); - unset($data['LocalizedInstruction']); - } - if (\array_key_exists('Distance', $data)) { - $object->setDistance($this->denormalizer->denormalize($data['Distance'], \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class, 'json', $context)); - unset($data['Distance']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - $data['SLIC'] = $object->getSLIC(); - $data['Type'] = $object->getType(); - $data['Timezone'] = $object->getTimezone(); - $data['Phone'] = $object->getPhone(); - $data['Fax'] = $object->getFax(); - if ($object->isInitialized('facilityTime') && null !== $object->getFacilityTime()) { - $data['FacilityTime'] = $this->normalizer->normalize($object->getFacilityTime(), 'json', $context); - } - $data['OriginOrDestination'] = $object->getOriginOrDestination(); - if ($object->isInitialized('localizedInstruction') && null !== $object->getLocalizedInstruction()) { - $values = []; - foreach ($object->getLocalizedInstruction() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['LocalizedInstruction'] = $values; - } - if ($object->isInitialized('distance') && null !== $object->getDistance()) { - $data['Distance'] = $this->normalizer->normalize($object->getDistance(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class => false]; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class, 'json', $context)); + unset($data['Address']); } - } -} else { - class ServiceCenterLocationDropOffFacilitiesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class; + if (\array_key_exists('SLIC', $data)) { + $object->setSLIC($data['SLIC']); + unset($data['SLIC']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class; + if (\array_key_exists('Type', $data)) { + $object->setType($data['Type']); + unset($data['Type']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\DropOffFacilitiesAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('SLIC', $data)) { - $object->setSLIC($data['SLIC']); - unset($data['SLIC']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('Timezone', $data)) { - $object->setTimezone($data['Timezone']); - unset($data['Timezone']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($data['Phone']); - unset($data['Phone']); - } - if (\array_key_exists('Fax', $data)) { - $object->setFax($data['Fax']); - unset($data['Fax']); - } - if (\array_key_exists('FacilityTime', $data)) { - $object->setFacilityTime($this->denormalizer->denormalize($data['FacilityTime'], \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class, 'json', $context)); - unset($data['FacilityTime']); - } - if (\array_key_exists('OriginOrDestination', $data)) { - $object->setOriginOrDestination($data['OriginOrDestination']); - unset($data['OriginOrDestination']); - } - if (\array_key_exists('LocalizedInstruction', $data)) { - $values = []; - foreach ($data['LocalizedInstruction'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class, 'json', $context); - } - $object->setLocalizedInstruction($values); - unset($data['LocalizedInstruction']); - } - if (\array_key_exists('Distance', $data)) { - $object->setDistance($this->denormalizer->denormalize($data['Distance'], \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class, 'json', $context)); - unset($data['Distance']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if (\array_key_exists('Timezone', $data)) { + $object->setTimezone($data['Timezone']); + unset($data['Timezone']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - $data['SLIC'] = $object->getSLIC(); - $data['Type'] = $object->getType(); - $data['Timezone'] = $object->getTimezone(); - $data['Phone'] = $object->getPhone(); - $data['Fax'] = $object->getFax(); - if ($object->isInitialized('facilityTime') && null !== $object->getFacilityTime()) { - $data['FacilityTime'] = $this->normalizer->normalize($object->getFacilityTime(), 'json', $context); - } - $data['OriginOrDestination'] = $object->getOriginOrDestination(); - if ($object->isInitialized('localizedInstruction') && null !== $object->getLocalizedInstruction()) { - $values = []; - foreach ($object->getLocalizedInstruction() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['LocalizedInstruction'] = $values; + if (\array_key_exists('Phone', $data)) { + $object->setPhone($data['Phone']); + unset($data['Phone']); + } + if (\array_key_exists('Fax', $data)) { + $object->setFax($data['Fax']); + unset($data['Fax']); + } + if (\array_key_exists('FacilityTime', $data)) { + $object->setFacilityTime($this->denormalizer->denormalize($data['FacilityTime'], \ShipStream\Ups\Api\Model\DropOffFacilitiesFacilityTime::class, 'json', $context)); + unset($data['FacilityTime']); + } + if (\array_key_exists('OriginOrDestination', $data)) { + $object->setOriginOrDestination($data['OriginOrDestination']); + unset($data['OriginOrDestination']); + } + if (\array_key_exists('LocalizedInstruction', $data)) { + $values = []; + foreach ($data['LocalizedInstruction'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DropOffFacilitiesLocalizedInstruction::class, 'json', $context); } - if ($object->isInitialized('distance') && null !== $object->getDistance()) { - $data['Distance'] = $this->normalizer->normalize($object->getDistance(), 'json', $context); + $object->setLocalizedInstruction($values); + unset($data['LocalizedInstruction']); + } + if (\array_key_exists('Distance', $data)) { + $object->setDistance($this->denormalizer->denormalize($data['Distance'], \ShipStream\Ups\Api\Model\DropOffFacilitiesDistance::class, 'json', $context)); + unset($data['Distance']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Name'] = $data->getName(); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + $dataArray['SLIC'] = $data->getSLIC(); + $dataArray['Type'] = $data->getType(); + $dataArray['Timezone'] = $data->getTimezone(); + $dataArray['Phone'] = $data->getPhone(); + $dataArray['Fax'] = $data->getFax(); + if ($data->isInitialized('facilityTime') && null !== $data->getFacilityTime()) { + $dataArray['FacilityTime'] = $this->normalizer->normalize($data->getFacilityTime(), 'json', $context); + } + $dataArray['OriginOrDestination'] = $data->getOriginOrDestination(); + if ($data->isInitialized('localizedInstruction') && null !== $data->getLocalizedInstruction()) { + $values = []; + foreach ($data->getLocalizedInstruction() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $data; + $dataArray['LocalizedInstruction'] = $values; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class => false]; + if ($data->isInitialized('distance') && null !== $data->getDistance()) { + $dataArray['Distance'] = $this->normalizer->normalize($data->getDistance(), 'json', $context); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ServiceCenterLocationDropOffFacilities::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ServiceCenterLocationPickupFacilitiesNormalizer.php b/src/Api/Normalizer/ServiceCenterLocationPickupFacilitiesNormalizer.php index 07605f02..83078ff5 100644 --- a/src/Api/Normalizer/ServiceCenterLocationPickupFacilitiesNormalizer.php +++ b/src/Api/Normalizer/ServiceCenterLocationPickupFacilitiesNormalizer.php @@ -5,228 +5,113 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ServiceCenterLocationPickupFacilitiesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ServiceCenterLocationPickupFacilitiesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('SLIC', $data)) { - $object->setSLIC($data['SLIC']); - unset($data['SLIC']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('Timezone', $data)) { - $object->setTimezone($data['Timezone']); - unset($data['Timezone']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($data['Phone']); - unset($data['Phone']); - } - if (\array_key_exists('Fax', $data)) { - $object->setFax($data['Fax']); - unset($data['Fax']); - } - if (\array_key_exists('FacilityTime', $data)) { - $object->setFacilityTime($this->denormalizer->denormalize($data['FacilityTime'], \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class, 'json', $context)); - unset($data['FacilityTime']); - } - if (\array_key_exists('AirportCode', $data)) { - $object->setAirportCode($data['AirportCode']); - unset($data['AirportCode']); - } - if (\array_key_exists('SortCode', $data)) { - $object->setSortCode($data['SortCode']); - unset($data['SortCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - $data['SLIC'] = $object->getSLIC(); - $data['Type'] = $object->getType(); - $data['Timezone'] = $object->getTimezone(); - $data['Phone'] = $object->getPhone(); - $data['Fax'] = $object->getFax(); - if ($object->isInitialized('facilityTime') && null !== $object->getFacilityTime()) { - $data['FacilityTime'] = $this->normalizer->normalize($object->getFacilityTime(), 'json', $context); - } - if ($object->isInitialized('airportCode') && null !== $object->getAirportCode()) { - $data['AirportCode'] = $object->getAirportCode(); - } - if ($object->isInitialized('sortCode') && null !== $object->getSortCode()) { - $data['SortCode'] = $object->getSortCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class, 'json', $context)); + unset($data['Address']); + } + if (\array_key_exists('SLIC', $data)) { + $object->setSLIC($data['SLIC']); + unset($data['SLIC']); + } + if (\array_key_exists('Type', $data)) { + $object->setType($data['Type']); + unset($data['Type']); + } + if (\array_key_exists('Timezone', $data)) { + $object->setTimezone($data['Timezone']); + unset($data['Timezone']); + } + if (\array_key_exists('Phone', $data)) { + $object->setPhone($data['Phone']); + unset($data['Phone']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class => false]; + if (\array_key_exists('Fax', $data)) { + $object->setFax($data['Fax']); + unset($data['Fax']); } + if (\array_key_exists('FacilityTime', $data)) { + $object->setFacilityTime($this->denormalizer->denormalize($data['FacilityTime'], \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class, 'json', $context)); + unset($data['FacilityTime']); + } + if (\array_key_exists('AirportCode', $data)) { + $object->setAirportCode($data['AirportCode']); + unset($data['AirportCode']); + } + if (\array_key_exists('SortCode', $data)) { + $object->setSortCode($data['SortCode']); + unset($data['SortCode']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ServiceCenterLocationPickupFacilitiesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\PickupFacilitiesAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('SLIC', $data)) { - $object->setSLIC($data['SLIC']); - unset($data['SLIC']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('Timezone', $data)) { - $object->setTimezone($data['Timezone']); - unset($data['Timezone']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($data['Phone']); - unset($data['Phone']); - } - if (\array_key_exists('Fax', $data)) { - $object->setFax($data['Fax']); - unset($data['Fax']); - } - if (\array_key_exists('FacilityTime', $data)) { - $object->setFacilityTime($this->denormalizer->denormalize($data['FacilityTime'], \ShipStream\Ups\Api\Model\PickupFacilitiesFacilityTime::class, 'json', $context)); - unset($data['FacilityTime']); - } - if (\array_key_exists('AirportCode', $data)) { - $object->setAirportCode($data['AirportCode']); - unset($data['AirportCode']); - } - if (\array_key_exists('SortCode', $data)) { - $object->setSortCode($data['SortCode']); - unset($data['SortCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Name'] = $data->getName(); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + $dataArray['SLIC'] = $data->getSLIC(); + $dataArray['Type'] = $data->getType(); + $dataArray['Timezone'] = $data->getTimezone(); + $dataArray['Phone'] = $data->getPhone(); + $dataArray['Fax'] = $data->getFax(); + if ($data->isInitialized('facilityTime') && null !== $data->getFacilityTime()) { + $dataArray['FacilityTime'] = $this->normalizer->normalize($data->getFacilityTime(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - $data['SLIC'] = $object->getSLIC(); - $data['Type'] = $object->getType(); - $data['Timezone'] = $object->getTimezone(); - $data['Phone'] = $object->getPhone(); - $data['Fax'] = $object->getFax(); - if ($object->isInitialized('facilityTime') && null !== $object->getFacilityTime()) { - $data['FacilityTime'] = $this->normalizer->normalize($object->getFacilityTime(), 'json', $context); - } - if ($object->isInitialized('airportCode') && null !== $object->getAirportCode()) { - $data['AirportCode'] = $object->getAirportCode(); - } - if ($object->isInitialized('sortCode') && null !== $object->getSortCode()) { - $data['SortCode'] = $object->getSortCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('airportCode') && null !== $data->getAirportCode()) { + $dataArray['AirportCode'] = $data->getAirportCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class => false]; + if ($data->isInitialized('sortCode') && null !== $data->getSortCode()) { + $dataArray['SortCode'] = $data->getSortCode(); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ServiceCenterLocationPickupFacilities::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ServiceNormalizer.php b/src/Api/Normalizer/ServiceNormalizer.php index b927d598..3e1915f1 100644 --- a/src/Api/Normalizer/ServiceNormalizer.php +++ b/src/Api/Normalizer/ServiceNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Service::class; + return $type === \ShipStream\Ups\Api\Model\Service::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Service::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Service::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Service(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('description', $data)) { - $object->setDescription($data['description']); - unset($data['description']); - } - if (\array_key_exists('levelCode', $data)) { - $object->setLevelCode($data['levelCode']); - unset($data['levelCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\Service(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('levelCode') && null !== $object->getLevelCode()) { - $data['levelCode'] = $object->getLevelCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('code', $data)) { + $object->setCode($data['code']); + unset($data['code']); + } + if (\array_key_exists('description', $data)) { + $object->setDescription($data['description']); + unset($data['description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Service::class => false]; + if (\array_key_exists('levelCode', $data)) { + $object->setLevelCode($data['levelCode']); + unset($data['levelCode']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Service::class; + $dataArray = []; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['code'] = $data->getCode(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Service::class; + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['description'] = $data->getDescription(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Service(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('description', $data)) { - $object->setDescription($data['description']); - unset($data['description']); - } - if (\array_key_exists('levelCode', $data)) { - $object->setLevelCode($data['levelCode']); - unset($data['levelCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('levelCode') && null !== $data->getLevelCode()) { + $dataArray['levelCode'] = $data->getLevelCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('levelCode') && null !== $object->getLevelCode()) { - $data['levelCode'] = $object->getLevelCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Service::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Service::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ServiceOfferingListServiceOfferingNormalizer.php b/src/Api/Normalizer/ServiceOfferingListServiceOfferingNormalizer.php index 6a7e90bf..1d07ad68 100644 --- a/src/Api/Normalizer/ServiceOfferingListServiceOfferingNormalizer.php +++ b/src/Api/Normalizer/ServiceOfferingListServiceOfferingNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ServiceOfferingListServiceOfferingNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ServiceOfferingListServiceOfferingNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class; + return $type === \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class => false]; - } - } -} else { - class ServiceOfferingListServiceOfferingNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ServiceOfferingListServiceOffering::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ServiceSearchServiceCodeNormalizer.php b/src/Api/Normalizer/ServiceSearchServiceCodeNormalizer.php index aaddf7a8..ba8e04ee 100644 --- a/src/Api/Normalizer/ServiceSearchServiceCodeNormalizer.php +++ b/src/Api/Normalizer/ServiceSearchServiceCodeNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ServiceSearchServiceCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ServiceSearchServiceCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class; + return $type === \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceSearchServiceCode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ServiceSearchServiceCode(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ServiceSearchServiceCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceSearchServiceCode(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ServiceSearchServiceCode::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ServiceSearchServiceOptionCodeNormalizer.php b/src/Api/Normalizer/ServiceSearchServiceOptionCodeNormalizer.php index 9c64b685..72903abf 100644 --- a/src/Api/Normalizer/ServiceSearchServiceOptionCodeNormalizer.php +++ b/src/Api/Normalizer/ServiceSearchServiceOptionCodeNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ServiceSearchServiceOptionCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ServiceSearchServiceOptionCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class; + return $type === \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ServiceSearchServiceOptionCodeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ServiceSearchServiceOptionCode::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ServiceSummaryEstimatedArrivalNormalizer.php b/src/Api/Normalizer/ServiceSummaryEstimatedArrivalNormalizer.php index 0edbc52f..31c41df5 100644 --- a/src/Api/Normalizer/ServiceSummaryEstimatedArrivalNormalizer.php +++ b/src/Api/Normalizer/ServiceSummaryEstimatedArrivalNormalizer.php @@ -5,226 +5,112 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ServiceSummaryEstimatedArrivalNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ServiceSummaryEstimatedArrivalNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Arrival', $data)) { - $object->setArrival($this->denormalizer->denormalize($data['Arrival'], \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class, 'json', $context)); - unset($data['Arrival']); - } - if (\array_key_exists('BusinessDaysInTransit', $data)) { - $object->setBusinessDaysInTransit($data['BusinessDaysInTransit']); - unset($data['BusinessDaysInTransit']); - } - if (\array_key_exists('Pickup', $data)) { - $object->setPickup($this->denormalizer->denormalize($data['Pickup'], \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class, 'json', $context)); - unset($data['Pickup']); - } - if (\array_key_exists('DayOfWeek', $data)) { - $object->setDayOfWeek($data['DayOfWeek']); - unset($data['DayOfWeek']); - } - if (\array_key_exists('CustomerCenterCutoff', $data)) { - $object->setCustomerCenterCutoff($data['CustomerCenterCutoff']); - unset($data['CustomerCenterCutoff']); - } - if (\array_key_exists('DelayCount', $data)) { - $object->setDelayCount($data['DelayCount']); - unset($data['DelayCount']); - } - if (\array_key_exists('HolidayCount', $data)) { - $object->setHolidayCount($data['HolidayCount']); - unset($data['HolidayCount']); - } - if (\array_key_exists('RestDays', $data)) { - $object->setRestDays($data['RestDays']); - unset($data['RestDays']); - } - if (\array_key_exists('TotalTransitDays', $data)) { - $object->setTotalTransitDays($data['TotalTransitDays']); - unset($data['TotalTransitDays']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Arrival'] = $this->normalizer->normalize($object->getArrival(), 'json', $context); - $data['BusinessDaysInTransit'] = $object->getBusinessDaysInTransit(); - $data['Pickup'] = $this->normalizer->normalize($object->getPickup(), 'json', $context); - $data['DayOfWeek'] = $object->getDayOfWeek(); - if ($object->isInitialized('customerCenterCutoff') && null !== $object->getCustomerCenterCutoff()) { - $data['CustomerCenterCutoff'] = $object->getCustomerCenterCutoff(); - } - if ($object->isInitialized('delayCount') && null !== $object->getDelayCount()) { - $data['DelayCount'] = $object->getDelayCount(); - } - if ($object->isInitialized('holidayCount') && null !== $object->getHolidayCount()) { - $data['HolidayCount'] = $object->getHolidayCount(); - } - if ($object->isInitialized('restDays') && null !== $object->getRestDays()) { - $data['RestDays'] = $object->getRestDays(); - } - if ($object->isInitialized('totalTransitDays') && null !== $object->getTotalTransitDays()) { - $data['TotalTransitDays'] = $object->getTotalTransitDays(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Arrival', $data)) { + $object->setArrival($this->denormalizer->denormalize($data['Arrival'], \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class, 'json', $context)); + unset($data['Arrival']); + } + if (\array_key_exists('BusinessDaysInTransit', $data)) { + $object->setBusinessDaysInTransit($data['BusinessDaysInTransit']); + unset($data['BusinessDaysInTransit']); + } + if (\array_key_exists('Pickup', $data)) { + $object->setPickup($this->denormalizer->denormalize($data['Pickup'], \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class, 'json', $context)); + unset($data['Pickup']); + } + if (\array_key_exists('DayOfWeek', $data)) { + $object->setDayOfWeek($data['DayOfWeek']); + unset($data['DayOfWeek']); + } + if (\array_key_exists('CustomerCenterCutoff', $data)) { + $object->setCustomerCenterCutoff($data['CustomerCenterCutoff']); + unset($data['CustomerCenterCutoff']); + } + if (\array_key_exists('DelayCount', $data)) { + $object->setDelayCount($data['DelayCount']); + unset($data['DelayCount']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class => false]; + if (\array_key_exists('HolidayCount', $data)) { + $object->setHolidayCount($data['HolidayCount']); + unset($data['HolidayCount']); } + if (\array_key_exists('RestDays', $data)) { + $object->setRestDays($data['RestDays']); + unset($data['RestDays']); + } + if (\array_key_exists('TotalTransitDays', $data)) { + $object->setTotalTransitDays($data['TotalTransitDays']); + unset($data['TotalTransitDays']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ServiceSummaryEstimatedArrivalNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Arrival', $data)) { - $object->setArrival($this->denormalizer->denormalize($data['Arrival'], \ShipStream\Ups\Api\Model\EstimatedArrivalArrival::class, 'json', $context)); - unset($data['Arrival']); - } - if (\array_key_exists('BusinessDaysInTransit', $data)) { - $object->setBusinessDaysInTransit($data['BusinessDaysInTransit']); - unset($data['BusinessDaysInTransit']); - } - if (\array_key_exists('Pickup', $data)) { - $object->setPickup($this->denormalizer->denormalize($data['Pickup'], \ShipStream\Ups\Api\Model\EstimatedArrivalPickup::class, 'json', $context)); - unset($data['Pickup']); - } - if (\array_key_exists('DayOfWeek', $data)) { - $object->setDayOfWeek($data['DayOfWeek']); - unset($data['DayOfWeek']); - } - if (\array_key_exists('CustomerCenterCutoff', $data)) { - $object->setCustomerCenterCutoff($data['CustomerCenterCutoff']); - unset($data['CustomerCenterCutoff']); - } - if (\array_key_exists('DelayCount', $data)) { - $object->setDelayCount($data['DelayCount']); - unset($data['DelayCount']); - } - if (\array_key_exists('HolidayCount', $data)) { - $object->setHolidayCount($data['HolidayCount']); - unset($data['HolidayCount']); - } - if (\array_key_exists('RestDays', $data)) { - $object->setRestDays($data['RestDays']); - unset($data['RestDays']); - } - if (\array_key_exists('TotalTransitDays', $data)) { - $object->setTotalTransitDays($data['TotalTransitDays']); - unset($data['TotalTransitDays']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Arrival'] = $this->normalizer->normalize($data->getArrival(), 'json', $context); + $dataArray['BusinessDaysInTransit'] = $data->getBusinessDaysInTransit(); + $dataArray['Pickup'] = $this->normalizer->normalize($data->getPickup(), 'json', $context); + $dataArray['DayOfWeek'] = $data->getDayOfWeek(); + if ($data->isInitialized('customerCenterCutoff') && null !== $data->getCustomerCenterCutoff()) { + $dataArray['CustomerCenterCutoff'] = $data->getCustomerCenterCutoff(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Arrival'] = $this->normalizer->normalize($object->getArrival(), 'json', $context); - $data['BusinessDaysInTransit'] = $object->getBusinessDaysInTransit(); - $data['Pickup'] = $this->normalizer->normalize($object->getPickup(), 'json', $context); - $data['DayOfWeek'] = $object->getDayOfWeek(); - if ($object->isInitialized('customerCenterCutoff') && null !== $object->getCustomerCenterCutoff()) { - $data['CustomerCenterCutoff'] = $object->getCustomerCenterCutoff(); - } - if ($object->isInitialized('delayCount') && null !== $object->getDelayCount()) { - $data['DelayCount'] = $object->getDelayCount(); - } - if ($object->isInitialized('holidayCount') && null !== $object->getHolidayCount()) { - $data['HolidayCount'] = $object->getHolidayCount(); - } - if ($object->isInitialized('restDays') && null !== $object->getRestDays()) { - $data['RestDays'] = $object->getRestDays(); - } - if ($object->isInitialized('totalTransitDays') && null !== $object->getTotalTransitDays()) { - $data['TotalTransitDays'] = $object->getTotalTransitDays(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('delayCount') && null !== $data->getDelayCount()) { + $dataArray['DelayCount'] = $data->getDelayCount(); + } + if ($data->isInitialized('holidayCount') && null !== $data->getHolidayCount()) { + $dataArray['HolidayCount'] = $data->getHolidayCount(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class => false]; + if ($data->isInitialized('restDays') && null !== $data->getRestDays()) { + $dataArray['RestDays'] = $data->getRestDays(); } + if ($data->isInitialized('totalTransitDays') && null !== $data->getTotalTransitDays()) { + $dataArray['TotalTransitDays'] = $data->getTotalTransitDays(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ServiceSummaryServiceNormalizer.php b/src/Api/Normalizer/ServiceSummaryServiceNormalizer.php index a82f5e80..7be5c0d5 100644 --- a/src/Api/Normalizer/ServiceSummaryServiceNormalizer.php +++ b/src/Api/Normalizer/ServiceSummaryServiceNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ServiceSummaryServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ServiceSummaryServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceSummaryService::class; + return $type === \ShipStream\Ups\Api\Model\ServiceSummaryService::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceSummaryService::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceSummaryService::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceSummaryService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ServiceSummaryService(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceSummaryService::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ServiceSummaryServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ServiceSummaryService::class; + $dataArray = []; + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ServiceSummaryService::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ServiceSummaryService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ServiceSummaryService::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ServiceSummaryService::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ServicesNormalizer.php b/src/Api/Normalizer/ServicesNormalizer.php index 1fcfe685..eea1b7e4 100644 --- a/src/Api/Normalizer/ServicesNormalizer.php +++ b/src/Api/Normalizer/ServicesNormalizer.php @@ -5,366 +5,182 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ServicesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ServicesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Services::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Services::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Services(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('serviceLevel', $data)) { - $object->setServiceLevel($data['serviceLevel']); - unset($data['serviceLevel']); - } - if (\array_key_exists('serviceLevelDescription', $data)) { - $object->setServiceLevelDescription($data['serviceLevelDescription']); - unset($data['serviceLevelDescription']); - } - if (\array_key_exists('shipDate', $data)) { - $object->setShipDate($data['shipDate']); - unset($data['shipDate']); - } - if (\array_key_exists('deliveryDate', $data)) { - $object->setDeliveryDate($data['deliveryDate']); - unset($data['deliveryDate']); - } - if (\array_key_exists('commitTime', $data)) { - $object->setCommitTime($data['commitTime']); - unset($data['commitTime']); - } - if (\array_key_exists('deliveryTime', $data)) { - $object->setDeliveryTime($data['deliveryTime']); - unset($data['deliveryTime']); - } - if (\array_key_exists('deliveryDayOfWeek', $data)) { - $object->setDeliveryDayOfWeek($data['deliveryDayOfWeek']); - unset($data['deliveryDayOfWeek']); - } - if (\array_key_exists('nextDayPickupIndicator', $data)) { - $object->setNextDayPickupIndicator($data['nextDayPickupIndicator']); - unset($data['nextDayPickupIndicator']); - } - if (\array_key_exists('saturdayPickupIndicator', $data)) { - $object->setSaturdayPickupIndicator($data['saturdayPickupIndicator']); - unset($data['saturdayPickupIndicator']); - } - if (\array_key_exists('saturdayDeliveryDate', $data)) { - $object->setSaturdayDeliveryDate($data['saturdayDeliveryDate']); - unset($data['saturdayDeliveryDate']); - } - if (\array_key_exists('saturdayDeliveryTime', $data)) { - $object->setSaturdayDeliveryTime($data['saturdayDeliveryTime']); - unset($data['saturdayDeliveryTime']); - } - if (\array_key_exists('serviceRemarksText', $data)) { - $object->setServiceRemarksText($data['serviceRemarksText']); - unset($data['serviceRemarksText']); - } - if (\array_key_exists('guaranteeIndicator', $data)) { - $object->setGuaranteeIndicator($data['guaranteeIndicator']); - unset($data['guaranteeIndicator']); - } - if (\array_key_exists('totalTransitDays', $data)) { - $object->setTotalTransitDays($data['totalTransitDays']); - unset($data['totalTransitDays']); - } - if (\array_key_exists('businessTransitDays', $data)) { - $object->setBusinessTransitDays($data['businessTransitDays']); - unset($data['businessTransitDays']); - } - if (\array_key_exists('restDaysCount', $data)) { - $object->setRestDaysCount($data['restDaysCount']); - unset($data['restDaysCount']); - } - if (\array_key_exists('holidayCount', $data)) { - $object->setHolidayCount($data['holidayCount']); - unset($data['holidayCount']); - } - if (\array_key_exists('delayCount', $data)) { - $object->setDelayCount($data['delayCount']); - unset($data['delayCount']); - } - if (\array_key_exists('pickupDate', $data)) { - $object->setPickupDate($data['pickupDate']); - unset($data['pickupDate']); - } - if (\array_key_exists('pickupTime', $data)) { - $object->setPickupTime($data['pickupTime']); - unset($data['pickupTime']); - } - if (\array_key_exists('cstccutoffTime', $data)) { - $object->setCstccutoffTime($data['cstccutoffTime']); - unset($data['cstccutoffTime']); - } - if (\array_key_exists('poddate', $data)) { - $object->setPoddate($data['poddate']); - unset($data['poddate']); - } - if (\array_key_exists('poddays', $data)) { - $object->setPoddays($data['poddays']); - unset($data['poddays']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\Services::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Services::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\Services(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['serviceLevel'] = $object->getServiceLevel(); - $data['serviceLevelDescription'] = $object->getServiceLevelDescription(); - $data['shipDate'] = $object->getShipDate(); - $data['deliveryDate'] = $object->getDeliveryDate(); - $data['commitTime'] = $object->getCommitTime(); - $data['deliveryTime'] = $object->getDeliveryTime(); - $data['deliveryDayOfWeek'] = $object->getDeliveryDayOfWeek(); - $data['nextDayPickupIndicator'] = $object->getNextDayPickupIndicator(); - $data['saturdayPickupIndicator'] = $object->getSaturdayPickupIndicator(); - if ($object->isInitialized('saturdayDeliveryDate') && null !== $object->getSaturdayDeliveryDate()) { - $data['saturdayDeliveryDate'] = $object->getSaturdayDeliveryDate(); - } - if ($object->isInitialized('saturdayDeliveryTime') && null !== $object->getSaturdayDeliveryTime()) { - $data['saturdayDeliveryTime'] = $object->getSaturdayDeliveryTime(); - } - if ($object->isInitialized('serviceRemarksText') && null !== $object->getServiceRemarksText()) { - $data['serviceRemarksText'] = $object->getServiceRemarksText(); - } - $data['guaranteeIndicator'] = $object->getGuaranteeIndicator(); - $data['totalTransitDays'] = $object->getTotalTransitDays(); - $data['businessTransitDays'] = $object->getBusinessTransitDays(); - $data['restDaysCount'] = $object->getRestDaysCount(); - $data['holidayCount'] = $object->getHolidayCount(); - $data['delayCount'] = $object->getDelayCount(); - $data['pickupDate'] = $object->getPickupDate(); - $data['pickupTime'] = $object->getPickupTime(); - $data['cstccutoffTime'] = $object->getCstccutoffTime(); - if ($object->isInitialized('poddate') && null !== $object->getPoddate()) { - $data['poddate'] = $object->getPoddate(); - } - if ($object->isInitialized('poddays') && null !== $object->getPoddays()) { - $data['poddays'] = $object->getPoddays(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('serviceLevel', $data)) { + $object->setServiceLevel($data['serviceLevel']); + unset($data['serviceLevel']); + } + if (\array_key_exists('serviceLevelDescription', $data)) { + $object->setServiceLevelDescription($data['serviceLevelDescription']); + unset($data['serviceLevelDescription']); + } + if (\array_key_exists('shipDate', $data)) { + $object->setShipDate($data['shipDate']); + unset($data['shipDate']); + } + if (\array_key_exists('deliveryDate', $data)) { + $object->setDeliveryDate($data['deliveryDate']); + unset($data['deliveryDate']); + } + if (\array_key_exists('commitTime', $data)) { + $object->setCommitTime($data['commitTime']); + unset($data['commitTime']); + } + if (\array_key_exists('deliveryTime', $data)) { + $object->setDeliveryTime($data['deliveryTime']); + unset($data['deliveryTime']); + } + if (\array_key_exists('deliveryDayOfWeek', $data)) { + $object->setDeliveryDayOfWeek($data['deliveryDayOfWeek']); + unset($data['deliveryDayOfWeek']); + } + if (\array_key_exists('nextDayPickupIndicator', $data)) { + $object->setNextDayPickupIndicator($data['nextDayPickupIndicator']); + unset($data['nextDayPickupIndicator']); + } + if (\array_key_exists('saturdayPickupIndicator', $data)) { + $object->setSaturdayPickupIndicator($data['saturdayPickupIndicator']); + unset($data['saturdayPickupIndicator']); + } + if (\array_key_exists('saturdayDeliveryDate', $data)) { + $object->setSaturdayDeliveryDate($data['saturdayDeliveryDate']); + unset($data['saturdayDeliveryDate']); + } + if (\array_key_exists('saturdayDeliveryTime', $data)) { + $object->setSaturdayDeliveryTime($data['saturdayDeliveryTime']); + unset($data['saturdayDeliveryTime']); + } + if (\array_key_exists('serviceRemarksText', $data)) { + $object->setServiceRemarksText($data['serviceRemarksText']); + unset($data['serviceRemarksText']); + } + if (\array_key_exists('guaranteeIndicator', $data)) { + $object->setGuaranteeIndicator($data['guaranteeIndicator']); + unset($data['guaranteeIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Services::class => false]; + if (\array_key_exists('totalTransitDays', $data)) { + $object->setTotalTransitDays($data['totalTransitDays']); + unset($data['totalTransitDays']); } + if (\array_key_exists('businessTransitDays', $data)) { + $object->setBusinessTransitDays($data['businessTransitDays']); + unset($data['businessTransitDays']); + } + if (\array_key_exists('restDaysCount', $data)) { + $object->setRestDaysCount($data['restDaysCount']); + unset($data['restDaysCount']); + } + if (\array_key_exists('holidayCount', $data)) { + $object->setHolidayCount($data['holidayCount']); + unset($data['holidayCount']); + } + if (\array_key_exists('delayCount', $data)) { + $object->setDelayCount($data['delayCount']); + unset($data['delayCount']); + } + if (\array_key_exists('pickupDate', $data)) { + $object->setPickupDate($data['pickupDate']); + unset($data['pickupDate']); + } + if (\array_key_exists('pickupTime', $data)) { + $object->setPickupTime($data['pickupTime']); + unset($data['pickupTime']); + } + if (\array_key_exists('cstccutoffTime', $data)) { + $object->setCstccutoffTime($data['cstccutoffTime']); + unset($data['cstccutoffTime']); + } + if (\array_key_exists('poddate', $data)) { + $object->setPoddate($data['poddate']); + unset($data['poddate']); + } + if (\array_key_exists('poddays', $data)) { + $object->setPoddays($data['poddays']); + unset($data['poddays']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ServicesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Services::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Services::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Services(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('serviceLevel', $data)) { - $object->setServiceLevel($data['serviceLevel']); - unset($data['serviceLevel']); - } - if (\array_key_exists('serviceLevelDescription', $data)) { - $object->setServiceLevelDescription($data['serviceLevelDescription']); - unset($data['serviceLevelDescription']); - } - if (\array_key_exists('shipDate', $data)) { - $object->setShipDate($data['shipDate']); - unset($data['shipDate']); - } - if (\array_key_exists('deliveryDate', $data)) { - $object->setDeliveryDate($data['deliveryDate']); - unset($data['deliveryDate']); - } - if (\array_key_exists('commitTime', $data)) { - $object->setCommitTime($data['commitTime']); - unset($data['commitTime']); - } - if (\array_key_exists('deliveryTime', $data)) { - $object->setDeliveryTime($data['deliveryTime']); - unset($data['deliveryTime']); - } - if (\array_key_exists('deliveryDayOfWeek', $data)) { - $object->setDeliveryDayOfWeek($data['deliveryDayOfWeek']); - unset($data['deliveryDayOfWeek']); - } - if (\array_key_exists('nextDayPickupIndicator', $data)) { - $object->setNextDayPickupIndicator($data['nextDayPickupIndicator']); - unset($data['nextDayPickupIndicator']); - } - if (\array_key_exists('saturdayPickupIndicator', $data)) { - $object->setSaturdayPickupIndicator($data['saturdayPickupIndicator']); - unset($data['saturdayPickupIndicator']); - } - if (\array_key_exists('saturdayDeliveryDate', $data)) { - $object->setSaturdayDeliveryDate($data['saturdayDeliveryDate']); - unset($data['saturdayDeliveryDate']); - } - if (\array_key_exists('saturdayDeliveryTime', $data)) { - $object->setSaturdayDeliveryTime($data['saturdayDeliveryTime']); - unset($data['saturdayDeliveryTime']); - } - if (\array_key_exists('serviceRemarksText', $data)) { - $object->setServiceRemarksText($data['serviceRemarksText']); - unset($data['serviceRemarksText']); - } - if (\array_key_exists('guaranteeIndicator', $data)) { - $object->setGuaranteeIndicator($data['guaranteeIndicator']); - unset($data['guaranteeIndicator']); - } - if (\array_key_exists('totalTransitDays', $data)) { - $object->setTotalTransitDays($data['totalTransitDays']); - unset($data['totalTransitDays']); - } - if (\array_key_exists('businessTransitDays', $data)) { - $object->setBusinessTransitDays($data['businessTransitDays']); - unset($data['businessTransitDays']); - } - if (\array_key_exists('restDaysCount', $data)) { - $object->setRestDaysCount($data['restDaysCount']); - unset($data['restDaysCount']); - } - if (\array_key_exists('holidayCount', $data)) { - $object->setHolidayCount($data['holidayCount']); - unset($data['holidayCount']); - } - if (\array_key_exists('delayCount', $data)) { - $object->setDelayCount($data['delayCount']); - unset($data['delayCount']); - } - if (\array_key_exists('pickupDate', $data)) { - $object->setPickupDate($data['pickupDate']); - unset($data['pickupDate']); - } - if (\array_key_exists('pickupTime', $data)) { - $object->setPickupTime($data['pickupTime']); - unset($data['pickupTime']); - } - if (\array_key_exists('cstccutoffTime', $data)) { - $object->setCstccutoffTime($data['cstccutoffTime']); - unset($data['cstccutoffTime']); - } - if (\array_key_exists('poddate', $data)) { - $object->setPoddate($data['poddate']); - unset($data['poddate']); - } - if (\array_key_exists('poddays', $data)) { - $object->setPoddays($data['poddays']); - unset($data['poddays']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['serviceLevel'] = $data->getServiceLevel(); + $dataArray['serviceLevelDescription'] = $data->getServiceLevelDescription(); + $dataArray['shipDate'] = $data->getShipDate(); + $dataArray['deliveryDate'] = $data->getDeliveryDate(); + $dataArray['commitTime'] = $data->getCommitTime(); + $dataArray['deliveryTime'] = $data->getDeliveryTime(); + $dataArray['deliveryDayOfWeek'] = $data->getDeliveryDayOfWeek(); + $dataArray['nextDayPickupIndicator'] = $data->getNextDayPickupIndicator(); + $dataArray['saturdayPickupIndicator'] = $data->getSaturdayPickupIndicator(); + if ($data->isInitialized('saturdayDeliveryDate') && null !== $data->getSaturdayDeliveryDate()) { + $dataArray['saturdayDeliveryDate'] = $data->getSaturdayDeliveryDate(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['serviceLevel'] = $object->getServiceLevel(); - $data['serviceLevelDescription'] = $object->getServiceLevelDescription(); - $data['shipDate'] = $object->getShipDate(); - $data['deliveryDate'] = $object->getDeliveryDate(); - $data['commitTime'] = $object->getCommitTime(); - $data['deliveryTime'] = $object->getDeliveryTime(); - $data['deliveryDayOfWeek'] = $object->getDeliveryDayOfWeek(); - $data['nextDayPickupIndicator'] = $object->getNextDayPickupIndicator(); - $data['saturdayPickupIndicator'] = $object->getSaturdayPickupIndicator(); - if ($object->isInitialized('saturdayDeliveryDate') && null !== $object->getSaturdayDeliveryDate()) { - $data['saturdayDeliveryDate'] = $object->getSaturdayDeliveryDate(); - } - if ($object->isInitialized('saturdayDeliveryTime') && null !== $object->getSaturdayDeliveryTime()) { - $data['saturdayDeliveryTime'] = $object->getSaturdayDeliveryTime(); - } - if ($object->isInitialized('serviceRemarksText') && null !== $object->getServiceRemarksText()) { - $data['serviceRemarksText'] = $object->getServiceRemarksText(); - } - $data['guaranteeIndicator'] = $object->getGuaranteeIndicator(); - $data['totalTransitDays'] = $object->getTotalTransitDays(); - $data['businessTransitDays'] = $object->getBusinessTransitDays(); - $data['restDaysCount'] = $object->getRestDaysCount(); - $data['holidayCount'] = $object->getHolidayCount(); - $data['delayCount'] = $object->getDelayCount(); - $data['pickupDate'] = $object->getPickupDate(); - $data['pickupTime'] = $object->getPickupTime(); - $data['cstccutoffTime'] = $object->getCstccutoffTime(); - if ($object->isInitialized('poddate') && null !== $object->getPoddate()) { - $data['poddate'] = $object->getPoddate(); - } - if ($object->isInitialized('poddays') && null !== $object->getPoddays()) { - $data['poddays'] = $object->getPoddays(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('saturdayDeliveryTime') && null !== $data->getSaturdayDeliveryTime()) { + $dataArray['saturdayDeliveryTime'] = $data->getSaturdayDeliveryTime(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Services::class => false]; + if ($data->isInitialized('serviceRemarksText') && null !== $data->getServiceRemarksText()) { + $dataArray['serviceRemarksText'] = $data->getServiceRemarksText(); } + $dataArray['guaranteeIndicator'] = $data->getGuaranteeIndicator(); + $dataArray['totalTransitDays'] = $data->getTotalTransitDays(); + $dataArray['businessTransitDays'] = $data->getBusinessTransitDays(); + $dataArray['restDaysCount'] = $data->getRestDaysCount(); + $dataArray['holidayCount'] = $data->getHolidayCount(); + $dataArray['delayCount'] = $data->getDelayCount(); + $dataArray['pickupDate'] = $data->getPickupDate(); + $dataArray['pickupTime'] = $data->getPickupTime(); + $dataArray['cstccutoffTime'] = $data->getCstccutoffTime(); + if ($data->isInitialized('poddate') && null !== $data->getPoddate()) { + $dataArray['poddate'] = $data->getPoddate(); + } + if ($data->isInitialized('poddays') && null !== $data->getPoddays()) { + $dataArray['poddays'] = $data->getPoddays(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Services::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipFromAddressNormalizer.php b/src/Api/Normalizer/ShipFromAddressNormalizer.php index f3600dd6..208fa480 100644 --- a/src/Api/Normalizer/ShipFromAddressNormalizer.php +++ b/src/Api/Normalizer/ShipFromAddressNormalizer.php @@ -5,202 +5,100 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipFromAddress::class; + return $type === \ShipStream\Ups\Api\Model\ShipFromAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipFromAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipFromAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipFromAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipFromAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); + if (\array_key_exists('AddressLine', $data)) { + $values = []; + foreach ($data['AddressLine'] as $value) { + $values[] = $value; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipFromAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } - } -} else { - class ShipFromAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipFromAddress::class; + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipFromAddress::class; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipFromAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('addressLine') && null !== $data->getAddressLine()) { + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - return $data; + $dataArray['AddressLine'] = $values; + } + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); + } + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipFromAddress::class => false]; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } + if ($data->isInitialized('countryCode') && null !== $data->getCountryCode()) { + $dataArray['CountryCode'] = $data->getCountryCode(); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipFromAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipFromPhoneNormalizer.php b/src/Api/Normalizer/ShipFromPhoneNormalizer.php index bb81fccc..49de7ced 100644 --- a/src/Api/Normalizer/ShipFromPhoneNormalizer.php +++ b/src/Api/Normalizer/ShipFromPhoneNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipFromPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipFromPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipFromPhone::class; + return $type === \ShipStream\Ups\Api\Model\ShipFromPhone::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipFromPhone::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipFromPhone::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipFromPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipFromPhone(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Extension', $data)) { + $object->setExtension($data['Extension']); + unset($data['Extension']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipFromPhone::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipFromPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipFromPhone::class; + $dataArray = []; + $dataArray['Number'] = $data->getNumber(); + if ($data->isInitialized('extension') && null !== $data->getExtension()) { + $dataArray['Extension'] = $data->getExtension(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipFromPhone::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipFromPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipFromPhone::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipFromPhone::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipFromTaxIDTypeNormalizer.php b/src/Api/Normalizer/ShipFromTaxIDTypeNormalizer.php index 81e8ba7f..8d41ddf3 100644 --- a/src/Api/Normalizer/ShipFromTaxIDTypeNormalizer.php +++ b/src/Api/Normalizer/ShipFromTaxIDTypeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipFromTaxIDTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipFromTaxIDTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class; + return $type === \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipFromTaxIDType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipFromTaxIDType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipFromTaxIDType::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipFromTaxIDTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipFromTaxIDType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipFromTaxIDType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipFromTaxIDType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipFromVendorInfoNormalizer.php b/src/Api/Normalizer/ShipFromVendorInfoNormalizer.php index c645b77c..6c56c21b 100644 --- a/src/Api/Normalizer/ShipFromVendorInfoNormalizer.php +++ b/src/Api/Normalizer/ShipFromVendorInfoNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipFromVendorInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipFromVendorInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class; + return $type === \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipFromVendorInfo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('VendorCollectIDTypeCode', $data)) { - $object->setVendorCollectIDTypeCode($data['VendorCollectIDTypeCode']); - unset($data['VendorCollectIDTypeCode']); - } - if (\array_key_exists('VendorCollectIDNumber', $data)) { - $object->setVendorCollectIDNumber($data['VendorCollectIDNumber']); - unset($data['VendorCollectIDNumber']); - } - if (\array_key_exists('ConsigneeType', $data)) { - $object->setConsigneeType($data['ConsigneeType']); - unset($data['ConsigneeType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipFromVendorInfo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['VendorCollectIDTypeCode'] = $object->getVendorCollectIDTypeCode(); - $data['VendorCollectIDNumber'] = $object->getVendorCollectIDNumber(); - if ($object->isInitialized('consigneeType') && null !== $object->getConsigneeType()) { - $data['ConsigneeType'] = $object->getConsigneeType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipFromVendorInfo::class => false]; + if (\array_key_exists('VendorCollectIDTypeCode', $data)) { + $object->setVendorCollectIDTypeCode($data['VendorCollectIDTypeCode']); + unset($data['VendorCollectIDTypeCode']); } - } -} else { - class ShipFromVendorInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class; + if (\array_key_exists('VendorCollectIDNumber', $data)) { + $object->setVendorCollectIDNumber($data['VendorCollectIDNumber']); + unset($data['VendorCollectIDNumber']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class; + if (\array_key_exists('ConsigneeType', $data)) { + $object->setConsigneeType($data['ConsigneeType']); + unset($data['ConsigneeType']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipFromVendorInfo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('VendorCollectIDTypeCode', $data)) { - $object->setVendorCollectIDTypeCode($data['VendorCollectIDTypeCode']); - unset($data['VendorCollectIDTypeCode']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('VendorCollectIDNumber', $data)) { - $object->setVendorCollectIDNumber($data['VendorCollectIDNumber']); - unset($data['VendorCollectIDNumber']); - } - if (\array_key_exists('ConsigneeType', $data)) { - $object->setConsigneeType($data['ConsigneeType']); - unset($data['ConsigneeType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['VendorCollectIDTypeCode'] = $object->getVendorCollectIDTypeCode(); - $data['VendorCollectIDNumber'] = $object->getVendorCollectIDNumber(); - if ($object->isInitialized('consigneeType') && null !== $object->getConsigneeType()) { - $data['ConsigneeType'] = $object->getConsigneeType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['VendorCollectIDTypeCode'] = $data->getVendorCollectIDTypeCode(); + $dataArray['VendorCollectIDNumber'] = $data->getVendorCollectIDNumber(); + if ($data->isInitialized('consigneeType') && null !== $data->getConsigneeType()) { + $dataArray['ConsigneeType'] = $data->getConsigneeType(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipFromVendorInfo::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipFromVendorInfo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipToAddressNormalizer.php b/src/Api/Normalizer/ShipToAddressNormalizer.php index b789e494..0d41dba1 100644 --- a/src/Api/Normalizer/ShipToAddressNormalizer.php +++ b/src/Api/Normalizer/ShipToAddressNormalizer.php @@ -5,204 +5,101 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipToAddress::class; + return $type === \ShipStream\Ups\Api\Model\ShipToAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipToAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipToAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialAddressIndicator', $data)) { - $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); - unset($data['ResidentialAddressIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipToAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - if ($object->isInitialized('residentialAddressIndicator') && null !== $object->getResidentialAddressIndicator()) { - $data['ResidentialAddressIndicator'] = $object->getResidentialAddressIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipToAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + if (\array_key_exists('ResidentialAddressIndicator', $data)) { + $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); + unset($data['ResidentialAddressIndicator']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class ShipToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipToAddress::class; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipToAddress::class; + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - if (\array_key_exists('ResidentialAddressIndicator', $data)) { - $object->setResidentialAddressIndicator($data['ResidentialAddressIndicator']); - unset($data['ResidentialAddressIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - if ($object->isInitialized('residentialAddressIndicator') && null !== $object->getResidentialAddressIndicator()) { - $data['ResidentialAddressIndicator'] = $object->getResidentialAddressIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $dataArray['CountryCode'] = $data->getCountryCode(); + if ($data->isInitialized('residentialAddressIndicator') && null !== $data->getResidentialAddressIndicator()) { + $dataArray['ResidentialAddressIndicator'] = $data->getResidentialAddressIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipToAddress::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipToAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipToPhoneNormalizer.php b/src/Api/Normalizer/ShipToPhoneNormalizer.php index 17c7317e..b30ac263 100644 --- a/src/Api/Normalizer/ShipToPhoneNormalizer.php +++ b/src/Api/Normalizer/ShipToPhoneNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipToPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipToPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipToPhone::class; + return $type === \ShipStream\Ups\Api\Model\ShipToPhone::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipToPhone::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipToPhone::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipToPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipToPhone(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Extension', $data)) { + $object->setExtension($data['Extension']); + unset($data['Extension']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipToPhone::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipToPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipToPhone::class; + $dataArray = []; + $dataArray['Number'] = $data->getNumber(); + if ($data->isInitialized('extension') && null !== $data->getExtension()) { + $dataArray['Extension'] = $data->getExtension(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipToPhone::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipToPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipToPhone::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipToPhone::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentAlternateDeliveryAddressNormalizer.php b/src/Api/Normalizer/ShipmentAlternateDeliveryAddressNormalizer.php index 630f7cf2..523f4b1d 100644 --- a/src/Api/Normalizer/ShipmentAlternateDeliveryAddressNormalizer.php +++ b/src/Api/Normalizer/ShipmentAlternateDeliveryAddressNormalizer.php @@ -5,160 +5,79 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentAlternateDeliveryAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentAlternateDeliveryAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('UPSAccessPointID', $data)) { - $object->setUPSAccessPointID($data['UPSAccessPointID']); - unset($data['UPSAccessPointID']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - $data['AttentionName'] = $object->getAttentionName(); - if ($object->isInitialized('uPSAccessPointID') && null !== $object->getUPSAccessPointID()) { - $data['UPSAccessPointID'] = $object->getUPSAccessPointID(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class => false]; + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); } - } -} else { - class ShipmentAlternateDeliveryAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class; + if (\array_key_exists('UPSAccessPointID', $data)) { + $object->setUPSAccessPointID($data['UPSAccessPointID']); + unset($data['UPSAccessPointID']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class, 'json', $context)); + unset($data['Address']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('UPSAccessPointID', $data)) { - $object->setUPSAccessPointID($data['UPSAccessPointID']); - unset($data['UPSAccessPointID']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\AlternateDeliveryAddressAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - $data['AttentionName'] = $object->getAttentionName(); - if ($object->isInitialized('uPSAccessPointID') && null !== $object->getUPSAccessPointID()) { - $data['UPSAccessPointID'] = $object->getUPSAccessPointID(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Name'] = $data->getName(); + $dataArray['AttentionName'] = $data->getAttentionName(); + if ($data->isInitialized('uPSAccessPointID') && null !== $data->getUPSAccessPointID()) { + $dataArray['UPSAccessPointID'] = $data->getUPSAccessPointID(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class => false]; + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentChargeBillReceiverNormalizer.php b/src/Api/Normalizer/ShipmentChargeBillReceiverNormalizer.php index 2796e348..38e235c3 100644 --- a/src/Api/Normalizer/ShipmentChargeBillReceiverNormalizer.php +++ b/src/Api/Normalizer/ShipmentChargeBillReceiverNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentChargeBillReceiverNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentChargeBillReceiverNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\BillReceiverAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AccountNumber'] = $object->getAccountNumber(); - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AccountNumber', $data)) { + $object->setAccountNumber($data['AccountNumber']); + unset($data['AccountNumber']); + } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\BillReceiverAddress::class, 'json', $context)); + unset($data['Address']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentChargeBillReceiverNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class; + $dataArray = []; + $dataArray['AccountNumber'] = $data->getAccountNumber(); + if ($data->isInitialized('address') && null !== $data->getAddress()) { + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\BillReceiverAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AccountNumber'] = $object->getAccountNumber(); - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentChargeBillReceiver::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentChargeBillShipperNormalizer.php b/src/Api/Normalizer/ShipmentChargeBillShipperNormalizer.php index 833d584c..29851ba2 100644 --- a/src/Api/Normalizer/ShipmentChargeBillShipperNormalizer.php +++ b/src/Api/Normalizer/ShipmentChargeBillShipperNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentChargeBillShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentChargeBillShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('CreditCard', $data)) { - $object->setCreditCard($this->denormalizer->denormalize($data['CreditCard'], \ShipStream\Ups\Api\Model\BillShipperCreditCard::class, 'json', $context)); - unset($data['CreditCard']); - } - if (\array_key_exists('AlternatePaymentMethod', $data)) { - $object->setAlternatePaymentMethod($data['AlternatePaymentMethod']); - unset($data['AlternatePaymentMethod']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('accountNumber') && null !== $object->getAccountNumber()) { - $data['AccountNumber'] = $object->getAccountNumber(); - } - if ($object->isInitialized('creditCard') && null !== $object->getCreditCard()) { - $data['CreditCard'] = $this->normalizer->normalize($object->getCreditCard(), 'json', $context); - } - if ($object->isInitialized('alternatePaymentMethod') && null !== $object->getAlternatePaymentMethod()) { - $data['AlternatePaymentMethod'] = $object->getAlternatePaymentMethod(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AccountNumber', $data)) { + $object->setAccountNumber($data['AccountNumber']); + unset($data['AccountNumber']); + } + if (\array_key_exists('CreditCard', $data)) { + $object->setCreditCard($this->denormalizer->denormalize($data['CreditCard'], \ShipStream\Ups\Api\Model\BillShipperCreditCard::class, 'json', $context)); + unset($data['CreditCard']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class => false]; + if (\array_key_exists('AlternatePaymentMethod', $data)) { + $object->setAlternatePaymentMethod($data['AlternatePaymentMethod']); + unset($data['AlternatePaymentMethod']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentChargeBillShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class; + $dataArray = []; + if ($data->isInitialized('accountNumber') && null !== $data->getAccountNumber()) { + $dataArray['AccountNumber'] = $data->getAccountNumber(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class; + if ($data->isInitialized('creditCard') && null !== $data->getCreditCard()) { + $dataArray['CreditCard'] = $this->normalizer->normalize($data->getCreditCard(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargeBillShipper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('CreditCard', $data)) { - $object->setCreditCard($this->denormalizer->denormalize($data['CreditCard'], \ShipStream\Ups\Api\Model\BillShipperCreditCard::class, 'json', $context)); - unset($data['CreditCard']); - } - if (\array_key_exists('AlternatePaymentMethod', $data)) { - $object->setAlternatePaymentMethod($data['AlternatePaymentMethod']); - unset($data['AlternatePaymentMethod']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('alternatePaymentMethod') && null !== $data->getAlternatePaymentMethod()) { + $dataArray['AlternatePaymentMethod'] = $data->getAlternatePaymentMethod(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('accountNumber') && null !== $object->getAccountNumber()) { - $data['AccountNumber'] = $object->getAccountNumber(); - } - if ($object->isInitialized('creditCard') && null !== $object->getCreditCard()) { - $data['CreditCard'] = $this->normalizer->normalize($object->getCreditCard(), 'json', $context); - } - if ($object->isInitialized('alternatePaymentMethod') && null !== $object->getAlternatePaymentMethod()) { - $data['AlternatePaymentMethod'] = $object->getAlternatePaymentMethod(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentChargeBillShipper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentChargeBillThirdPartyNormalizer.php b/src/Api/Normalizer/ShipmentChargeBillThirdPartyNormalizer.php index 3f3c8bb5..cbf20dd4 100644 --- a/src/Api/Normalizer/ShipmentChargeBillThirdPartyNormalizer.php +++ b/src/Api/Normalizer/ShipmentChargeBillThirdPartyNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentChargeBillThirdPartyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentChargeBillThirdPartyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('CertifiedElectronicMail', $data)) { - $object->setCertifiedElectronicMail($data['CertifiedElectronicMail']); - unset($data['CertifiedElectronicMail']); - } - if (\array_key_exists('InterchangeSystemCode', $data)) { - $object->setInterchangeSystemCode($data['InterchangeSystemCode']); - unset($data['InterchangeSystemCode']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('accountNumber') && null !== $object->getAccountNumber()) { - $data['AccountNumber'] = $object->getAccountNumber(); - } - if ($object->isInitialized('certifiedElectronicMail') && null !== $object->getCertifiedElectronicMail()) { - $data['CertifiedElectronicMail'] = $object->getCertifiedElectronicMail(); - } - if ($object->isInitialized('interchangeSystemCode') && null !== $object->getInterchangeSystemCode()) { - $data['InterchangeSystemCode'] = $object->getInterchangeSystemCode(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AccountNumber', $data)) { + $object->setAccountNumber($data['AccountNumber']); + unset($data['AccountNumber']); + } + if (\array_key_exists('CertifiedElectronicMail', $data)) { + $object->setCertifiedElectronicMail($data['CertifiedElectronicMail']); + unset($data['CertifiedElectronicMail']); + } + if (\array_key_exists('InterchangeSystemCode', $data)) { + $object->setInterchangeSystemCode($data['InterchangeSystemCode']); + unset($data['InterchangeSystemCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class => false]; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class, 'json', $context)); + unset($data['Address']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentChargeBillThirdPartyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class; + $dataArray = []; + if ($data->isInitialized('accountNumber') && null !== $data->getAccountNumber()) { + $dataArray['AccountNumber'] = $data->getAccountNumber(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class; + if ($data->isInitialized('certifiedElectronicMail') && null !== $data->getCertifiedElectronicMail()) { + $dataArray['CertifiedElectronicMail'] = $data->getCertifiedElectronicMail(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('CertifiedElectronicMail', $data)) { - $object->setCertifiedElectronicMail($data['CertifiedElectronicMail']); - unset($data['CertifiedElectronicMail']); - } - if (\array_key_exists('InterchangeSystemCode', $data)) { - $object->setInterchangeSystemCode($data['InterchangeSystemCode']); - unset($data['InterchangeSystemCode']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\BillThirdPartyAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('interchangeSystemCode') && null !== $data->getInterchangeSystemCode()) { + $dataArray['InterchangeSystemCode'] = $data->getInterchangeSystemCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('accountNumber') && null !== $object->getAccountNumber()) { - $data['AccountNumber'] = $object->getAccountNumber(); - } - if ($object->isInitialized('certifiedElectronicMail') && null !== $object->getCertifiedElectronicMail()) { - $data['CertifiedElectronicMail'] = $object->getCertifiedElectronicMail(); - } - if ($object->isInitialized('interchangeSystemCode') && null !== $object->getInterchangeSystemCode()) { - $data['InterchangeSystemCode'] = $object->getInterchangeSystemCode(); + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentChargeBillThirdParty::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentChargesBaseServiceChargeNormalizer.php b/src/Api/Normalizer/ShipmentChargesBaseServiceChargeNormalizer.php index ad09846f..60774bea 100644 --- a/src/Api/Normalizer/ShipmentChargesBaseServiceChargeNormalizer.php +++ b/src/Api/Normalizer/ShipmentChargesBaseServiceChargeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentChargesBaseServiceChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentChargesBaseServiceChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class => false]; - } - } -} else { - class ShipmentChargesBaseServiceChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentChargesItemizedChargesNormalizer.php b/src/Api/Normalizer/ShipmentChargesItemizedChargesNormalizer.php index 9a83c5bb..f5f98778 100644 --- a/src/Api/Normalizer/ShipmentChargesItemizedChargesNormalizer.php +++ b/src/Api/Normalizer/ShipmentChargesItemizedChargesNormalizer.php @@ -5,174 +5,86 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentChargesItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentChargesItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('SubType', $data)) { - $object->setSubType($data['SubType']); - unset($data['SubType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - if ($object->isInitialized('subType') && null !== $object->getSubType()) { - $data['SubType'] = $object->getSubType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class => false]; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - } -} else { - class ShipmentChargesItemizedChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - if (\array_key_exists('SubType', $data)) { - $object->setSubType($data['SubType']); - unset($data['SubType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('SubType', $data)) { + $object->setSubType($data['SubType']); + unset($data['SubType']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - if ($object->isInitialized('subType') && null !== $object->getSubType()) { - $data['SubType'] = $object->getSubType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); + } + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + if ($data->isInitialized('subType') && null !== $data->getSubType()) { + $dataArray['SubType'] = $data->getSubType(); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentChargesServiceOptionsChargesNormalizer.php b/src/Api/Normalizer/ShipmentChargesServiceOptionsChargesNormalizer.php index 0148d184..7efa881b 100644 --- a/src/Api/Normalizer/ShipmentChargesServiceOptionsChargesNormalizer.php +++ b/src/Api/Normalizer/ShipmentChargesServiceOptionsChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentChargesServiceOptionsChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentChargesServiceOptionsChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class => false]; - } - } -} else { - class ShipmentChargesServiceOptionsChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentChargesTaxChargesNormalizer.php b/src/Api/Normalizer/ShipmentChargesTaxChargesNormalizer.php index e9cfb005..d1a4b7fb 100644 --- a/src/Api/Normalizer/ShipmentChargesTaxChargesNormalizer.php +++ b/src/Api/Normalizer/ShipmentChargesTaxChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentChargesTaxChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentChargesTaxChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $object->getType(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class => false]; - } - } -} else { - class ShipmentChargesTaxChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class; + if (\array_key_exists('Type', $data)) { + $object->setType($data['Type']); + unset($data['Type']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $object->getType(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Type'] = $data->getType(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentChargesTotalChargesNormalizer.php b/src/Api/Normalizer/ShipmentChargesTotalChargesNormalizer.php index d93bb8f2..0d7b7475 100644 --- a/src/Api/Normalizer/ShipmentChargesTotalChargesNormalizer.php +++ b/src/Api/Normalizer/ShipmentChargesTotalChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentChargesTotalChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentChargesTotalChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class => false]; - } - } -} else { - class ShipmentChargesTotalChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentChargesTotalChargesWithTaxesNormalizer.php b/src/Api/Normalizer/ShipmentChargesTotalChargesWithTaxesNormalizer.php index f1e84912..949994ad 100644 --- a/src/Api/Normalizer/ShipmentChargesTotalChargesWithTaxesNormalizer.php +++ b/src/Api/Normalizer/ShipmentChargesTotalChargesWithTaxesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentChargesTotalChargesWithTaxesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentChargesTotalChargesWithTaxesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class => false]; - } - } -} else { - class ShipmentChargesTotalChargesWithTaxesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentChargesTransportationChargesNormalizer.php b/src/Api/Normalizer/ShipmentChargesTransportationChargesNormalizer.php index 4ef02db9..a42b5fba 100644 --- a/src/Api/Normalizer/ShipmentChargesTransportationChargesNormalizer.php +++ b/src/Api/Normalizer/ShipmentChargesTransportationChargesNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentChargesTransportationChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentChargesTransportationChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class => false]; - } - } -} else { - class ShipmentChargesTransportationChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentCommodityNormalizer.php b/src/Api/Normalizer/ShipmentCommodityNormalizer.php index 737c900b..60f2dfaf 100644 --- a/src/Api/Normalizer/ShipmentCommodityNormalizer.php +++ b/src/Api/Normalizer/ShipmentCommodityNormalizer.php @@ -5,266 +5,132 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentCommodity::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentCommodity::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentCommodity::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentCommodity::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentCommodity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CommodityID', $data)) { - $object->setCommodityID($data['CommodityID']); - unset($data['CommodityID']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('NumberOfPieces', $data)) { - $object->setNumberOfPieces($data['NumberOfPieces']); - unset($data['NumberOfPieces']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\CommodityPackagingType::class, 'json', $context)); - unset($data['PackagingType']); - } - if (\array_key_exists('DangerousGoodsIndicator', $data)) { - $object->setDangerousGoodsIndicator($data['DangerousGoodsIndicator']); - unset($data['DangerousGoodsIndicator']); - } - if (\array_key_exists('CommodityValue', $data)) { - $object->setCommodityValue($data['CommodityValue']); - unset($data['CommodityValue']); - } - if (\array_key_exists('FreightClass', $data)) { - $object->setFreightClass($data['FreightClass']); - unset($data['FreightClass']); - } - if (\array_key_exists('NMFCCommodityCode', $data)) { - $object->setNMFCCommodityCode($data['NMFCCommodityCode']); - unset($data['NMFCCommodityCode']); - } - if (\array_key_exists('NMFCCommodity', $data)) { - $object->setNMFCCommodity($this->denormalizer->denormalize($data['NMFCCommodity'], \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class, 'json', $context)); - unset($data['NMFCCommodity']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentCommodity(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('commodityID') && null !== $object->getCommodityID()) { - $data['CommodityID'] = $object->getCommodityID(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['Weight'] = $object->getWeight(); - } - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - if ($object->isInitialized('numberOfPieces') && null !== $object->getNumberOfPieces()) { - $data['NumberOfPieces'] = $object->getNumberOfPieces(); - } - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $this->normalizer->normalize($object->getPackagingType(), 'json', $context); - } - if ($object->isInitialized('dangerousGoodsIndicator') && null !== $object->getDangerousGoodsIndicator()) { - $data['DangerousGoodsIndicator'] = $object->getDangerousGoodsIndicator(); - } - if ($object->isInitialized('commodityValue') && null !== $object->getCommodityValue()) { - $data['CommodityValue'] = $object->getCommodityValue(); - } - $data['FreightClass'] = $object->getFreightClass(); - if ($object->isInitialized('nMFCCommodityCode') && null !== $object->getNMFCCommodityCode()) { - $data['NMFCCommodityCode'] = $object->getNMFCCommodityCode(); - } - if ($object->isInitialized('nMFCCommodity') && null !== $object->getNMFCCommodity()) { - $data['NMFCCommodity'] = $this->normalizer->normalize($object->getNMFCCommodity(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CommodityID', $data)) { + $object->setCommodityID($data['CommodityID']); + unset($data['CommodityID']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); + } + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); + } + if (\array_key_exists('Dimensions', $data)) { + $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class, 'json', $context)); + unset($data['Dimensions']); + } + if (\array_key_exists('NumberOfPieces', $data)) { + $object->setNumberOfPieces($data['NumberOfPieces']); + unset($data['NumberOfPieces']); + } + if (\array_key_exists('PackagingType', $data)) { + $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\CommodityPackagingType::class, 'json', $context)); + unset($data['PackagingType']); + } + if (\array_key_exists('DangerousGoodsIndicator', $data)) { + $object->setDangerousGoodsIndicator($data['DangerousGoodsIndicator']); + unset($data['DangerousGoodsIndicator']); + } + if (\array_key_exists('CommodityValue', $data)) { + $object->setCommodityValue($data['CommodityValue']); + unset($data['CommodityValue']); + } + if (\array_key_exists('FreightClass', $data)) { + $object->setFreightClass($data['FreightClass']); + unset($data['FreightClass']); + } + if (\array_key_exists('NMFCCommodityCode', $data)) { + $object->setNMFCCommodityCode($data['NMFCCommodityCode']); + unset($data['NMFCCommodityCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentCommodity::class => false]; + if (\array_key_exists('NMFCCommodity', $data)) { + $object->setNMFCCommodity($this->denormalizer->denormalize($data['NMFCCommodity'], \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class, 'json', $context)); + unset($data['NMFCCommodity']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentCommodityNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentCommodity::class; + $dataArray = []; + if ($data->isInitialized('commodityID') && null !== $data->getCommodityID()) { + $dataArray['CommodityID'] = $data->getCommodityID(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentCommodity::class; + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentCommodity(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CommodityID', $data)) { - $object->setCommodityID($data['CommodityID']); - unset($data['CommodityID']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\FreightShipCommodityDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('NumberOfPieces', $data)) { - $object->setNumberOfPieces($data['NumberOfPieces']); - unset($data['NumberOfPieces']); - } - if (\array_key_exists('PackagingType', $data)) { - $object->setPackagingType($this->denormalizer->denormalize($data['PackagingType'], \ShipStream\Ups\Api\Model\CommodityPackagingType::class, 'json', $context)); - unset($data['PackagingType']); - } - if (\array_key_exists('DangerousGoodsIndicator', $data)) { - $object->setDangerousGoodsIndicator($data['DangerousGoodsIndicator']); - unset($data['DangerousGoodsIndicator']); - } - if (\array_key_exists('CommodityValue', $data)) { - $object->setCommodityValue($data['CommodityValue']); - unset($data['CommodityValue']); - } - if (\array_key_exists('FreightClass', $data)) { - $object->setFreightClass($data['FreightClass']); - unset($data['FreightClass']); - } - if (\array_key_exists('NMFCCommodityCode', $data)) { - $object->setNMFCCommodityCode($data['NMFCCommodityCode']); - unset($data['NMFCCommodityCode']); - } - if (\array_key_exists('NMFCCommodity', $data)) { - $object->setNMFCCommodity($this->denormalizer->denormalize($data['NMFCCommodity'], \ShipStream\Ups\Api\Model\CommodityNMFCCommodity::class, 'json', $context)); - unset($data['NMFCCommodity']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('weight') && null !== $data->getWeight()) { + $dataArray['Weight'] = $data->getWeight(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('commodityID') && null !== $object->getCommodityID()) { - $data['CommodityID'] = $object->getCommodityID(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['Weight'] = $object->getWeight(); - } - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - if ($object->isInitialized('numberOfPieces') && null !== $object->getNumberOfPieces()) { - $data['NumberOfPieces'] = $object->getNumberOfPieces(); - } - if ($object->isInitialized('packagingType') && null !== $object->getPackagingType()) { - $data['PackagingType'] = $this->normalizer->normalize($object->getPackagingType(), 'json', $context); - } - if ($object->isInitialized('dangerousGoodsIndicator') && null !== $object->getDangerousGoodsIndicator()) { - $data['DangerousGoodsIndicator'] = $object->getDangerousGoodsIndicator(); - } - if ($object->isInitialized('commodityValue') && null !== $object->getCommodityValue()) { - $data['CommodityValue'] = $object->getCommodityValue(); - } - $data['FreightClass'] = $object->getFreightClass(); - if ($object->isInitialized('nMFCCommodityCode') && null !== $object->getNMFCCommodityCode()) { - $data['NMFCCommodityCode'] = $object->getNMFCCommodityCode(); - } - if ($object->isInitialized('nMFCCommodity') && null !== $object->getNMFCCommodity()) { - $data['NMFCCommodity'] = $this->normalizer->normalize($object->getNMFCCommodity(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('dimensions') && null !== $data->getDimensions()) { + $dataArray['Dimensions'] = $this->normalizer->normalize($data->getDimensions(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentCommodity::class => false]; + if ($data->isInitialized('numberOfPieces') && null !== $data->getNumberOfPieces()) { + $dataArray['NumberOfPieces'] = $data->getNumberOfPieces(); } + if ($data->isInitialized('packagingType') && null !== $data->getPackagingType()) { + $dataArray['PackagingType'] = $this->normalizer->normalize($data->getPackagingType(), 'json', $context); + } + if ($data->isInitialized('dangerousGoodsIndicator') && null !== $data->getDangerousGoodsIndicator()) { + $dataArray['DangerousGoodsIndicator'] = $data->getDangerousGoodsIndicator(); + } + if ($data->isInitialized('commodityValue') && null !== $data->getCommodityValue()) { + $dataArray['CommodityValue'] = $data->getCommodityValue(); + } + $dataArray['FreightClass'] = $data->getFreightClass(); + if ($data->isInitialized('nMFCCommodityCode') && null !== $data->getNMFCCommodityCode()) { + $dataArray['NMFCCommodityCode'] = $data->getNMFCCommodityCode(); + } + if ($data->isInitialized('nMFCCommodity') && null !== $data->getNMFCCommodity()) { + $dataArray['NMFCCommodity'] = $this->normalizer->normalize($data->getNMFCCommodity(), 'json', $context); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentCommodity::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentDGSignatoryInfoNormalizer.php b/src/Api/Normalizer/ShipmentDGSignatoryInfoNormalizer.php index 67816bed..dbff3da3 100644 --- a/src/Api/Normalizer/ShipmentDGSignatoryInfoNormalizer.php +++ b/src/Api/Normalizer/ShipmentDGSignatoryInfoNormalizer.php @@ -5,200 +5,99 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentDGSignatoryInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentDGSignatoryInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Title', $data)) { - $object->setTitle($data['Title']); - unset($data['Title']); - } - if (\array_key_exists('Place', $data)) { - $object->setPlace($data['Place']); - unset($data['Place']); - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('ShipperDeclaration', $data)) { - $object->setShipperDeclaration($data['ShipperDeclaration']); - unset($data['ShipperDeclaration']); - } - if (\array_key_exists('UploadOnlyIndicator', $data)) { - $object->setUploadOnlyIndicator($data['UploadOnlyIndicator']); - unset($data['UploadOnlyIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('title') && null !== $object->getTitle()) { - $data['Title'] = $object->getTitle(); - } - if ($object->isInitialized('place') && null !== $object->getPlace()) { - $data['Place'] = $object->getPlace(); - } - if ($object->isInitialized('date') && null !== $object->getDate()) { - $data['Date'] = $object->getDate(); - } - if ($object->isInitialized('shipperDeclaration') && null !== $object->getShipperDeclaration()) { - $data['ShipperDeclaration'] = $object->getShipperDeclaration(); - } - if ($object->isInitialized('uploadOnlyIndicator') && null !== $object->getUploadOnlyIndicator()) { - $data['UploadOnlyIndicator'] = $object->getUploadOnlyIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('Title', $data)) { + $object->setTitle($data['Title']); + unset($data['Title']); + } + if (\array_key_exists('Place', $data)) { + $object->setPlace($data['Place']); + unset($data['Place']); + } + if (\array_key_exists('Date', $data)) { + $object->setDate($data['Date']); + unset($data['Date']); + } + if (\array_key_exists('ShipperDeclaration', $data)) { + $object->setShipperDeclaration($data['ShipperDeclaration']); + unset($data['ShipperDeclaration']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class => false]; + if (\array_key_exists('UploadOnlyIndicator', $data)) { + $object->setUploadOnlyIndicator($data['UploadOnlyIndicator']); + unset($data['UploadOnlyIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentDGSignatoryInfoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Title', $data)) { - $object->setTitle($data['Title']); - unset($data['Title']); - } - if (\array_key_exists('Place', $data)) { - $object->setPlace($data['Place']); - unset($data['Place']); - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('ShipperDeclaration', $data)) { - $object->setShipperDeclaration($data['ShipperDeclaration']); - unset($data['ShipperDeclaration']); - } - if (\array_key_exists('UploadOnlyIndicator', $data)) { - $object->setUploadOnlyIndicator($data['UploadOnlyIndicator']); - unset($data['UploadOnlyIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('name') && null !== $data->getName()) { + $dataArray['Name'] = $data->getName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['Name'] = $object->getName(); - } - if ($object->isInitialized('title') && null !== $object->getTitle()) { - $data['Title'] = $object->getTitle(); - } - if ($object->isInitialized('place') && null !== $object->getPlace()) { - $data['Place'] = $object->getPlace(); - } - if ($object->isInitialized('date') && null !== $object->getDate()) { - $data['Date'] = $object->getDate(); - } - if ($object->isInitialized('shipperDeclaration') && null !== $object->getShipperDeclaration()) { - $data['ShipperDeclaration'] = $object->getShipperDeclaration(); - } - if ($object->isInitialized('uploadOnlyIndicator') && null !== $object->getUploadOnlyIndicator()) { - $data['UploadOnlyIndicator'] = $object->getUploadOnlyIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('title') && null !== $data->getTitle()) { + $dataArray['Title'] = $data->getTitle(); + } + if ($data->isInitialized('place') && null !== $data->getPlace()) { + $dataArray['Place'] = $data->getPlace(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class => false]; + if ($data->isInitialized('date') && null !== $data->getDate()) { + $dataArray['Date'] = $data->getDate(); } + if ($data->isInitialized('shipperDeclaration') && null !== $data->getShipperDeclaration()) { + $dataArray['ShipperDeclaration'] = $data->getShipperDeclaration(); + } + if ($data->isInitialized('uploadOnlyIndicator') && null !== $data->getUploadOnlyIndicator()) { + $dataArray['UploadOnlyIndicator'] = $data->getUploadOnlyIndicator(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentDeliveryTimeInformationNormalizer.php b/src/Api/Normalizer/ShipmentDeliveryTimeInformationNormalizer.php index e3c96f3a..4b568c2e 100644 --- a/src/Api/Normalizer/ShipmentDeliveryTimeInformationNormalizer.php +++ b/src/Api/Normalizer/ShipmentDeliveryTimeInformationNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentDeliveryTimeInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentDeliveryTimeInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageBillType', $data)) { - $object->setPackageBillType($data['PackageBillType']); - unset($data['PackageBillType']); - } - if (\array_key_exists('Pickup', $data)) { - $object->setPickup($this->denormalizer->denormalize($data['Pickup'], \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class, 'json', $context)); - unset($data['Pickup']); - } - if (\array_key_exists('ReturnContractServices', $data)) { - $values = []; - foreach ($data['ReturnContractServices'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class, 'json', $context); - } - $object->setReturnContractServices($values); - unset($data['ReturnContractServices']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PackageBillType'] = $object->getPackageBillType(); - if ($object->isInitialized('pickup') && null !== $object->getPickup()) { - $data['Pickup'] = $this->normalizer->normalize($object->getPickup(), 'json', $context); - } - if ($object->isInitialized('returnContractServices') && null !== $object->getReturnContractServices()) { - $values = []; - foreach ($object->getReturnContractServices() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ReturnContractServices'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('PackageBillType', $data)) { + $object->setPackageBillType($data['PackageBillType']); + unset($data['PackageBillType']); + } + if (\array_key_exists('Pickup', $data)) { + $object->setPickup($this->denormalizer->denormalize($data['Pickup'], \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class, 'json', $context)); + unset($data['Pickup']); + } + if (\array_key_exists('ReturnContractServices', $data)) { + $values = []; + foreach ($data['ReturnContractServices'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class, 'json', $context); } - return $data; + $object->setReturnContractServices($values); + unset($data['ReturnContractServices']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class ShipmentDeliveryTimeInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class; + $dataArray = []; + $dataArray['PackageBillType'] = $data->getPackageBillType(); + if ($data->isInitialized('pickup') && null !== $data->getPickup()) { + $dataArray['Pickup'] = $this->normalizer->normalize($data->getPickup(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageBillType', $data)) { - $object->setPackageBillType($data['PackageBillType']); - unset($data['PackageBillType']); - } - if (\array_key_exists('Pickup', $data)) { - $object->setPickup($this->denormalizer->denormalize($data['Pickup'], \ShipStream\Ups\Api\Model\DeliveryTimeInformationPickup::class, 'json', $context)); - unset($data['Pickup']); - } - if (\array_key_exists('ReturnContractServices', $data)) { - $values = []; - foreach ($data['ReturnContractServices'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DeliveryTimeInformationReturnContractServices::class, 'json', $context); - } - $object->setReturnContractServices($values); - unset($data['ReturnContractServices']); + if ($data->isInitialized('returnContractServices') && null !== $data->getReturnContractServices()) { + $values = []; + foreach ($data->getReturnContractServices() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray['ReturnContractServices'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PackageBillType'] = $object->getPackageBillType(); - if ($object->isInitialized('pickup') && null !== $object->getPickup()) { - $data['Pickup'] = $this->normalizer->normalize($object->getPickup(), 'json', $context); - } - if ($object->isInitialized('returnContractServices') && null !== $object->getReturnContractServices()) { - $values = []; - foreach ($object->getReturnContractServices() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ReturnContractServices'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentDeliveryTimeInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentDetailPackagingTypeNormalizer.php b/src/Api/Normalizer/ShipmentDetailPackagingTypeNormalizer.php index 6f53bb36..69818519 100644 --- a/src/Api/Normalizer/ShipmentDetailPackagingTypeNormalizer.php +++ b/src/Api/Normalizer/ShipmentDetailPackagingTypeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentDetailPackagingTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentDetailPackagingTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentDetailPackagingTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentDetailPackagingType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentDetailPackagingType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentDetailPalletInformationNormalizer.php b/src/Api/Normalizer/ShipmentDetailPalletInformationNormalizer.php index e474348d..c6495871 100644 --- a/src/Api/Normalizer/ShipmentDetailPalletInformationNormalizer.php +++ b/src/Api/Normalizer/ShipmentDetailPalletInformationNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentDetailPalletInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentDetailPalletInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\PalletInformationDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Dimensions', $data)) { + $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\PalletInformationDimensions::class, 'json', $context)); + unset($data['Dimensions']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentDetailPalletInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class; + $dataArray = []; + if ($data->isInitialized('dimensions') && null !== $data->getDimensions()) { + $dataArray['Dimensions'] = $this->normalizer->normalize($data->getDimensions(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\PalletInformationDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentDetailPalletInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentDetailWeightNormalizer.php b/src/Api/Normalizer/ShipmentDetailWeightNormalizer.php index 86ab774b..4d67f018 100644 --- a/src/Api/Normalizer/ShipmentDetailWeightNormalizer.php +++ b/src/Api/Normalizer/ShipmentDetailWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentDetailWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentDetailWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentDetailWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentDetailWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentDetailWeight::class => false]; - } - } -} else { - class ShipmentDetailWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDetailWeight::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentDetailWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentDetailWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentDetailWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentDocumentsNormalizer.php b/src/Api/Normalizer/ShipmentDocumentsNormalizer.php index c5dcb06f..6a26672b 100644 --- a/src/Api/Normalizer/ShipmentDocumentsNormalizer.php +++ b/src/Api/Normalizer/ShipmentDocumentsNormalizer.php @@ -5,160 +5,79 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentDocumentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentDocumentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentDocuments::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentDocuments::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDocuments::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDocuments::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentDocuments(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Image', $data)) { - $values = []; - foreach ($data['Image'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DocumentsImage::class, 'json', $context); - } - $object->setImage($values); - unset($data['Image']); - } - if (\array_key_exists('PackingList', $data)) { - $object->setPackingList($this->denormalizer->denormalize($data['PackingList'], \ShipStream\Ups\Api\Model\DocumentsPackingList::class, 'json', $context)); - unset($data['PackingList']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentDocuments(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('image') && null !== $object->getImage()) { - $values = []; - foreach ($object->getImage() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Image'] = $values; - } - if ($object->isInitialized('packingList') && null !== $object->getPackingList()) { - $data['PackingList'] = $this->normalizer->normalize($object->getPackingList(), 'json', $context); + if (\array_key_exists('Image', $data)) { + $values = []; + foreach ($data['Image'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DocumentsImage::class, 'json', $context); } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setImage($values); + unset($data['Image']); + } + if (\array_key_exists('PackingList', $data)) { + $object->setPackingList($this->denormalizer->denormalize($data['PackingList'], \ShipStream\Ups\Api\Model\DocumentsPackingList::class, 'json', $context)); + unset($data['PackingList']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentDocuments::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class ShipmentDocumentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentDocuments::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentDocuments::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentDocuments(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Image', $data)) { - $values = []; - foreach ($data['Image'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DocumentsImage::class, 'json', $context); - } - $object->setImage($values); - unset($data['Image']); - } - if (\array_key_exists('PackingList', $data)) { - $object->setPackingList($this->denormalizer->denormalize($data['PackingList'], \ShipStream\Ups\Api\Model\DocumentsPackingList::class, 'json', $context)); - unset($data['PackingList']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + $dataArray = []; + if ($data->isInitialized('image') && null !== $data->getImage()) { + $values = []; + foreach ($data->getImage() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['Image'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('image') && null !== $object->getImage()) { - $values = []; - foreach ($object->getImage() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Image'] = $values; - } - if ($object->isInitialized('packingList') && null !== $object->getPackingList()) { - $data['PackingList'] = $this->normalizer->normalize($object->getPackingList(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('packingList') && null !== $data->getPackingList()) { + $dataArray['PackingList'] = $this->normalizer->normalize($data->getPackingList(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentDocuments::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentDocuments::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentExistingShipmentIDNormalizer.php b/src/Api/Normalizer/ShipmentExistingShipmentIDNormalizer.php index 97926606..0730cdde 100644 --- a/src/Api/Normalizer/ShipmentExistingShipmentIDNormalizer.php +++ b/src/Api/Normalizer/ShipmentExistingShipmentIDNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentExistingShipmentIDNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentExistingShipmentIDNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentNumber', $data)) { - $object->setShipmentNumber($data['ShipmentNumber']); - unset($data['ShipmentNumber']); - } - if (\array_key_exists('ConfirmationNumber', $data)) { - $object->setConfirmationNumber($this->denormalizer->denormalize($data['ConfirmationNumber'], \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class, 'json', $context)); - unset($data['ConfirmationNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ShipmentNumber'] = $object->getShipmentNumber(); - if ($object->isInitialized('confirmationNumber') && null !== $object->getConfirmationNumber()) { - $data['ConfirmationNumber'] = $this->normalizer->normalize($object->getConfirmationNumber(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ShipmentNumber', $data)) { + $object->setShipmentNumber($data['ShipmentNumber']); + unset($data['ShipmentNumber']); + } + if (\array_key_exists('ConfirmationNumber', $data)) { + $object->setConfirmationNumber($this->denormalizer->denormalize($data['ConfirmationNumber'], \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class, 'json', $context)); + unset($data['ConfirmationNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentExistingShipmentIDNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class; + $dataArray = []; + $dataArray['ShipmentNumber'] = $data->getShipmentNumber(); + if ($data->isInitialized('confirmationNumber') && null !== $data->getConfirmationNumber()) { + $dataArray['ConfirmationNumber'] = $this->normalizer->normalize($data->getConfirmationNumber(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentExistingShipmentID(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentNumber', $data)) { - $object->setShipmentNumber($data['ShipmentNumber']); - unset($data['ShipmentNumber']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('ConfirmationNumber', $data)) { - $object->setConfirmationNumber($this->denormalizer->denormalize($data['ConfirmationNumber'], \ShipStream\Ups\Api\Model\ExistingShipmentIDConfirmationNumber::class, 'json', $context)); - unset($data['ConfirmationNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ShipmentNumber'] = $object->getShipmentNumber(); - if ($object->isInitialized('confirmationNumber') && null !== $object->getConfirmationNumber()) { - $data['ConfirmationNumber'] = $this->normalizer->normalize($object->getConfirmationNumber(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentExistingShipmentID::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentFRSPaymentInformationNormalizer.php b/src/Api/Normalizer/ShipmentFRSPaymentInformationNormalizer.php index e104c76a..b0e5c30e 100644 --- a/src/Api/Normalizer/ShipmentFRSPaymentInformationNormalizer.php +++ b/src/Api/Normalizer/ShipmentFRSPaymentInformationNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentFRSPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentFRSPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['AccountNumber'] = $object->getAccountNumber(); - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class => false]; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class, 'json', $context)); + unset($data['Type']); } - } -} else { - class ShipmentFRSPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class; + if (\array_key_exists('AccountNumber', $data)) { + $object->setAccountNumber($data['AccountNumber']); + unset($data['AccountNumber']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class, 'json', $context)); + unset($data['Address']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\FRSPaymentInformationType::class, 'json', $context)); - unset($data['Type']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\FRSPaymentInformationAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['AccountNumber'] = $object->getAccountNumber(); - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + $dataArray['AccountNumber'] = $data->getAccountNumber(); + if ($data->isInitialized('address') && null !== $data->getAddress()) { + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentFreightShipmentInformationNormalizer.php b/src/Api/Normalizer/ShipmentFreightShipmentInformationNormalizer.php index 9eee5688..64042b90 100644 --- a/src/Api/Normalizer/ShipmentFreightShipmentInformationNormalizer.php +++ b/src/Api/Normalizer/ShipmentFreightShipmentInformationNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentFreightShipmentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentFreightShipmentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightDensityInfo', $data)) { - $object->setFreightDensityInfo($this->denormalizer->denormalize($data['FreightDensityInfo'], \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class, 'json', $context)); - unset($data['FreightDensityInfo']); - } - if (\array_key_exists('DensityEligibleIndicator', $data)) { - $object->setDensityEligibleIndicator($data['DensityEligibleIndicator']); - unset($data['DensityEligibleIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('freightDensityInfo') && null !== $object->getFreightDensityInfo()) { - $data['FreightDensityInfo'] = $this->normalizer->normalize($object->getFreightDensityInfo(), 'json', $context); - } - if ($object->isInitialized('densityEligibleIndicator') && null !== $object->getDensityEligibleIndicator()) { - $data['DensityEligibleIndicator'] = $object->getDensityEligibleIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('FreightDensityInfo', $data)) { + $object->setFreightDensityInfo($this->denormalizer->denormalize($data['FreightDensityInfo'], \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class, 'json', $context)); + unset($data['FreightDensityInfo']); + } + if (\array_key_exists('DensityEligibleIndicator', $data)) { + $object->setDensityEligibleIndicator($data['DensityEligibleIndicator']); + unset($data['DensityEligibleIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentFreightShipmentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class; + $dataArray = []; + if ($data->isInitialized('freightDensityInfo') && null !== $data->getFreightDensityInfo()) { + $dataArray['FreightDensityInfo'] = $this->normalizer->normalize($data->getFreightDensityInfo(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FreightDensityInfo', $data)) { - $object->setFreightDensityInfo($this->denormalizer->denormalize($data['FreightDensityInfo'], \ShipStream\Ups\Api\Model\FreightShipmentInformationFreightDensityInfo::class, 'json', $context)); - unset($data['FreightDensityInfo']); - } - if (\array_key_exists('DensityEligibleIndicator', $data)) { - $object->setDensityEligibleIndicator($data['DensityEligibleIndicator']); - unset($data['DensityEligibleIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('densityEligibleIndicator') && null !== $data->getDensityEligibleIndicator()) { + $dataArray['DensityEligibleIndicator'] = $data->getDensityEligibleIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('freightDensityInfo') && null !== $object->getFreightDensityInfo()) { - $data['FreightDensityInfo'] = $this->normalizer->normalize($object->getFreightDensityInfo(), 'json', $context); - } - if ($object->isInitialized('densityEligibleIndicator') && null !== $object->getDensityEligibleIndicator()) { - $data['DensityEligibleIndicator'] = $object->getDensityEligibleIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentHandlingUnitOneNormalizer.php b/src/Api/Normalizer/ShipmentHandlingUnitOneNormalizer.php index 6f47102e..3339b206 100644 --- a/src/Api/Normalizer/ShipmentHandlingUnitOneNormalizer.php +++ b/src/Api/Normalizer/ShipmentHandlingUnitOneNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentHandlingUnitOneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentHandlingUnitOneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitOneType::class, 'json', $context)); - unset($data['Type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class => false]; - } - } -} else { - class ShipmentHandlingUnitOneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class; + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitOneType::class, 'json', $context)); + unset($data['Type']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitOneType::class, 'json', $context)); - unset($data['Type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Quantity'] = $data->getQuantity(); + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentHandlingUnitOne::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentHandlingUnitTwoNormalizer.php b/src/Api/Normalizer/ShipmentHandlingUnitTwoNormalizer.php index d441574c..964606d3 100644 --- a/src/Api/Normalizer/ShipmentHandlingUnitTwoNormalizer.php +++ b/src/Api/Normalizer/ShipmentHandlingUnitTwoNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentHandlingUnitTwoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentHandlingUnitTwoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class, 'json', $context)); - unset($data['Type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class => false]; - } - } -} else { - class ShipmentHandlingUnitTwoNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class; + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class, 'json', $context)); + unset($data['Type']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitTwoType::class, 'json', $context)); - unset($data['Type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Quantity'] = $data->getQuantity(); + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentHandlingUnitTwo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentHandlingUnitsNormalizer.php b/src/Api/Normalizer/ShipmentHandlingUnitsNormalizer.php index 4929b56c..061c14d5 100644 --- a/src/Api/Normalizer/ShipmentHandlingUnitsNormalizer.php +++ b/src/Api/Normalizer/ShipmentHandlingUnitsNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentHandlingUnits(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentHandlingUnits(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class => false]; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); + unset($data['Type']); } - } -} else { - class ShipmentHandlingUnitsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class; + if (\array_key_exists('Dimensions', $data)) { + $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); + unset($data['Dimensions']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentHandlingUnits(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\HandlingUnitsType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\HandlingUnitsDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Quantity'] = $data->getQuantity(); + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + $dataArray['Dimensions'] = $this->normalizer->normalize($data->getDimensions(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentHandlingUnits::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentInvoiceLineTotalNormalizer.php b/src/Api/Normalizer/ShipmentInvoiceLineTotalNormalizer.php index f79bf97d..57f98720 100644 --- a/src/Api/Normalizer/ShipmentInvoiceLineTotalNormalizer.php +++ b/src/Api/Normalizer/ShipmentInvoiceLineTotalNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentInvoiceLineTotalNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentInvoiceLineTotalNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class => false]; - } - } -} else { - class ShipmentInvoiceLineTotalNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentNormalizer.php b/src/Api/Normalizer/ShipmentNormalizer.php index aff63687..1bcaee9a 100644 --- a/src/Api/Normalizer/ShipmentNormalizer.php +++ b/src/Api/Normalizer/ShipmentNormalizer.php @@ -5,232 +5,115 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Shipment::class; + return $type === \ShipStream\Ups\Api\Model\Shipment::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Shipment::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Shipment::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Shipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('inquiryNumber', $data)) { - $object->setInquiryNumber($data['inquiryNumber']); - unset($data['inquiryNumber']); - } - if (\array_key_exists('package', $data) && $data['package'] !== null) { - $values = []; - foreach ($data['package'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Package::class, 'json', $context); - } - $object->setPackage($values); - unset($data['package']); - } - elseif (\array_key_exists('package', $data) && $data['package'] === null) { - $object->setPackage(null); - } - if (\array_key_exists('userRelation', $data)) { - $values_1 = []; - foreach ($data['userRelation'] as $value_1) { - $values_1[] = $value_1; - } - $object->setUserRelation($values_1); - unset($data['userRelation']); - } - if (\array_key_exists('warnings', $data) && $data['warnings'] !== null) { - $values_2 = []; - foreach ($data['warnings'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\Warning::class, 'json', $context); - } - $object->setWarnings($values_2); - unset($data['warnings']); - } - elseif (\array_key_exists('warnings', $data) && $data['warnings'] === null) { - $object->setWarnings(null); - } - foreach ($data as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_3; - } - } + $object = new \ShipStream\Ups\Api\Model\Shipment(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('inquiryNumber') && null !== $object->getInquiryNumber()) { - $data['inquiryNumber'] = $object->getInquiryNumber(); - } - if ($object->isInitialized('package') && null !== $object->getPackage()) { - $values = []; - foreach ($object->getPackage() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['package'] = $values; - } - if ($object->isInitialized('userRelation') && null !== $object->getUserRelation()) { - $values_1 = []; - foreach ($object->getUserRelation() as $value_1) { - $values_1[] = $value_1; - } - $data['userRelation'] = $values_1; + if (\array_key_exists('inquiryNumber', $data)) { + $object->setInquiryNumber($data['inquiryNumber']); + unset($data['inquiryNumber']); + } + if (\array_key_exists('package', $data) && $data['package'] !== null) { + $values = []; + foreach ($data['package'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Package::class, 'json', $context); } - if ($object->isInitialized('warnings') && null !== $object->getWarnings()) { - $values_2 = []; - foreach ($object->getWarnings() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['warnings'] = $values_2; + $object->setPackage($values); + unset($data['package']); + } + elseif (\array_key_exists('package', $data) && $data['package'] === null) { + $object->setPackage(null); + } + if (\array_key_exists('userRelation', $data)) { + $values_1 = []; + foreach ($data['userRelation'] as $value_1) { + $values_1[] = $value_1; } - foreach ($object as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_3; - } + $object->setUserRelation($values_1); + unset($data['userRelation']); + } + if (\array_key_exists('warnings', $data) && $data['warnings'] !== null) { + $values_2 = []; + foreach ($data['warnings'] as $value_2) { + $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\Warning::class, 'json', $context); } - return $data; + $object->setWarnings($values_2); + unset($data['warnings']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Shipment::class => false]; + elseif (\array_key_exists('warnings', $data) && $data['warnings'] === null) { + $object->setWarnings(null); } + foreach ($data as $key => $value_3) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_3; + } + } + return $object; } -} else { - class ShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Shipment::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Shipment::class; + $dataArray = []; + if ($data->isInitialized('inquiryNumber') && null !== $data->getInquiryNumber()) { + $dataArray['inquiryNumber'] = $data->getInquiryNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Shipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('inquiryNumber', $data)) { - $object->setInquiryNumber($data['inquiryNumber']); - unset($data['inquiryNumber']); - } - if (\array_key_exists('package', $data) && $data['package'] !== null) { - $values = []; - foreach ($data['package'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Package::class, 'json', $context); - } - $object->setPackage($values); - unset($data['package']); - } - elseif (\array_key_exists('package', $data) && $data['package'] === null) { - $object->setPackage(null); - } - if (\array_key_exists('userRelation', $data)) { - $values_1 = []; - foreach ($data['userRelation'] as $value_1) { - $values_1[] = $value_1; - } - $object->setUserRelation($values_1); - unset($data['userRelation']); - } - if (\array_key_exists('warnings', $data) && $data['warnings'] !== null) { - $values_2 = []; - foreach ($data['warnings'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\Warning::class, 'json', $context); - } - $object->setWarnings($values_2); - unset($data['warnings']); + if ($data->isInitialized('package')) { + $values = []; + foreach ($data->getPackage() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - elseif (\array_key_exists('warnings', $data) && $data['warnings'] === null) { - $object->setWarnings(null); - } - foreach ($data as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_3; - } - } - return $object; + $dataArray['package'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('inquiryNumber') && null !== $object->getInquiryNumber()) { - $data['inquiryNumber'] = $object->getInquiryNumber(); - } - if ($object->isInitialized('package') && null !== $object->getPackage()) { - $values = []; - foreach ($object->getPackage() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['package'] = $values; - } - if ($object->isInitialized('userRelation') && null !== $object->getUserRelation()) { - $values_1 = []; - foreach ($object->getUserRelation() as $value_1) { - $values_1[] = $value_1; - } - $data['userRelation'] = $values_1; + if ($data->isInitialized('userRelation') && null !== $data->getUserRelation()) { + $values_1 = []; + foreach ($data->getUserRelation() as $value_1) { + $values_1[] = $value_1; } - if ($object->isInitialized('warnings') && null !== $object->getWarnings()) { - $values_2 = []; - foreach ($object->getWarnings() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['warnings'] = $values_2; - } - foreach ($object as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_3; - } + $dataArray['userRelation'] = $values_1; + } + if ($data->isInitialized('warnings')) { + $values_2 = []; + foreach ($data->getWarnings() as $value_2) { + $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); } - return $data; + $dataArray['warnings'] = $values_2; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Shipment::class => false]; + foreach ($data as $key => $value_3) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_3; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Shipment::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentPackageNormalizer.php b/src/Api/Normalizer/ShipmentPackageNormalizer.php index 93aff295..eff1afbe 100644 --- a/src/Api/Normalizer/ShipmentPackageNormalizer.php +++ b/src/Api/Normalizer/ShipmentPackageNormalizer.php @@ -5,380 +5,189 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentPackage::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPackage::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentPackage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('PalletDescription', $data)) { - $object->setPalletDescription($data['PalletDescription']); - unset($data['PalletDescription']); - } - if (\array_key_exists('NumOfPieces', $data)) { - $object->setNumOfPieces($data['NumOfPieces']); - unset($data['NumOfPieces']); - } - if (\array_key_exists('UnitPrice', $data)) { - $object->setUnitPrice($data['UnitPrice']); - unset($data['UnitPrice']); - } - if (\array_key_exists('Packaging', $data)) { - $object->setPackaging($this->denormalizer->denormalize($data['Packaging'], \ShipStream\Ups\Api\Model\PackagePackaging::class, 'json', $context)); - unset($data['Packaging']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\PackageDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('DimWeight', $data)) { - $object->setDimWeight($this->denormalizer->denormalize($data['DimWeight'], \ShipStream\Ups\Api\Model\PackageDimWeight::class, 'json', $context)); - unset($data['DimWeight']); - } - if (\array_key_exists('PackageWeight', $data)) { - $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\PackagePackageWeight::class, 'json', $context)); - unset($data['PackageWeight']); - } - if (\array_key_exists('LargePackageIndicator', $data)) { - $object->setLargePackageIndicator($data['LargePackageIndicator']); - unset($data['LargePackageIndicator']); - } - if (\array_key_exists('OversizeIndicator', $data)) { - $object->setOversizeIndicator($data['OversizeIndicator']); - unset($data['OversizeIndicator']); - } - if (\array_key_exists('MinimumBillableWeightIndicator', $data)) { - $object->setMinimumBillableWeightIndicator($data['MinimumBillableWeightIndicator']); - unset($data['MinimumBillableWeightIndicator']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $values = []; - foreach ($data['ReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageReferenceNumber::class, 'json', $context); - } - $object->setReferenceNumber($values); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('AdditionalHandlingIndicator', $data)) { - $object->setAdditionalHandlingIndicator($data['AdditionalHandlingIndicator']); - unset($data['AdditionalHandlingIndicator']); - } - if (\array_key_exists('SimpleRate', $data)) { - $object->setSimpleRate($this->denormalizer->denormalize($data['SimpleRate'], \ShipStream\Ups\Api\Model\PackageSimpleRate::class, 'json', $context)); - unset($data['SimpleRate']); - } - if (\array_key_exists('UPSPremier', $data)) { - $object->setUPSPremier($this->denormalizer->denormalize($data['UPSPremier'], \ShipStream\Ups\Api\Model\PackageUPSPremier::class, 'json', $context)); - unset($data['UPSPremier']); - } - if (\array_key_exists('PackageServiceOptions', $data)) { - $object->setPackageServiceOptions($this->denormalizer->denormalize($data['PackageServiceOptions'], \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class, 'json', $context)); - unset($data['PackageServiceOptions']); - } - if (\array_key_exists('Commodity', $data)) { - $object->setCommodity($this->denormalizer->denormalize($data['Commodity'], \ShipStream\Ups\Api\Model\PackageCommodity::class, 'json', $context)); - unset($data['Commodity']); - } - if (\array_key_exists('HazMatPackageInformation', $data)) { - $object->setHazMatPackageInformation($this->denormalizer->denormalize($data['HazMatPackageInformation'], \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class, 'json', $context)); - unset($data['HazMatPackageInformation']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\ShipmentPackage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPackage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ShipmentPackage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('palletDescription') && null !== $object->getPalletDescription()) { - $data['PalletDescription'] = $object->getPalletDescription(); - } - if ($object->isInitialized('numOfPieces') && null !== $object->getNumOfPieces()) { - $data['NumOfPieces'] = $object->getNumOfPieces(); - } - if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { - $data['UnitPrice'] = $object->getUnitPrice(); - } - $data['Packaging'] = $this->normalizer->normalize($object->getPackaging(), 'json', $context); - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - if ($object->isInitialized('dimWeight') && null !== $object->getDimWeight()) { - $data['DimWeight'] = $this->normalizer->normalize($object->getDimWeight(), 'json', $context); - } - if ($object->isInitialized('packageWeight') && null !== $object->getPackageWeight()) { - $data['PackageWeight'] = $this->normalizer->normalize($object->getPackageWeight(), 'json', $context); - } - if ($object->isInitialized('largePackageIndicator') && null !== $object->getLargePackageIndicator()) { - $data['LargePackageIndicator'] = $object->getLargePackageIndicator(); - } - if ($object->isInitialized('oversizeIndicator') && null !== $object->getOversizeIndicator()) { - $data['OversizeIndicator'] = $object->getOversizeIndicator(); - } - if ($object->isInitialized('minimumBillableWeightIndicator') && null !== $object->getMinimumBillableWeightIndicator()) { - $data['MinimumBillableWeightIndicator'] = $object->getMinimumBillableWeightIndicator(); - } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $values = []; - foreach ($object->getReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ReferenceNumber'] = $values; - } - if ($object->isInitialized('additionalHandlingIndicator') && null !== $object->getAdditionalHandlingIndicator()) { - $data['AdditionalHandlingIndicator'] = $object->getAdditionalHandlingIndicator(); - } - if ($object->isInitialized('simpleRate') && null !== $object->getSimpleRate()) { - $data['SimpleRate'] = $this->normalizer->normalize($object->getSimpleRate(), 'json', $context); - } - if ($object->isInitialized('uPSPremier') && null !== $object->getUPSPremier()) { - $data['UPSPremier'] = $this->normalizer->normalize($object->getUPSPremier(), 'json', $context); - } - if ($object->isInitialized('packageServiceOptions') && null !== $object->getPackageServiceOptions()) { - $data['PackageServiceOptions'] = $this->normalizer->normalize($object->getPackageServiceOptions(), 'json', $context); - } - if ($object->isInitialized('commodity') && null !== $object->getCommodity()) { - $data['Commodity'] = $this->normalizer->normalize($object->getCommodity(), 'json', $context); - } - if ($object->isInitialized('hazMatPackageInformation') && null !== $object->getHazMatPackageInformation()) { - $data['HazMatPackageInformation'] = $this->normalizer->normalize($object->getHazMatPackageInformation(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); + } + if (\array_key_exists('PalletDescription', $data)) { + $object->setPalletDescription($data['PalletDescription']); + unset($data['PalletDescription']); + } + if (\array_key_exists('NumOfPieces', $data)) { + $object->setNumOfPieces($data['NumOfPieces']); + unset($data['NumOfPieces']); + } + if (\array_key_exists('UnitPrice', $data)) { + $object->setUnitPrice($data['UnitPrice']); + unset($data['UnitPrice']); + } + if (\array_key_exists('Packaging', $data)) { + $object->setPackaging($this->denormalizer->denormalize($data['Packaging'], \ShipStream\Ups\Api\Model\PackagePackaging::class, 'json', $context)); + unset($data['Packaging']); + } + if (\array_key_exists('Dimensions', $data)) { + $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\PackageDimensions::class, 'json', $context)); + unset($data['Dimensions']); + } + if (\array_key_exists('DimWeight', $data)) { + $object->setDimWeight($this->denormalizer->denormalize($data['DimWeight'], \ShipStream\Ups\Api\Model\PackageDimWeight::class, 'json', $context)); + unset($data['DimWeight']); + } + if (\array_key_exists('PackageWeight', $data)) { + $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\PackagePackageWeight::class, 'json', $context)); + unset($data['PackageWeight']); + } + if (\array_key_exists('LargePackageIndicator', $data)) { + $object->setLargePackageIndicator($data['LargePackageIndicator']); + unset($data['LargePackageIndicator']); + } + if (\array_key_exists('OversizeIndicator', $data)) { + $object->setOversizeIndicator($data['OversizeIndicator']); + unset($data['OversizeIndicator']); + } + if (\array_key_exists('MinimumBillableWeightIndicator', $data)) { + $object->setMinimumBillableWeightIndicator($data['MinimumBillableWeightIndicator']); + unset($data['MinimumBillableWeightIndicator']); + } + if (\array_key_exists('ReferenceNumber', $data)) { + $values = []; + foreach ($data['ReferenceNumber'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageReferenceNumber::class, 'json', $context); } - return $data; + $object->setReferenceNumber($values); + unset($data['ReferenceNumber']); + } + if (\array_key_exists('AdditionalHandlingIndicator', $data)) { + $object->setAdditionalHandlingIndicator($data['AdditionalHandlingIndicator']); + unset($data['AdditionalHandlingIndicator']); + } + if (\array_key_exists('SimpleRate', $data)) { + $object->setSimpleRate($this->denormalizer->denormalize($data['SimpleRate'], \ShipStream\Ups\Api\Model\PackageSimpleRate::class, 'json', $context)); + unset($data['SimpleRate']); + } + if (\array_key_exists('UPSPremier', $data)) { + $object->setUPSPremier($this->denormalizer->denormalize($data['UPSPremier'], \ShipStream\Ups\Api\Model\PackageUPSPremier::class, 'json', $context)); + unset($data['UPSPremier']); + } + if (\array_key_exists('PackageServiceOptions', $data)) { + $object->setPackageServiceOptions($this->denormalizer->denormalize($data['PackageServiceOptions'], \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class, 'json', $context)); + unset($data['PackageServiceOptions']); + } + if (\array_key_exists('Commodity', $data)) { + $object->setCommodity($this->denormalizer->denormalize($data['Commodity'], \ShipStream\Ups\Api\Model\PackageCommodity::class, 'json', $context)); + unset($data['Commodity']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentPackage::class => false]; + if (\array_key_exists('HazMatPackageInformation', $data)) { + $object->setHazMatPackageInformation($this->denormalizer->denormalize($data['HazMatPackageInformation'], \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class, 'json', $context)); + unset($data['HazMatPackageInformation']); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class ShipmentPackageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentPackage::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPackage::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentPackage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('PalletDescription', $data)) { - $object->setPalletDescription($data['PalletDescription']); - unset($data['PalletDescription']); - } - if (\array_key_exists('NumOfPieces', $data)) { - $object->setNumOfPieces($data['NumOfPieces']); - unset($data['NumOfPieces']); - } - if (\array_key_exists('UnitPrice', $data)) { - $object->setUnitPrice($data['UnitPrice']); - unset($data['UnitPrice']); - } - if (\array_key_exists('Packaging', $data)) { - $object->setPackaging($this->denormalizer->denormalize($data['Packaging'], \ShipStream\Ups\Api\Model\PackagePackaging::class, 'json', $context)); - unset($data['Packaging']); - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\PackageDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('DimWeight', $data)) { - $object->setDimWeight($this->denormalizer->denormalize($data['DimWeight'], \ShipStream\Ups\Api\Model\PackageDimWeight::class, 'json', $context)); - unset($data['DimWeight']); - } - if (\array_key_exists('PackageWeight', $data)) { - $object->setPackageWeight($this->denormalizer->denormalize($data['PackageWeight'], \ShipStream\Ups\Api\Model\PackagePackageWeight::class, 'json', $context)); - unset($data['PackageWeight']); - } - if (\array_key_exists('LargePackageIndicator', $data)) { - $object->setLargePackageIndicator($data['LargePackageIndicator']); - unset($data['LargePackageIndicator']); - } - if (\array_key_exists('OversizeIndicator', $data)) { - $object->setOversizeIndicator($data['OversizeIndicator']); - unset($data['OversizeIndicator']); - } - if (\array_key_exists('MinimumBillableWeightIndicator', $data)) { - $object->setMinimumBillableWeightIndicator($data['MinimumBillableWeightIndicator']); - unset($data['MinimumBillableWeightIndicator']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $values = []; - foreach ($data['ReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageReferenceNumber::class, 'json', $context); - } - $object->setReferenceNumber($values); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('AdditionalHandlingIndicator', $data)) { - $object->setAdditionalHandlingIndicator($data['AdditionalHandlingIndicator']); - unset($data['AdditionalHandlingIndicator']); - } - if (\array_key_exists('SimpleRate', $data)) { - $object->setSimpleRate($this->denormalizer->denormalize($data['SimpleRate'], \ShipStream\Ups\Api\Model\PackageSimpleRate::class, 'json', $context)); - unset($data['SimpleRate']); - } - if (\array_key_exists('UPSPremier', $data)) { - $object->setUPSPremier($this->denormalizer->denormalize($data['UPSPremier'], \ShipStream\Ups\Api\Model\PackageUPSPremier::class, 'json', $context)); - unset($data['UPSPremier']); - } - if (\array_key_exists('PackageServiceOptions', $data)) { - $object->setPackageServiceOptions($this->denormalizer->denormalize($data['PackageServiceOptions'], \ShipStream\Ups\Api\Model\PackagePackageServiceOptions::class, 'json', $context)); - unset($data['PackageServiceOptions']); - } - if (\array_key_exists('Commodity', $data)) { - $object->setCommodity($this->denormalizer->denormalize($data['Commodity'], \ShipStream\Ups\Api\Model\PackageCommodity::class, 'json', $context)); - unset($data['Commodity']); - } - if (\array_key_exists('HazMatPackageInformation', $data)) { - $object->setHazMatPackageInformation($this->denormalizer->denormalize($data['HazMatPackageInformation'], \ShipStream\Ups\Api\Model\PackageHazMatPackageInformation::class, 'json', $context)); - unset($data['HazMatPackageInformation']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('palletDescription') && null !== $object->getPalletDescription()) { - $data['PalletDescription'] = $object->getPalletDescription(); - } - if ($object->isInitialized('numOfPieces') && null !== $object->getNumOfPieces()) { - $data['NumOfPieces'] = $object->getNumOfPieces(); - } - if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { - $data['UnitPrice'] = $object->getUnitPrice(); - } - $data['Packaging'] = $this->normalizer->normalize($object->getPackaging(), 'json', $context); - if ($object->isInitialized('dimensions') && null !== $object->getDimensions()) { - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - } - if ($object->isInitialized('dimWeight') && null !== $object->getDimWeight()) { - $data['DimWeight'] = $this->normalizer->normalize($object->getDimWeight(), 'json', $context); - } - if ($object->isInitialized('packageWeight') && null !== $object->getPackageWeight()) { - $data['PackageWeight'] = $this->normalizer->normalize($object->getPackageWeight(), 'json', $context); - } - if ($object->isInitialized('largePackageIndicator') && null !== $object->getLargePackageIndicator()) { - $data['LargePackageIndicator'] = $object->getLargePackageIndicator(); - } - if ($object->isInitialized('oversizeIndicator') && null !== $object->getOversizeIndicator()) { - $data['OversizeIndicator'] = $object->getOversizeIndicator(); - } - if ($object->isInitialized('minimumBillableWeightIndicator') && null !== $object->getMinimumBillableWeightIndicator()) { - $data['MinimumBillableWeightIndicator'] = $object->getMinimumBillableWeightIndicator(); - } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $values = []; - foreach ($object->getReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ReferenceNumber'] = $values; - } - if ($object->isInitialized('additionalHandlingIndicator') && null !== $object->getAdditionalHandlingIndicator()) { - $data['AdditionalHandlingIndicator'] = $object->getAdditionalHandlingIndicator(); - } - if ($object->isInitialized('simpleRate') && null !== $object->getSimpleRate()) { - $data['SimpleRate'] = $this->normalizer->normalize($object->getSimpleRate(), 'json', $context); - } - if ($object->isInitialized('uPSPremier') && null !== $object->getUPSPremier()) { - $data['UPSPremier'] = $this->normalizer->normalize($object->getUPSPremier(), 'json', $context); - } - if ($object->isInitialized('packageServiceOptions') && null !== $object->getPackageServiceOptions()) { - $data['PackageServiceOptions'] = $this->normalizer->normalize($object->getPackageServiceOptions(), 'json', $context); - } - if ($object->isInitialized('commodity') && null !== $object->getCommodity()) { - $data['Commodity'] = $this->normalizer->normalize($object->getCommodity(), 'json', $context); - } - if ($object->isInitialized('hazMatPackageInformation') && null !== $object->getHazMatPackageInformation()) { - $data['HazMatPackageInformation'] = $this->normalizer->normalize($object->getHazMatPackageInformation(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if ($data->isInitialized('palletDescription') && null !== $data->getPalletDescription()) { + $dataArray['PalletDescription'] = $data->getPalletDescription(); + } + if ($data->isInitialized('numOfPieces') && null !== $data->getNumOfPieces()) { + $dataArray['NumOfPieces'] = $data->getNumOfPieces(); + } + if ($data->isInitialized('unitPrice') && null !== $data->getUnitPrice()) { + $dataArray['UnitPrice'] = $data->getUnitPrice(); + } + $dataArray['Packaging'] = $this->normalizer->normalize($data->getPackaging(), 'json', $context); + if ($data->isInitialized('dimensions') && null !== $data->getDimensions()) { + $dataArray['Dimensions'] = $this->normalizer->normalize($data->getDimensions(), 'json', $context); + } + if ($data->isInitialized('dimWeight') && null !== $data->getDimWeight()) { + $dataArray['DimWeight'] = $this->normalizer->normalize($data->getDimWeight(), 'json', $context); + } + if ($data->isInitialized('packageWeight') && null !== $data->getPackageWeight()) { + $dataArray['PackageWeight'] = $this->normalizer->normalize($data->getPackageWeight(), 'json', $context); + } + if ($data->isInitialized('largePackageIndicator') && null !== $data->getLargePackageIndicator()) { + $dataArray['LargePackageIndicator'] = $data->getLargePackageIndicator(); + } + if ($data->isInitialized('oversizeIndicator') && null !== $data->getOversizeIndicator()) { + $dataArray['OversizeIndicator'] = $data->getOversizeIndicator(); + } + if ($data->isInitialized('minimumBillableWeightIndicator') && null !== $data->getMinimumBillableWeightIndicator()) { + $dataArray['MinimumBillableWeightIndicator'] = $data->getMinimumBillableWeightIndicator(); + } + if ($data->isInitialized('referenceNumber') && null !== $data->getReferenceNumber()) { + $values = []; + foreach ($data->getReferenceNumber() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $data; + $dataArray['ReferenceNumber'] = $values; + } + if ($data->isInitialized('additionalHandlingIndicator') && null !== $data->getAdditionalHandlingIndicator()) { + $dataArray['AdditionalHandlingIndicator'] = $data->getAdditionalHandlingIndicator(); + } + if ($data->isInitialized('simpleRate') && null !== $data->getSimpleRate()) { + $dataArray['SimpleRate'] = $this->normalizer->normalize($data->getSimpleRate(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentPackage::class => false]; + if ($data->isInitialized('uPSPremier') && null !== $data->getUPSPremier()) { + $dataArray['UPSPremier'] = $this->normalizer->normalize($data->getUPSPremier(), 'json', $context); } + if ($data->isInitialized('packageServiceOptions') && null !== $data->getPackageServiceOptions()) { + $dataArray['PackageServiceOptions'] = $this->normalizer->normalize($data->getPackageServiceOptions(), 'json', $context); + } + if ($data->isInitialized('commodity') && null !== $data->getCommodity()) { + $dataArray['Commodity'] = $this->normalizer->normalize($data->getCommodity(), 'json', $context); + } + if ($data->isInitialized('hazMatPackageInformation') && null !== $data->getHazMatPackageInformation()) { + $dataArray['HazMatPackageInformation'] = $this->normalizer->normalize($data->getHazMatPackageInformation(), 'json', $context); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentPackage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentPaymentDetailsNormalizer.php b/src/Api/Normalizer/ShipmentPaymentDetailsNormalizer.php index f4f56032..1b2b4758 100644 --- a/src/Api/Normalizer/ShipmentPaymentDetailsNormalizer.php +++ b/src/Api/Normalizer/ShipmentPaymentDetailsNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentPaymentDetailsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentPaymentDetailsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentPaymentDetails(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentCharge', $data)) { - $values = []; - foreach ($data['ShipmentCharge'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class, 'json', $context); - } - $object->setShipmentCharge($values); - unset($data['ShipmentCharge']); - } - if (\array_key_exists('SplitDutyVATIndicator', $data)) { - $object->setSplitDutyVATIndicator($data['SplitDutyVATIndicator']); - unset($data['SplitDutyVATIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentPaymentDetails(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('ShipmentCharge', $data)) { $values = []; - foreach ($object->getShipmentCharge() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ShipmentCharge'] = $values; - if ($object->isInitialized('splitDutyVATIndicator') && null !== $object->getSplitDutyVATIndicator()) { - $data['SplitDutyVATIndicator'] = $object->getSplitDutyVATIndicator(); + foreach ($data['ShipmentCharge'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class, 'json', $context); } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setShipmentCharge($values); + unset($data['ShipmentCharge']); + } + if (\array_key_exists('SplitDutyVATIndicator', $data)) { + $object->setSplitDutyVATIndicator($data['SplitDutyVATIndicator']); + unset($data['SplitDutyVATIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class ShipmentPaymentDetailsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class; + $dataArray = []; + $values = []; + foreach ($data->getShipmentCharge() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class; + $dataArray['ShipmentCharge'] = $values; + if ($data->isInitialized('splitDutyVATIndicator') && null !== $data->getSplitDutyVATIndicator()) { + $dataArray['SplitDutyVATIndicator'] = $data->getSplitDutyVATIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentPaymentDetails(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentCharge', $data)) { - $values = []; - foreach ($data['ShipmentCharge'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PaymentDetailsShipmentCharge::class, 'json', $context); - } - $object->setShipmentCharge($values); - unset($data['ShipmentCharge']); - } - if (\array_key_exists('SplitDutyVATIndicator', $data)) { - $object->setSplitDutyVATIndicator($data['SplitDutyVATIndicator']); - unset($data['SplitDutyVATIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getShipmentCharge() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ShipmentCharge'] = $values; - if ($object->isInitialized('splitDutyVATIndicator') && null !== $object->getSplitDutyVATIndicator()) { - $data['SplitDutyVATIndicator'] = $object->getSplitDutyVATIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentPaymentDetails::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentPaymentInformationNormalizer.php b/src/Api/Normalizer/ShipmentPaymentInformationNormalizer.php index 8633aa27..93206011 100644 --- a/src/Api/Normalizer/ShipmentPaymentInformationNormalizer.php +++ b/src/Api/Normalizer/ShipmentPaymentInformationNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentPaymentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentCharge', $data)) { - $values = []; - foreach ($data['ShipmentCharge'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class, 'json', $context); - } - $object->setShipmentCharge($values); - unset($data['ShipmentCharge']); - } - if (\array_key_exists('SplitDutyVATIndicator', $data)) { - $object->setSplitDutyVATIndicator($data['SplitDutyVATIndicator']); - unset($data['SplitDutyVATIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentPaymentInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('ShipmentCharge', $data)) { $values = []; - foreach ($object->getShipmentCharge() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ShipmentCharge'] = $values; - if ($object->isInitialized('splitDutyVATIndicator') && null !== $object->getSplitDutyVATIndicator()) { - $data['SplitDutyVATIndicator'] = $object->getSplitDutyVATIndicator(); + foreach ($data['ShipmentCharge'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class, 'json', $context); } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setShipmentCharge($values); + unset($data['ShipmentCharge']); + } + if (\array_key_exists('SplitDutyVATIndicator', $data)) { + $object->setSplitDutyVATIndicator($data['SplitDutyVATIndicator']); + unset($data['SplitDutyVATIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class ShipmentPaymentInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class; + $dataArray = []; + $values = []; + foreach ($data->getShipmentCharge() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class; + $dataArray['ShipmentCharge'] = $values; + if ($data->isInitialized('splitDutyVATIndicator') && null !== $data->getSplitDutyVATIndicator()) { + $dataArray['SplitDutyVATIndicator'] = $data->getSplitDutyVATIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentPaymentInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShipmentCharge', $data)) { - $values = []; - foreach ($data['ShipmentCharge'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PaymentInformationShipmentCharge::class, 'json', $context); - } - $object->setShipmentCharge($values); - unset($data['ShipmentCharge']); - } - if (\array_key_exists('SplitDutyVATIndicator', $data)) { - $object->setSplitDutyVATIndicator($data['SplitDutyVATIndicator']); - unset($data['SplitDutyVATIndicator']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getShipmentCharge() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ShipmentCharge'] = $values; - if ($object->isInitialized('splitDutyVATIndicator') && null !== $object->getSplitDutyVATIndicator()) { - $data['SplitDutyVATIndicator'] = $object->getSplitDutyVATIndicator(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentPickupRequestNormalizer.php b/src/Api/Normalizer/ShipmentPickupRequestNormalizer.php index 84dfa0ff..0028bcf8 100644 --- a/src/Api/Normalizer/ShipmentPickupRequestNormalizer.php +++ b/src/Api/Normalizer/ShipmentPickupRequestNormalizer.php @@ -5,192 +5,95 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentPickupRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentPickupRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentPickupRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AdditionalComments', $data)) { - $object->setAdditionalComments($data['AdditionalComments']); - unset($data['AdditionalComments']); - } - if (\array_key_exists('Requester', $data)) { - $object->setRequester($this->denormalizer->denormalize($data['Requester'], \ShipStream\Ups\Api\Model\PickupRequestRequester::class, 'json', $context)); - unset($data['Requester']); - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - if (\array_key_exists('EarliestTimeReady', $data)) { - $object->setEarliestTimeReady($data['EarliestTimeReady']); - unset($data['EarliestTimeReady']); - } - if (\array_key_exists('LatestTimeReady', $data)) { - $object->setLatestTimeReady($data['LatestTimeReady']); - unset($data['LatestTimeReady']); - } - if (\array_key_exists('POM', $data)) { - $object->setPOM($this->denormalizer->denormalize($data['POM'], \ShipStream\Ups\Api\Model\PickupRequestPOM::class, 'json', $context)); - unset($data['POM']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentPickupRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('additionalComments') && null !== $object->getAdditionalComments()) { - $data['AdditionalComments'] = $object->getAdditionalComments(); - } - if ($object->isInitialized('requester') && null !== $object->getRequester()) { - $data['Requester'] = $this->normalizer->normalize($object->getRequester(), 'json', $context); - } - $data['PickupDate'] = $object->getPickupDate(); - if ($object->isInitialized('earliestTimeReady') && null !== $object->getEarliestTimeReady()) { - $data['EarliestTimeReady'] = $object->getEarliestTimeReady(); - } - $data['LatestTimeReady'] = $object->getLatestTimeReady(); - if ($object->isInitialized('pOM') && null !== $object->getPOM()) { - $data['POM'] = $this->normalizer->normalize($object->getPOM(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AdditionalComments', $data)) { + $object->setAdditionalComments($data['AdditionalComments']); + unset($data['AdditionalComments']); + } + if (\array_key_exists('Requester', $data)) { + $object->setRequester($this->denormalizer->denormalize($data['Requester'], \ShipStream\Ups\Api\Model\PickupRequestRequester::class, 'json', $context)); + unset($data['Requester']); + } + if (\array_key_exists('PickupDate', $data)) { + $object->setPickupDate($data['PickupDate']); + unset($data['PickupDate']); + } + if (\array_key_exists('EarliestTimeReady', $data)) { + $object->setEarliestTimeReady($data['EarliestTimeReady']); + unset($data['EarliestTimeReady']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentPickupRequest::class => false]; + if (\array_key_exists('LatestTimeReady', $data)) { + $object->setLatestTimeReady($data['LatestTimeReady']); + unset($data['LatestTimeReady']); } + if (\array_key_exists('POM', $data)) { + $object->setPOM($this->denormalizer->denormalize($data['POM'], \ShipStream\Ups\Api\Model\PickupRequestPOM::class, 'json', $context)); + unset($data['POM']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentPickupRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class; + $dataArray = []; + if ($data->isInitialized('additionalComments') && null !== $data->getAdditionalComments()) { + $dataArray['AdditionalComments'] = $data->getAdditionalComments(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPickupRequest::class; + if ($data->isInitialized('requester') && null !== $data->getRequester()) { + $dataArray['Requester'] = $this->normalizer->normalize($data->getRequester(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentPickupRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AdditionalComments', $data)) { - $object->setAdditionalComments($data['AdditionalComments']); - unset($data['AdditionalComments']); - } - if (\array_key_exists('Requester', $data)) { - $object->setRequester($this->denormalizer->denormalize($data['Requester'], \ShipStream\Ups\Api\Model\PickupRequestRequester::class, 'json', $context)); - unset($data['Requester']); - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - if (\array_key_exists('EarliestTimeReady', $data)) { - $object->setEarliestTimeReady($data['EarliestTimeReady']); - unset($data['EarliestTimeReady']); - } - if (\array_key_exists('LatestTimeReady', $data)) { - $object->setLatestTimeReady($data['LatestTimeReady']); - unset($data['LatestTimeReady']); - } - if (\array_key_exists('POM', $data)) { - $object->setPOM($this->denormalizer->denormalize($data['POM'], \ShipStream\Ups\Api\Model\PickupRequestPOM::class, 'json', $context)); - unset($data['POM']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray['PickupDate'] = $data->getPickupDate(); + if ($data->isInitialized('earliestTimeReady') && null !== $data->getEarliestTimeReady()) { + $dataArray['EarliestTimeReady'] = $data->getEarliestTimeReady(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('additionalComments') && null !== $object->getAdditionalComments()) { - $data['AdditionalComments'] = $object->getAdditionalComments(); - } - if ($object->isInitialized('requester') && null !== $object->getRequester()) { - $data['Requester'] = $this->normalizer->normalize($object->getRequester(), 'json', $context); - } - $data['PickupDate'] = $object->getPickupDate(); - if ($object->isInitialized('earliestTimeReady') && null !== $object->getEarliestTimeReady()) { - $data['EarliestTimeReady'] = $object->getEarliestTimeReady(); - } - $data['LatestTimeReady'] = $object->getLatestTimeReady(); - if ($object->isInitialized('pOM') && null !== $object->getPOM()) { - $data['POM'] = $this->normalizer->normalize($object->getPOM(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + $dataArray['LatestTimeReady'] = $data->getLatestTimeReady(); + if ($data->isInitialized('pOM') && null !== $data->getPOM()) { + $dataArray['POM'] = $this->normalizer->normalize($data->getPOM(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentPickupRequest::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentPickupRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentPromotionalDiscountInformationNormalizer.php b/src/Api/Normalizer/ShipmentPromotionalDiscountInformationNormalizer.php index fa85b449..662279c1 100644 --- a/src/Api/Normalizer/ShipmentPromotionalDiscountInformationNormalizer.php +++ b/src/Api/Normalizer/ShipmentPromotionalDiscountInformationNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentPromotionalDiscountInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentPromotionalDiscountInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PromoCode', $data)) { - $object->setPromoCode($data['PromoCode']); - unset($data['PromoCode']); - } - if (\array_key_exists('PromoAliasCode', $data)) { - $object->setPromoAliasCode($data['PromoAliasCode']); - unset($data['PromoAliasCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['PromoCode'] = $object->getPromoCode(); - $data['PromoAliasCode'] = $object->getPromoAliasCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class => false]; - } - } -} else { - class ShipmentPromotionalDiscountInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class; + if (\array_key_exists('PromoCode', $data)) { + $object->setPromoCode($data['PromoCode']); + unset($data['PromoCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class; + if (\array_key_exists('PromoAliasCode', $data)) { + $object->setPromoAliasCode($data['PromoAliasCode']); + unset($data['PromoAliasCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PromoCode', $data)) { - $object->setPromoCode($data['PromoCode']); - unset($data['PromoCode']); - } - if (\array_key_exists('PromoAliasCode', $data)) { - $object->setPromoAliasCode($data['PromoAliasCode']); - unset($data['PromoAliasCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['PromoCode'] = $object->getPromoCode(); - $data['PromoAliasCode'] = $object->getPromoAliasCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['PromoCode'] = $data->getPromoCode(); + $dataArray['PromoAliasCode'] = $data->getPromoAliasCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentReferenceNormalizer.php b/src/Api/Normalizer/ShipmentReferenceNormalizer.php index 941436d4..35097af3 100644 --- a/src/Api/Normalizer/ShipmentReferenceNormalizer.php +++ b/src/Api/Normalizer/ShipmentReferenceNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentReference::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentReference::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentReference::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentReference::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($this->denormalizer->denormalize($data['Number'], \ShipStream\Ups\Api\Model\ReferenceNumber::class, 'json', $context)); - unset($data['Number']); - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('NumberOfCartons', $data)) { - $object->setNumberOfCartons($data['NumberOfCartons']); - unset($data['NumberOfCartons']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($this->denormalizer->denormalize($data['Weight'], \ShipStream\Ups\Api\Model\ReferenceWeight::class, 'json', $context)); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentReference(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Number'] = $this->normalizer->normalize($object->getNumber(), 'json', $context); - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('numberOfCartons') && null !== $object->getNumberOfCartons()) { - $data['NumberOfCartons'] = $object->getNumberOfCartons(); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['Weight'] = $this->normalizer->normalize($object->getWeight(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($this->denormalizer->denormalize($data['Number'], \ShipStream\Ups\Api\Model\ReferenceNumber::class, 'json', $context)); + unset($data['Number']); + } + if (\array_key_exists('BarCodeIndicator', $data)) { + $object->setBarCodeIndicator($data['BarCodeIndicator']); + unset($data['BarCodeIndicator']); + } + if (\array_key_exists('NumberOfCartons', $data)) { + $object->setNumberOfCartons($data['NumberOfCartons']); + unset($data['NumberOfCartons']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentReference::class => false]; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($this->denormalizer->denormalize($data['Weight'], \ShipStream\Ups\Api\Model\ReferenceWeight::class, 'json', $context)); + unset($data['Weight']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentReference::class; + $dataArray = []; + $dataArray['Number'] = $this->normalizer->normalize($data->getNumber(), 'json', $context); + if ($data->isInitialized('barCodeIndicator') && null !== $data->getBarCodeIndicator()) { + $dataArray['BarCodeIndicator'] = $data->getBarCodeIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentReference::class; + if ($data->isInitialized('numberOfCartons') && null !== $data->getNumberOfCartons()) { + $dataArray['NumberOfCartons'] = $data->getNumberOfCartons(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($this->denormalizer->denormalize($data['Number'], \ShipStream\Ups\Api\Model\ReferenceNumber::class, 'json', $context)); - unset($data['Number']); - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('NumberOfCartons', $data)) { - $object->setNumberOfCartons($data['NumberOfCartons']); - unset($data['NumberOfCartons']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($this->denormalizer->denormalize($data['Weight'], \ShipStream\Ups\Api\Model\ReferenceWeight::class, 'json', $context)); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('weight') && null !== $data->getWeight()) { + $dataArray['Weight'] = $this->normalizer->normalize($data->getWeight(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Number'] = $this->normalizer->normalize($object->getNumber(), 'json', $context); - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('numberOfCartons') && null !== $object->getNumberOfCartons()) { - $data['NumberOfCartons'] = $object->getNumberOfCartons(); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['Weight'] = $this->normalizer->normalize($object->getWeight(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentReference::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentReference::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentReferenceNumberNormalizer.php b/src/Api/Normalizer/ShipmentReferenceNumberNormalizer.php index 56ab5a00..54427c24 100644 --- a/src/Api/Normalizer/ShipmentReferenceNumberNormalizer.php +++ b/src/Api/Normalizer/ShipmentReferenceNumberNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentReferenceNumber(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('BarCodeIndicator', $data)) { + $object->setBarCodeIndicator($data['BarCodeIndicator']); + unset($data['BarCodeIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class => false]; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentReferenceNumberNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class; + $dataArray = []; + if ($data->isInitialized('barCodeIndicator') && null !== $data->getBarCodeIndicator()) { + $dataArray['BarCodeIndicator'] = $data->getBarCodeIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentReferenceNumber(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BarCodeIndicator', $data)) { - $object->setBarCodeIndicator($data['BarCodeIndicator']); - unset($data['BarCodeIndicator']); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('barCodeIndicator') && null !== $object->getBarCodeIndicator()) { - $data['BarCodeIndicator'] = $object->getBarCodeIndicator(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentRequestLabelSpecificationNormalizer.php b/src/Api/Normalizer/ShipmentRequestLabelSpecificationNormalizer.php index 6d8dd110..1f036f5a 100644 --- a/src/Api/Normalizer/ShipmentRequestLabelSpecificationNormalizer.php +++ b/src/Api/Normalizer/ShipmentRequestLabelSpecificationNormalizer.php @@ -5,194 +5,96 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentRequestLabelSpecificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentRequestLabelSpecificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LabelImageFormat', $data)) { - $object->setLabelImageFormat($this->denormalizer->denormalize($data['LabelImageFormat'], \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class, 'json', $context)); - unset($data['LabelImageFormat']); - } - if (\array_key_exists('HTTPUserAgent', $data)) { - $object->setHTTPUserAgent($data['HTTPUserAgent']); - unset($data['HTTPUserAgent']); - } - if (\array_key_exists('LabelStockSize', $data)) { - $object->setLabelStockSize($this->denormalizer->denormalize($data['LabelStockSize'], \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class, 'json', $context)); - unset($data['LabelStockSize']); - } - if (\array_key_exists('Instruction', $data)) { - $values = []; - foreach ($data['Instruction'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class, 'json', $context); - } - $object->setInstruction($values); - unset($data['Instruction']); - } - if (\array_key_exists('CharacterSet', $data)) { - $object->setCharacterSet($data['CharacterSet']); - unset($data['CharacterSet']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['LabelImageFormat'] = $this->normalizer->normalize($object->getLabelImageFormat(), 'json', $context); - if ($object->isInitialized('hTTPUserAgent') && null !== $object->getHTTPUserAgent()) { - $data['HTTPUserAgent'] = $object->getHTTPUserAgent(); - } - $data['LabelStockSize'] = $this->normalizer->normalize($object->getLabelStockSize(), 'json', $context); - if ($object->isInitialized('instruction') && null !== $object->getInstruction()) { - $values = []; - foreach ($object->getInstruction() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Instruction'] = $values; - } - if ($object->isInitialized('characterSet') && null !== $object->getCharacterSet()) { - $data['CharacterSet'] = $object->getCharacterSet(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('LabelImageFormat', $data)) { + $object->setLabelImageFormat($this->denormalizer->denormalize($data['LabelImageFormat'], \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class, 'json', $context)); + unset($data['LabelImageFormat']); + } + if (\array_key_exists('HTTPUserAgent', $data)) { + $object->setHTTPUserAgent($data['HTTPUserAgent']); + unset($data['HTTPUserAgent']); + } + if (\array_key_exists('LabelStockSize', $data)) { + $object->setLabelStockSize($this->denormalizer->denormalize($data['LabelStockSize'], \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class, 'json', $context)); + unset($data['LabelStockSize']); + } + if (\array_key_exists('Instruction', $data)) { + $values = []; + foreach ($data['Instruction'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class, 'json', $context); } - return $data; + $object->setInstruction($values); + unset($data['Instruction']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class => false]; + if (\array_key_exists('CharacterSet', $data)) { + $object->setCharacterSet($data['CharacterSet']); + unset($data['CharacterSet']); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class ShipmentRequestLabelSpecificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class; + $dataArray = []; + $dataArray['LabelImageFormat'] = $this->normalizer->normalize($data->getLabelImageFormat(), 'json', $context); + if ($data->isInitialized('hTTPUserAgent') && null !== $data->getHTTPUserAgent()) { + $dataArray['HTTPUserAgent'] = $data->getHTTPUserAgent(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LabelImageFormat', $data)) { - $object->setLabelImageFormat($this->denormalizer->denormalize($data['LabelImageFormat'], \ShipStream\Ups\Api\Model\LabelSpecificationLabelImageFormat::class, 'json', $context)); - unset($data['LabelImageFormat']); - } - if (\array_key_exists('HTTPUserAgent', $data)) { - $object->setHTTPUserAgent($data['HTTPUserAgent']); - unset($data['HTTPUserAgent']); - } - if (\array_key_exists('LabelStockSize', $data)) { - $object->setLabelStockSize($this->denormalizer->denormalize($data['LabelStockSize'], \ShipStream\Ups\Api\Model\LabelSpecificationLabelStockSize::class, 'json', $context)); - unset($data['LabelStockSize']); - } - if (\array_key_exists('Instruction', $data)) { - $values = []; - foreach ($data['Instruction'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\LabelSpecificationInstruction::class, 'json', $context); - } - $object->setInstruction($values); - unset($data['Instruction']); - } - if (\array_key_exists('CharacterSet', $data)) { - $object->setCharacterSet($data['CharacterSet']); - unset($data['CharacterSet']); + $dataArray['LabelStockSize'] = $this->normalizer->normalize($data->getLabelStockSize(), 'json', $context); + if ($data->isInitialized('instruction') && null !== $data->getInstruction()) { + $values = []; + foreach ($data->getInstruction() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray['Instruction'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['LabelImageFormat'] = $this->normalizer->normalize($object->getLabelImageFormat(), 'json', $context); - if ($object->isInitialized('hTTPUserAgent') && null !== $object->getHTTPUserAgent()) { - $data['HTTPUserAgent'] = $object->getHTTPUserAgent(); - } - $data['LabelStockSize'] = $this->normalizer->normalize($object->getLabelStockSize(), 'json', $context); - if ($object->isInitialized('instruction') && null !== $object->getInstruction()) { - $values = []; - foreach ($object->getInstruction() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Instruction'] = $values; - } - if ($object->isInitialized('characterSet') && null !== $object->getCharacterSet()) { - $data['CharacterSet'] = $object->getCharacterSet(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('characterSet') && null !== $data->getCharacterSet()) { + $dataArray['CharacterSet'] = $data->getCharacterSet(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentRequestNormalizer.php b/src/Api/Normalizer/ShipmentRequestNormalizer.php index 08d24bf7..aa23b4d2 100644 --- a/src/Api/Normalizer/ShipmentRequestNormalizer.php +++ b/src/Api/Normalizer/ShipmentRequestNormalizer.php @@ -5,164 +5,81 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentRequest::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('Shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class, 'json', $context)); - unset($data['Shipment']); - } - if (\array_key_exists('LabelSpecification', $data)) { - $object->setLabelSpecification($this->denormalizer->denormalize($data['LabelSpecification'], \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class, 'json', $context)); - unset($data['LabelSpecification']); - } - if (\array_key_exists('ReceiptSpecification', $data)) { - $object->setReceiptSpecification($this->denormalizer->denormalize($data['ReceiptSpecification'], \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class, 'json', $context)); - unset($data['ReceiptSpecification']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['Shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - if ($object->isInitialized('labelSpecification') && null !== $object->getLabelSpecification()) { - $data['LabelSpecification'] = $this->normalizer->normalize($object->getLabelSpecification(), 'json', $context); - } - if ($object->isInitialized('receiptSpecification') && null !== $object->getReceiptSpecification()) { - $data['ReceiptSpecification'] = $this->normalizer->normalize($object->getReceiptSpecification(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class, 'json', $context)); + unset($data['Request']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentRequest::class => false]; + if (\array_key_exists('Shipment', $data)) { + $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class, 'json', $context)); + unset($data['Shipment']); } - } -} else { - class ShipmentRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentRequest::class; + if (\array_key_exists('LabelSpecification', $data)) { + $object->setLabelSpecification($this->denormalizer->denormalize($data['LabelSpecification'], \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class, 'json', $context)); + unset($data['LabelSpecification']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequest::class; + if (\array_key_exists('ReceiptSpecification', $data)) { + $object->setReceiptSpecification($this->denormalizer->denormalize($data['ReceiptSpecification'], \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class, 'json', $context)); + unset($data['ReceiptSpecification']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('Shipment', $data)) { - $object->setShipment($this->denormalizer->denormalize($data['Shipment'], \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class, 'json', $context)); - unset($data['Shipment']); - } - if (\array_key_exists('LabelSpecification', $data)) { - $object->setLabelSpecification($this->denormalizer->denormalize($data['LabelSpecification'], \ShipStream\Ups\Api\Model\ShipmentRequestLabelSpecification::class, 'json', $context)); - unset($data['LabelSpecification']); - } - if (\array_key_exists('ReceiptSpecification', $data)) { - $object->setReceiptSpecification($this->denormalizer->denormalize($data['ReceiptSpecification'], \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class, 'json', $context)); - unset($data['ReceiptSpecification']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['Shipment'] = $this->normalizer->normalize($object->getShipment(), 'json', $context); - if ($object->isInitialized('labelSpecification') && null !== $object->getLabelSpecification()) { - $data['LabelSpecification'] = $this->normalizer->normalize($object->getLabelSpecification(), 'json', $context); - } - if ($object->isInitialized('receiptSpecification') && null !== $object->getReceiptSpecification()) { - $data['ReceiptSpecification'] = $this->normalizer->normalize($object->getReceiptSpecification(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['Shipment'] = $this->normalizer->normalize($data->getShipment(), 'json', $context); + if ($data->isInitialized('labelSpecification') && null !== $data->getLabelSpecification()) { + $dataArray['LabelSpecification'] = $this->normalizer->normalize($data->getLabelSpecification(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentRequest::class => false]; + if ($data->isInitialized('receiptSpecification') && null !== $data->getReceiptSpecification()) { + $dataArray['ReceiptSpecification'] = $this->normalizer->normalize($data->getReceiptSpecification(), 'json', $context); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentRequestReceiptSpecificationNormalizer.php b/src/Api/Normalizer/ShipmentRequestReceiptSpecificationNormalizer.php index 3925dd87..0f050235 100644 --- a/src/Api/Normalizer/ShipmentRequestReceiptSpecificationNormalizer.php +++ b/src/Api/Normalizer/ShipmentRequestReceiptSpecificationNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentRequestReceiptSpecificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentRequestReceiptSpecificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ImageFormat', $data)) { + $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class, 'json', $context)); + unset($data['ImageFormat']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentRequestReceiptSpecificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['ImageFormat'] = $this->normalizer->normalize($data->getImageFormat(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ReceiptSpecificationImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentRequestReceiptSpecification::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentRequestRequestNormalizer.php b/src/Api/Normalizer/ShipmentRequestRequestNormalizer.php index 78c9c0a6..c31d4318 100644 --- a/src/Api/Normalizer/ShipmentRequestRequestNormalizer.php +++ b/src/Api/Normalizer/ShipmentRequestRequestNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['RequestOption'] = $object->getRequestOption(); - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentRequestRequest::class => false]; + if (\array_key_exists('SubVersion', $data)) { + $object->setSubVersion($data['SubVersion']); + unset($data['SubVersion']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class; + $dataArray = []; + $dataArray['RequestOption'] = $data->getRequestOption(); + if ($data->isInitialized('subVersion') && null !== $data->getSubVersion()) { + $dataArray['SubVersion'] = $data->getSubVersion(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequestRequest::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['RequestOption'] = $object->getRequestOption(); - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentRequestShipmentNormalizer.php b/src/Api/Normalizer/ShipmentRequestShipmentNormalizer.php index 262b7861..24d300a9 100644 --- a/src/Api/Normalizer/ShipmentRequestShipmentNormalizer.php +++ b/src/Api/Normalizer/ShipmentRequestShipmentNormalizer.php @@ -5,694 +5,346 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentRequestShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('ReturnService', $data)) { - $object->setReturnService($this->denormalizer->denormalize($data['ReturnService'], \ShipStream\Ups\Api\Model\ShipmentReturnService::class, 'json', $context)); - unset($data['ReturnService']); - } - if (\array_key_exists('DocumentsOnlyIndicator', $data)) { - $object->setDocumentsOnlyIndicator($data['DocumentsOnlyIndicator']); - unset($data['DocumentsOnlyIndicator']); - } - if (\array_key_exists('Shipper', $data)) { - $object->setShipper($this->denormalizer->denormalize($data['Shipper'], \ShipStream\Ups\Api\Model\ShipmentShipper::class, 'json', $context)); - unset($data['Shipper']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\ShipmentShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('AlternateDeliveryAddress', $data)) { - $object->setAlternateDeliveryAddress($this->denormalizer->denormalize($data['AlternateDeliveryAddress'], \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class, 'json', $context)); - unset($data['AlternateDeliveryAddress']); - } - if (\array_key_exists('ShipFrom', $data)) { - $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\ShipmentShipFrom::class, 'json', $context)); - unset($data['ShipFrom']); - } - if (\array_key_exists('PaymentInformation', $data)) { - $object->setPaymentInformation($this->denormalizer->denormalize($data['PaymentInformation'], \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class, 'json', $context)); - unset($data['PaymentInformation']); - } - if (\array_key_exists('FRSPaymentInformation', $data)) { - $object->setFRSPaymentInformation($this->denormalizer->denormalize($data['FRSPaymentInformation'], \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class, 'json', $context)); - unset($data['FRSPaymentInformation']); - } - if (\array_key_exists('FreightShipmentInformation', $data)) { - $object->setFreightShipmentInformation($this->denormalizer->denormalize($data['FreightShipmentInformation'], \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class, 'json', $context)); - unset($data['FreightShipmentInformation']); - } - if (\array_key_exists('GoodsNotInFreeCirculationIndicator', $data)) { - $object->setGoodsNotInFreeCirculationIndicator($data['GoodsNotInFreeCirculationIndicator']); - unset($data['GoodsNotInFreeCirculationIndicator']); - } - if (\array_key_exists('PromotionalDiscountInformation', $data)) { - $object->setPromotionalDiscountInformation($this->denormalizer->denormalize($data['PromotionalDiscountInformation'], \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class, 'json', $context)); - unset($data['PromotionalDiscountInformation']); - } - if (\array_key_exists('DGSignatoryInfo', $data)) { - $object->setDGSignatoryInfo($this->denormalizer->denormalize($data['DGSignatoryInfo'], \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class, 'json', $context)); - unset($data['DGSignatoryInfo']); - } - if (\array_key_exists('ShipmentRatingOptions', $data)) { - $object->setShipmentRatingOptions($this->denormalizer->denormalize($data['ShipmentRatingOptions'], \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class, 'json', $context)); - unset($data['ShipmentRatingOptions']); - } - if (\array_key_exists('MovementReferenceNumber', $data)) { - $object->setMovementReferenceNumber($data['MovementReferenceNumber']); - unset($data['MovementReferenceNumber']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $values = []; - foreach ($data['ReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class, 'json', $context); - } - $object->setReferenceNumber($values); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('InvoiceLineTotal', $data)) { - $object->setInvoiceLineTotal($this->denormalizer->denormalize($data['InvoiceLineTotal'], \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class, 'json', $context)); - unset($data['InvoiceLineTotal']); - } - if (\array_key_exists('NumOfPiecesInShipment', $data)) { - $object->setNumOfPiecesInShipment($data['NumOfPiecesInShipment']); - unset($data['NumOfPiecesInShipment']); - } - if (\array_key_exists('USPSEndorsement', $data)) { - $object->setUSPSEndorsement($data['USPSEndorsement']); - unset($data['USPSEndorsement']); - } - if (\array_key_exists('MILabelCN22Indicator', $data)) { - $object->setMILabelCN22Indicator($data['MILabelCN22Indicator']); - unset($data['MILabelCN22Indicator']); - } - if (\array_key_exists('SubClassification', $data)) { - $object->setSubClassification($data['SubClassification']); - unset($data['SubClassification']); - } - if (\array_key_exists('CostCenter', $data)) { - $object->setCostCenter($data['CostCenter']); - unset($data['CostCenter']); - } - if (\array_key_exists('CostCenterBarcodeIndicator', $data)) { - $object->setCostCenterBarcodeIndicator($data['CostCenterBarcodeIndicator']); - unset($data['CostCenterBarcodeIndicator']); - } - if (\array_key_exists('PackageID', $data)) { - $object->setPackageID($data['PackageID']); - unset($data['PackageID']); - } - if (\array_key_exists('PackageIDBarcodeIndicator', $data)) { - $object->setPackageIDBarcodeIndicator($data['PackageIDBarcodeIndicator']); - unset($data['PackageIDBarcodeIndicator']); - } - if (\array_key_exists('IrregularIndicator', $data)) { - $object->setIrregularIndicator($data['IrregularIndicator']); - unset($data['IrregularIndicator']); - } - if (\array_key_exists('ShipmentIndicationType', $data)) { - $values_1 = []; - foreach ($data['ShipmentIndicationType'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class, 'json', $context); - } - $object->setShipmentIndicationType($values_1); - unset($data['ShipmentIndicationType']); - } - if (\array_key_exists('MIDualReturnShipmentKey', $data)) { - $object->setMIDualReturnShipmentKey($data['MIDualReturnShipmentKey']); - unset($data['MIDualReturnShipmentKey']); - } - if (\array_key_exists('MIDualReturnShipmentIndicator', $data)) { - $object->setMIDualReturnShipmentIndicator($data['MIDualReturnShipmentIndicator']); - unset($data['MIDualReturnShipmentIndicator']); - } - if (\array_key_exists('RatingMethodRequestedIndicator', $data)) { - $object->setRatingMethodRequestedIndicator($data['RatingMethodRequestedIndicator']); - unset($data['RatingMethodRequestedIndicator']); - } - if (\array_key_exists('TaxInformationIndicator', $data)) { - $object->setTaxInformationIndicator($data['TaxInformationIndicator']); - unset($data['TaxInformationIndicator']); - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - if (\array_key_exists('ShipmentValueThresholdCode', $data)) { - $object->setShipmentValueThresholdCode($data['ShipmentValueThresholdCode']); - unset($data['ShipmentValueThresholdCode']); - } - if (\array_key_exists('MasterCartonID', $data)) { - $object->setMasterCartonID($data['MasterCartonID']); - unset($data['MasterCartonID']); - } - if (\array_key_exists('MasterCartonIndicator', $data)) { - $object->setMasterCartonIndicator($data['MasterCartonIndicator']); - unset($data['MasterCartonIndicator']); - } - if (\array_key_exists('ShipmentDate', $data)) { - $object->setShipmentDate($data['ShipmentDate']); - unset($data['ShipmentDate']); - } - if (\array_key_exists('Package', $data)) { - $values_2 = []; - foreach ($data['Package'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\ShipmentPackage::class, 'json', $context); - } - $object->setPackage($values_2); - unset($data['Package']); - } - foreach ($data as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_3; - } - } + return $type === \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ShipmentRequestShipment(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('returnService') && null !== $object->getReturnService()) { - $data['ReturnService'] = $this->normalizer->normalize($object->getReturnService(), 'json', $context); - } - if ($object->isInitialized('documentsOnlyIndicator') && null !== $object->getDocumentsOnlyIndicator()) { - $data['DocumentsOnlyIndicator'] = $object->getDocumentsOnlyIndicator(); - } - $data['Shipper'] = $this->normalizer->normalize($object->getShipper(), 'json', $context); - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - if ($object->isInitialized('alternateDeliveryAddress') && null !== $object->getAlternateDeliveryAddress()) { - $data['AlternateDeliveryAddress'] = $this->normalizer->normalize($object->getAlternateDeliveryAddress(), 'json', $context); - } - if ($object->isInitialized('shipFrom') && null !== $object->getShipFrom()) { - $data['ShipFrom'] = $this->normalizer->normalize($object->getShipFrom(), 'json', $context); - } - if ($object->isInitialized('paymentInformation') && null !== $object->getPaymentInformation()) { - $data['PaymentInformation'] = $this->normalizer->normalize($object->getPaymentInformation(), 'json', $context); - } - if ($object->isInitialized('fRSPaymentInformation') && null !== $object->getFRSPaymentInformation()) { - $data['FRSPaymentInformation'] = $this->normalizer->normalize($object->getFRSPaymentInformation(), 'json', $context); - } - if ($object->isInitialized('freightShipmentInformation') && null !== $object->getFreightShipmentInformation()) { - $data['FreightShipmentInformation'] = $this->normalizer->normalize($object->getFreightShipmentInformation(), 'json', $context); - } - if ($object->isInitialized('goodsNotInFreeCirculationIndicator') && null !== $object->getGoodsNotInFreeCirculationIndicator()) { - $data['GoodsNotInFreeCirculationIndicator'] = $object->getGoodsNotInFreeCirculationIndicator(); - } - if ($object->isInitialized('promotionalDiscountInformation') && null !== $object->getPromotionalDiscountInformation()) { - $data['PromotionalDiscountInformation'] = $this->normalizer->normalize($object->getPromotionalDiscountInformation(), 'json', $context); - } - if ($object->isInitialized('dGSignatoryInfo') && null !== $object->getDGSignatoryInfo()) { - $data['DGSignatoryInfo'] = $this->normalizer->normalize($object->getDGSignatoryInfo(), 'json', $context); - } - if ($object->isInitialized('shipmentRatingOptions') && null !== $object->getShipmentRatingOptions()) { - $data['ShipmentRatingOptions'] = $this->normalizer->normalize($object->getShipmentRatingOptions(), 'json', $context); - } - if ($object->isInitialized('movementReferenceNumber') && null !== $object->getMovementReferenceNumber()) { - $data['MovementReferenceNumber'] = $object->getMovementReferenceNumber(); - } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $values = []; - foreach ($object->getReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ReferenceNumber'] = $values; - } - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - if ($object->isInitialized('invoiceLineTotal') && null !== $object->getInvoiceLineTotal()) { - $data['InvoiceLineTotal'] = $this->normalizer->normalize($object->getInvoiceLineTotal(), 'json', $context); - } - if ($object->isInitialized('numOfPiecesInShipment') && null !== $object->getNumOfPiecesInShipment()) { - $data['NumOfPiecesInShipment'] = $object->getNumOfPiecesInShipment(); - } - if ($object->isInitialized('uSPSEndorsement') && null !== $object->getUSPSEndorsement()) { - $data['USPSEndorsement'] = $object->getUSPSEndorsement(); - } - if ($object->isInitialized('mILabelCN22Indicator') && null !== $object->getMILabelCN22Indicator()) { - $data['MILabelCN22Indicator'] = $object->getMILabelCN22Indicator(); - } - if ($object->isInitialized('subClassification') && null !== $object->getSubClassification()) { - $data['SubClassification'] = $object->getSubClassification(); - } - if ($object->isInitialized('costCenter') && null !== $object->getCostCenter()) { - $data['CostCenter'] = $object->getCostCenter(); - } - if ($object->isInitialized('costCenterBarcodeIndicator') && null !== $object->getCostCenterBarcodeIndicator()) { - $data['CostCenterBarcodeIndicator'] = $object->getCostCenterBarcodeIndicator(); - } - if ($object->isInitialized('packageID') && null !== $object->getPackageID()) { - $data['PackageID'] = $object->getPackageID(); - } - if ($object->isInitialized('packageIDBarcodeIndicator') && null !== $object->getPackageIDBarcodeIndicator()) { - $data['PackageIDBarcodeIndicator'] = $object->getPackageIDBarcodeIndicator(); - } - if ($object->isInitialized('irregularIndicator') && null !== $object->getIrregularIndicator()) { - $data['IrregularIndicator'] = $object->getIrregularIndicator(); - } - if ($object->isInitialized('shipmentIndicationType') && null !== $object->getShipmentIndicationType()) { - $values_1 = []; - foreach ($object->getShipmentIndicationType() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ShipmentIndicationType'] = $values_1; - } - if ($object->isInitialized('mIDualReturnShipmentKey') && null !== $object->getMIDualReturnShipmentKey()) { - $data['MIDualReturnShipmentKey'] = $object->getMIDualReturnShipmentKey(); - } - if ($object->isInitialized('mIDualReturnShipmentIndicator') && null !== $object->getMIDualReturnShipmentIndicator()) { - $data['MIDualReturnShipmentIndicator'] = $object->getMIDualReturnShipmentIndicator(); - } - if ($object->isInitialized('ratingMethodRequestedIndicator') && null !== $object->getRatingMethodRequestedIndicator()) { - $data['RatingMethodRequestedIndicator'] = $object->getRatingMethodRequestedIndicator(); - } - if ($object->isInitialized('taxInformationIndicator') && null !== $object->getTaxInformationIndicator()) { - $data['TaxInformationIndicator'] = $object->getTaxInformationIndicator(); - } - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('locale') && null !== $object->getLocale()) { - $data['Locale'] = $object->getLocale(); - } - if ($object->isInitialized('shipmentValueThresholdCode') && null !== $object->getShipmentValueThresholdCode()) { - $data['ShipmentValueThresholdCode'] = $object->getShipmentValueThresholdCode(); - } - if ($object->isInitialized('masterCartonID') && null !== $object->getMasterCartonID()) { - $data['MasterCartonID'] = $object->getMasterCartonID(); - } - if ($object->isInitialized('masterCartonIndicator') && null !== $object->getMasterCartonIndicator()) { - $data['MasterCartonIndicator'] = $object->getMasterCartonIndicator(); + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); + } + if (\array_key_exists('ReturnService', $data)) { + $object->setReturnService($this->denormalizer->denormalize($data['ReturnService'], \ShipStream\Ups\Api\Model\ShipmentReturnService::class, 'json', $context)); + unset($data['ReturnService']); + } + if (\array_key_exists('DocumentsOnlyIndicator', $data)) { + $object->setDocumentsOnlyIndicator($data['DocumentsOnlyIndicator']); + unset($data['DocumentsOnlyIndicator']); + } + if (\array_key_exists('Shipper', $data)) { + $object->setShipper($this->denormalizer->denormalize($data['Shipper'], \ShipStream\Ups\Api\Model\ShipmentShipper::class, 'json', $context)); + unset($data['Shipper']); + } + if (\array_key_exists('ShipTo', $data)) { + $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\ShipmentShipTo::class, 'json', $context)); + unset($data['ShipTo']); + } + if (\array_key_exists('AlternateDeliveryAddress', $data)) { + $object->setAlternateDeliveryAddress($this->denormalizer->denormalize($data['AlternateDeliveryAddress'], \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class, 'json', $context)); + unset($data['AlternateDeliveryAddress']); + } + if (\array_key_exists('ShipFrom', $data)) { + $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\ShipmentShipFrom::class, 'json', $context)); + unset($data['ShipFrom']); + } + if (\array_key_exists('PaymentInformation', $data)) { + $object->setPaymentInformation($this->denormalizer->denormalize($data['PaymentInformation'], \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class, 'json', $context)); + unset($data['PaymentInformation']); + } + if (\array_key_exists('FRSPaymentInformation', $data)) { + $object->setFRSPaymentInformation($this->denormalizer->denormalize($data['FRSPaymentInformation'], \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class, 'json', $context)); + unset($data['FRSPaymentInformation']); + } + if (\array_key_exists('FreightShipmentInformation', $data)) { + $object->setFreightShipmentInformation($this->denormalizer->denormalize($data['FreightShipmentInformation'], \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class, 'json', $context)); + unset($data['FreightShipmentInformation']); + } + if (\array_key_exists('GoodsNotInFreeCirculationIndicator', $data)) { + $object->setGoodsNotInFreeCirculationIndicator($data['GoodsNotInFreeCirculationIndicator']); + unset($data['GoodsNotInFreeCirculationIndicator']); + } + if (\array_key_exists('PromotionalDiscountInformation', $data)) { + $object->setPromotionalDiscountInformation($this->denormalizer->denormalize($data['PromotionalDiscountInformation'], \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class, 'json', $context)); + unset($data['PromotionalDiscountInformation']); + } + if (\array_key_exists('DGSignatoryInfo', $data)) { + $object->setDGSignatoryInfo($this->denormalizer->denormalize($data['DGSignatoryInfo'], \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class, 'json', $context)); + unset($data['DGSignatoryInfo']); + } + if (\array_key_exists('ShipmentRatingOptions', $data)) { + $object->setShipmentRatingOptions($this->denormalizer->denormalize($data['ShipmentRatingOptions'], \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class, 'json', $context)); + unset($data['ShipmentRatingOptions']); + } + if (\array_key_exists('MovementReferenceNumber', $data)) { + $object->setMovementReferenceNumber($data['MovementReferenceNumber']); + unset($data['MovementReferenceNumber']); + } + if (\array_key_exists('ReferenceNumber', $data)) { + $values = []; + foreach ($data['ReferenceNumber'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class, 'json', $context); } - if ($object->isInitialized('shipmentDate') && null !== $object->getShipmentDate()) { - $data['ShipmentDate'] = $object->getShipmentDate(); + $object->setReferenceNumber($values); + unset($data['ReferenceNumber']); + } + if (\array_key_exists('Service', $data)) { + $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); + unset($data['Service']); + } + if (\array_key_exists('InvoiceLineTotal', $data)) { + $object->setInvoiceLineTotal($this->denormalizer->denormalize($data['InvoiceLineTotal'], \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class, 'json', $context)); + unset($data['InvoiceLineTotal']); + } + if (\array_key_exists('NumOfPiecesInShipment', $data)) { + $object->setNumOfPiecesInShipment($data['NumOfPiecesInShipment']); + unset($data['NumOfPiecesInShipment']); + } + if (\array_key_exists('USPSEndorsement', $data)) { + $object->setUSPSEndorsement($data['USPSEndorsement']); + unset($data['USPSEndorsement']); + } + if (\array_key_exists('MILabelCN22Indicator', $data)) { + $object->setMILabelCN22Indicator($data['MILabelCN22Indicator']); + unset($data['MILabelCN22Indicator']); + } + if (\array_key_exists('SubClassification', $data)) { + $object->setSubClassification($data['SubClassification']); + unset($data['SubClassification']); + } + if (\array_key_exists('CostCenter', $data)) { + $object->setCostCenter($data['CostCenter']); + unset($data['CostCenter']); + } + if (\array_key_exists('CostCenterBarcodeIndicator', $data)) { + $object->setCostCenterBarcodeIndicator($data['CostCenterBarcodeIndicator']); + unset($data['CostCenterBarcodeIndicator']); + } + if (\array_key_exists('PackageID', $data)) { + $object->setPackageID($data['PackageID']); + unset($data['PackageID']); + } + if (\array_key_exists('PackageIDBarcodeIndicator', $data)) { + $object->setPackageIDBarcodeIndicator($data['PackageIDBarcodeIndicator']); + unset($data['PackageIDBarcodeIndicator']); + } + if (\array_key_exists('IrregularIndicator', $data)) { + $object->setIrregularIndicator($data['IrregularIndicator']); + unset($data['IrregularIndicator']); + } + if (\array_key_exists('ShipmentIndicationType', $data)) { + $values_1 = []; + foreach ($data['ShipmentIndicationType'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class, 'json', $context); } + $object->setShipmentIndicationType($values_1); + unset($data['ShipmentIndicationType']); + } + if (\array_key_exists('MIDualReturnShipmentKey', $data)) { + $object->setMIDualReturnShipmentKey($data['MIDualReturnShipmentKey']); + unset($data['MIDualReturnShipmentKey']); + } + if (\array_key_exists('MIDualReturnShipmentIndicator', $data)) { + $object->setMIDualReturnShipmentIndicator($data['MIDualReturnShipmentIndicator']); + unset($data['MIDualReturnShipmentIndicator']); + } + if (\array_key_exists('RatingMethodRequestedIndicator', $data)) { + $object->setRatingMethodRequestedIndicator($data['RatingMethodRequestedIndicator']); + unset($data['RatingMethodRequestedIndicator']); + } + if (\array_key_exists('TaxInformationIndicator', $data)) { + $object->setTaxInformationIndicator($data['TaxInformationIndicator']); + unset($data['TaxInformationIndicator']); + } + if (\array_key_exists('ShipmentServiceOptions', $data)) { + $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class, 'json', $context)); + unset($data['ShipmentServiceOptions']); + } + if (\array_key_exists('Locale', $data)) { + $object->setLocale($data['Locale']); + unset($data['Locale']); + } + if (\array_key_exists('ShipmentValueThresholdCode', $data)) { + $object->setShipmentValueThresholdCode($data['ShipmentValueThresholdCode']); + unset($data['ShipmentValueThresholdCode']); + } + if (\array_key_exists('MasterCartonID', $data)) { + $object->setMasterCartonID($data['MasterCartonID']); + unset($data['MasterCartonID']); + } + if (\array_key_exists('MasterCartonIndicator', $data)) { + $object->setMasterCartonIndicator($data['MasterCartonIndicator']); + unset($data['MasterCartonIndicator']); + } + if (\array_key_exists('ShipmentDate', $data)) { + $object->setShipmentDate($data['ShipmentDate']); + unset($data['ShipmentDate']); + } + if (\array_key_exists('Package', $data)) { $values_2 = []; - foreach ($object->getPackage() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); + foreach ($data['Package'] as $value_2) { + $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\ShipmentPackage::class, 'json', $context); } - $data['Package'] = $values_2; - foreach ($object as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_3; - } - } - return $data; + $object->setPackage($values_2); + unset($data['Package']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentRequestShipment::class => false]; + foreach ($data as $key => $value_3) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_3; + } } + return $object; } -} else { - class ShipmentRequestShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentRequestShipment::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentRequestShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('ReturnService', $data)) { - $object->setReturnService($this->denormalizer->denormalize($data['ReturnService'], \ShipStream\Ups\Api\Model\ShipmentReturnService::class, 'json', $context)); - unset($data['ReturnService']); - } - if (\array_key_exists('DocumentsOnlyIndicator', $data)) { - $object->setDocumentsOnlyIndicator($data['DocumentsOnlyIndicator']); - unset($data['DocumentsOnlyIndicator']); - } - if (\array_key_exists('Shipper', $data)) { - $object->setShipper($this->denormalizer->denormalize($data['Shipper'], \ShipStream\Ups\Api\Model\ShipmentShipper::class, 'json', $context)); - unset($data['Shipper']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\ShipmentShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('AlternateDeliveryAddress', $data)) { - $object->setAlternateDeliveryAddress($this->denormalizer->denormalize($data['AlternateDeliveryAddress'], \ShipStream\Ups\Api\Model\ShipmentAlternateDeliveryAddress::class, 'json', $context)); - unset($data['AlternateDeliveryAddress']); - } - if (\array_key_exists('ShipFrom', $data)) { - $object->setShipFrom($this->denormalizer->denormalize($data['ShipFrom'], \ShipStream\Ups\Api\Model\ShipmentShipFrom::class, 'json', $context)); - unset($data['ShipFrom']); - } - if (\array_key_exists('PaymentInformation', $data)) { - $object->setPaymentInformation($this->denormalizer->denormalize($data['PaymentInformation'], \ShipStream\Ups\Api\Model\ShipmentPaymentInformation::class, 'json', $context)); - unset($data['PaymentInformation']); - } - if (\array_key_exists('FRSPaymentInformation', $data)) { - $object->setFRSPaymentInformation($this->denormalizer->denormalize($data['FRSPaymentInformation'], \ShipStream\Ups\Api\Model\ShipmentFRSPaymentInformation::class, 'json', $context)); - unset($data['FRSPaymentInformation']); - } - if (\array_key_exists('FreightShipmentInformation', $data)) { - $object->setFreightShipmentInformation($this->denormalizer->denormalize($data['FreightShipmentInformation'], \ShipStream\Ups\Api\Model\ShipmentFreightShipmentInformation::class, 'json', $context)); - unset($data['FreightShipmentInformation']); - } - if (\array_key_exists('GoodsNotInFreeCirculationIndicator', $data)) { - $object->setGoodsNotInFreeCirculationIndicator($data['GoodsNotInFreeCirculationIndicator']); - unset($data['GoodsNotInFreeCirculationIndicator']); - } - if (\array_key_exists('PromotionalDiscountInformation', $data)) { - $object->setPromotionalDiscountInformation($this->denormalizer->denormalize($data['PromotionalDiscountInformation'], \ShipStream\Ups\Api\Model\ShipmentPromotionalDiscountInformation::class, 'json', $context)); - unset($data['PromotionalDiscountInformation']); - } - if (\array_key_exists('DGSignatoryInfo', $data)) { - $object->setDGSignatoryInfo($this->denormalizer->denormalize($data['DGSignatoryInfo'], \ShipStream\Ups\Api\Model\ShipmentDGSignatoryInfo::class, 'json', $context)); - unset($data['DGSignatoryInfo']); - } - if (\array_key_exists('ShipmentRatingOptions', $data)) { - $object->setShipmentRatingOptions($this->denormalizer->denormalize($data['ShipmentRatingOptions'], \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class, 'json', $context)); - unset($data['ShipmentRatingOptions']); - } - if (\array_key_exists('MovementReferenceNumber', $data)) { - $object->setMovementReferenceNumber($data['MovementReferenceNumber']); - unset($data['MovementReferenceNumber']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $values = []; - foreach ($data['ReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentReferenceNumber::class, 'json', $context); - } - $object->setReferenceNumber($values); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ShipmentService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('InvoiceLineTotal', $data)) { - $object->setInvoiceLineTotal($this->denormalizer->denormalize($data['InvoiceLineTotal'], \ShipStream\Ups\Api\Model\ShipmentInvoiceLineTotal::class, 'json', $context)); - unset($data['InvoiceLineTotal']); - } - if (\array_key_exists('NumOfPiecesInShipment', $data)) { - $object->setNumOfPiecesInShipment($data['NumOfPiecesInShipment']); - unset($data['NumOfPiecesInShipment']); - } - if (\array_key_exists('USPSEndorsement', $data)) { - $object->setUSPSEndorsement($data['USPSEndorsement']); - unset($data['USPSEndorsement']); - } - if (\array_key_exists('MILabelCN22Indicator', $data)) { - $object->setMILabelCN22Indicator($data['MILabelCN22Indicator']); - unset($data['MILabelCN22Indicator']); - } - if (\array_key_exists('SubClassification', $data)) { - $object->setSubClassification($data['SubClassification']); - unset($data['SubClassification']); - } - if (\array_key_exists('CostCenter', $data)) { - $object->setCostCenter($data['CostCenter']); - unset($data['CostCenter']); - } - if (\array_key_exists('CostCenterBarcodeIndicator', $data)) { - $object->setCostCenterBarcodeIndicator($data['CostCenterBarcodeIndicator']); - unset($data['CostCenterBarcodeIndicator']); - } - if (\array_key_exists('PackageID', $data)) { - $object->setPackageID($data['PackageID']); - unset($data['PackageID']); - } - if (\array_key_exists('PackageIDBarcodeIndicator', $data)) { - $object->setPackageIDBarcodeIndicator($data['PackageIDBarcodeIndicator']); - unset($data['PackageIDBarcodeIndicator']); - } - if (\array_key_exists('IrregularIndicator', $data)) { - $object->setIrregularIndicator($data['IrregularIndicator']); - unset($data['IrregularIndicator']); - } - if (\array_key_exists('ShipmentIndicationType', $data)) { - $values_1 = []; - foreach ($data['ShipmentIndicationType'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class, 'json', $context); - } - $object->setShipmentIndicationType($values_1); - unset($data['ShipmentIndicationType']); - } - if (\array_key_exists('MIDualReturnShipmentKey', $data)) { - $object->setMIDualReturnShipmentKey($data['MIDualReturnShipmentKey']); - unset($data['MIDualReturnShipmentKey']); - } - if (\array_key_exists('MIDualReturnShipmentIndicator', $data)) { - $object->setMIDualReturnShipmentIndicator($data['MIDualReturnShipmentIndicator']); - unset($data['MIDualReturnShipmentIndicator']); - } - if (\array_key_exists('RatingMethodRequestedIndicator', $data)) { - $object->setRatingMethodRequestedIndicator($data['RatingMethodRequestedIndicator']); - unset($data['RatingMethodRequestedIndicator']); - } - if (\array_key_exists('TaxInformationIndicator', $data)) { - $object->setTaxInformationIndicator($data['TaxInformationIndicator']); - unset($data['TaxInformationIndicator']); - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($data['Locale']); - unset($data['Locale']); - } - if (\array_key_exists('ShipmentValueThresholdCode', $data)) { - $object->setShipmentValueThresholdCode($data['ShipmentValueThresholdCode']); - unset($data['ShipmentValueThresholdCode']); - } - if (\array_key_exists('MasterCartonID', $data)) { - $object->setMasterCartonID($data['MasterCartonID']); - unset($data['MasterCartonID']); - } - if (\array_key_exists('MasterCartonIndicator', $data)) { - $object->setMasterCartonIndicator($data['MasterCartonIndicator']); - unset($data['MasterCartonIndicator']); - } - if (\array_key_exists('ShipmentDate', $data)) { - $object->setShipmentDate($data['ShipmentDate']); - unset($data['ShipmentDate']); - } - if (\array_key_exists('Package', $data)) { - $values_2 = []; - foreach ($data['Package'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\ShipmentPackage::class, 'json', $context); - } - $object->setPackage($values_2); - unset($data['Package']); - } - foreach ($data as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_3; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - if ($object->isInitialized('returnService') && null !== $object->getReturnService()) { - $data['ReturnService'] = $this->normalizer->normalize($object->getReturnService(), 'json', $context); - } - if ($object->isInitialized('documentsOnlyIndicator') && null !== $object->getDocumentsOnlyIndicator()) { - $data['DocumentsOnlyIndicator'] = $object->getDocumentsOnlyIndicator(); - } - $data['Shipper'] = $this->normalizer->normalize($object->getShipper(), 'json', $context); - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - if ($object->isInitialized('alternateDeliveryAddress') && null !== $object->getAlternateDeliveryAddress()) { - $data['AlternateDeliveryAddress'] = $this->normalizer->normalize($object->getAlternateDeliveryAddress(), 'json', $context); - } - if ($object->isInitialized('shipFrom') && null !== $object->getShipFrom()) { - $data['ShipFrom'] = $this->normalizer->normalize($object->getShipFrom(), 'json', $context); - } - if ($object->isInitialized('paymentInformation') && null !== $object->getPaymentInformation()) { - $data['PaymentInformation'] = $this->normalizer->normalize($object->getPaymentInformation(), 'json', $context); - } - if ($object->isInitialized('fRSPaymentInformation') && null !== $object->getFRSPaymentInformation()) { - $data['FRSPaymentInformation'] = $this->normalizer->normalize($object->getFRSPaymentInformation(), 'json', $context); - } - if ($object->isInitialized('freightShipmentInformation') && null !== $object->getFreightShipmentInformation()) { - $data['FreightShipmentInformation'] = $this->normalizer->normalize($object->getFreightShipmentInformation(), 'json', $context); - } - if ($object->isInitialized('goodsNotInFreeCirculationIndicator') && null !== $object->getGoodsNotInFreeCirculationIndicator()) { - $data['GoodsNotInFreeCirculationIndicator'] = $object->getGoodsNotInFreeCirculationIndicator(); - } - if ($object->isInitialized('promotionalDiscountInformation') && null !== $object->getPromotionalDiscountInformation()) { - $data['PromotionalDiscountInformation'] = $this->normalizer->normalize($object->getPromotionalDiscountInformation(), 'json', $context); - } - if ($object->isInitialized('dGSignatoryInfo') && null !== $object->getDGSignatoryInfo()) { - $data['DGSignatoryInfo'] = $this->normalizer->normalize($object->getDGSignatoryInfo(), 'json', $context); - } - if ($object->isInitialized('shipmentRatingOptions') && null !== $object->getShipmentRatingOptions()) { - $data['ShipmentRatingOptions'] = $this->normalizer->normalize($object->getShipmentRatingOptions(), 'json', $context); - } - if ($object->isInitialized('movementReferenceNumber') && null !== $object->getMovementReferenceNumber()) { - $data['MovementReferenceNumber'] = $object->getMovementReferenceNumber(); - } - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $values = []; - foreach ($object->getReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ReferenceNumber'] = $values; - } - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - if ($object->isInitialized('invoiceLineTotal') && null !== $object->getInvoiceLineTotal()) { - $data['InvoiceLineTotal'] = $this->normalizer->normalize($object->getInvoiceLineTotal(), 'json', $context); - } - if ($object->isInitialized('numOfPiecesInShipment') && null !== $object->getNumOfPiecesInShipment()) { - $data['NumOfPiecesInShipment'] = $object->getNumOfPiecesInShipment(); - } - if ($object->isInitialized('uSPSEndorsement') && null !== $object->getUSPSEndorsement()) { - $data['USPSEndorsement'] = $object->getUSPSEndorsement(); - } - if ($object->isInitialized('mILabelCN22Indicator') && null !== $object->getMILabelCN22Indicator()) { - $data['MILabelCN22Indicator'] = $object->getMILabelCN22Indicator(); - } - if ($object->isInitialized('subClassification') && null !== $object->getSubClassification()) { - $data['SubClassification'] = $object->getSubClassification(); - } - if ($object->isInitialized('costCenter') && null !== $object->getCostCenter()) { - $data['CostCenter'] = $object->getCostCenter(); - } - if ($object->isInitialized('costCenterBarcodeIndicator') && null !== $object->getCostCenterBarcodeIndicator()) { - $data['CostCenterBarcodeIndicator'] = $object->getCostCenterBarcodeIndicator(); - } - if ($object->isInitialized('packageID') && null !== $object->getPackageID()) { - $data['PackageID'] = $object->getPackageID(); - } - if ($object->isInitialized('packageIDBarcodeIndicator') && null !== $object->getPackageIDBarcodeIndicator()) { - $data['PackageIDBarcodeIndicator'] = $object->getPackageIDBarcodeIndicator(); - } - if ($object->isInitialized('irregularIndicator') && null !== $object->getIrregularIndicator()) { - $data['IrregularIndicator'] = $object->getIrregularIndicator(); - } - if ($object->isInitialized('shipmentIndicationType') && null !== $object->getShipmentIndicationType()) { - $values_1 = []; - foreach ($object->getShipmentIndicationType() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ShipmentIndicationType'] = $values_1; - } - if ($object->isInitialized('mIDualReturnShipmentKey') && null !== $object->getMIDualReturnShipmentKey()) { - $data['MIDualReturnShipmentKey'] = $object->getMIDualReturnShipmentKey(); - } - if ($object->isInitialized('mIDualReturnShipmentIndicator') && null !== $object->getMIDualReturnShipmentIndicator()) { - $data['MIDualReturnShipmentIndicator'] = $object->getMIDualReturnShipmentIndicator(); - } - if ($object->isInitialized('ratingMethodRequestedIndicator') && null !== $object->getRatingMethodRequestedIndicator()) { - $data['RatingMethodRequestedIndicator'] = $object->getRatingMethodRequestedIndicator(); - } - if ($object->isInitialized('taxInformationIndicator') && null !== $object->getTaxInformationIndicator()) { - $data['TaxInformationIndicator'] = $object->getTaxInformationIndicator(); - } - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('locale') && null !== $object->getLocale()) { - $data['Locale'] = $object->getLocale(); - } - if ($object->isInitialized('shipmentValueThresholdCode') && null !== $object->getShipmentValueThresholdCode()) { - $data['ShipmentValueThresholdCode'] = $object->getShipmentValueThresholdCode(); - } - if ($object->isInitialized('masterCartonID') && null !== $object->getMasterCartonID()) { - $data['MasterCartonID'] = $object->getMasterCartonID(); - } - if ($object->isInitialized('masterCartonIndicator') && null !== $object->getMasterCartonIndicator()) { - $data['MasterCartonIndicator'] = $object->getMasterCartonIndicator(); - } - if ($object->isInitialized('shipmentDate') && null !== $object->getShipmentDate()) { - $data['ShipmentDate'] = $object->getShipmentDate(); - } - $values_2 = []; - foreach ($object->getPackage() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); + if ($data->isInitialized('returnService') && null !== $data->getReturnService()) { + $dataArray['ReturnService'] = $this->normalizer->normalize($data->getReturnService(), 'json', $context); + } + if ($data->isInitialized('documentsOnlyIndicator') && null !== $data->getDocumentsOnlyIndicator()) { + $dataArray['DocumentsOnlyIndicator'] = $data->getDocumentsOnlyIndicator(); + } + $dataArray['Shipper'] = $this->normalizer->normalize($data->getShipper(), 'json', $context); + $dataArray['ShipTo'] = $this->normalizer->normalize($data->getShipTo(), 'json', $context); + if ($data->isInitialized('alternateDeliveryAddress') && null !== $data->getAlternateDeliveryAddress()) { + $dataArray['AlternateDeliveryAddress'] = $this->normalizer->normalize($data->getAlternateDeliveryAddress(), 'json', $context); + } + if ($data->isInitialized('shipFrom') && null !== $data->getShipFrom()) { + $dataArray['ShipFrom'] = $this->normalizer->normalize($data->getShipFrom(), 'json', $context); + } + if ($data->isInitialized('paymentInformation') && null !== $data->getPaymentInformation()) { + $dataArray['PaymentInformation'] = $this->normalizer->normalize($data->getPaymentInformation(), 'json', $context); + } + if ($data->isInitialized('fRSPaymentInformation') && null !== $data->getFRSPaymentInformation()) { + $dataArray['FRSPaymentInformation'] = $this->normalizer->normalize($data->getFRSPaymentInformation(), 'json', $context); + } + if ($data->isInitialized('freightShipmentInformation') && null !== $data->getFreightShipmentInformation()) { + $dataArray['FreightShipmentInformation'] = $this->normalizer->normalize($data->getFreightShipmentInformation(), 'json', $context); + } + if ($data->isInitialized('goodsNotInFreeCirculationIndicator') && null !== $data->getGoodsNotInFreeCirculationIndicator()) { + $dataArray['GoodsNotInFreeCirculationIndicator'] = $data->getGoodsNotInFreeCirculationIndicator(); + } + if ($data->isInitialized('promotionalDiscountInformation') && null !== $data->getPromotionalDiscountInformation()) { + $dataArray['PromotionalDiscountInformation'] = $this->normalizer->normalize($data->getPromotionalDiscountInformation(), 'json', $context); + } + if ($data->isInitialized('dGSignatoryInfo') && null !== $data->getDGSignatoryInfo()) { + $dataArray['DGSignatoryInfo'] = $this->normalizer->normalize($data->getDGSignatoryInfo(), 'json', $context); + } + if ($data->isInitialized('shipmentRatingOptions') && null !== $data->getShipmentRatingOptions()) { + $dataArray['ShipmentRatingOptions'] = $this->normalizer->normalize($data->getShipmentRatingOptions(), 'json', $context); + } + if ($data->isInitialized('movementReferenceNumber') && null !== $data->getMovementReferenceNumber()) { + $dataArray['MovementReferenceNumber'] = $data->getMovementReferenceNumber(); + } + if ($data->isInitialized('referenceNumber') && null !== $data->getReferenceNumber()) { + $values = []; + foreach ($data->getReferenceNumber() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $data['Package'] = $values_2; - foreach ($object as $key => $value_3) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_3; - } + $dataArray['ReferenceNumber'] = $values; + } + $dataArray['Service'] = $this->normalizer->normalize($data->getService(), 'json', $context); + if ($data->isInitialized('invoiceLineTotal') && null !== $data->getInvoiceLineTotal()) { + $dataArray['InvoiceLineTotal'] = $this->normalizer->normalize($data->getInvoiceLineTotal(), 'json', $context); + } + if ($data->isInitialized('numOfPiecesInShipment') && null !== $data->getNumOfPiecesInShipment()) { + $dataArray['NumOfPiecesInShipment'] = $data->getNumOfPiecesInShipment(); + } + if ($data->isInitialized('uSPSEndorsement') && null !== $data->getUSPSEndorsement()) { + $dataArray['USPSEndorsement'] = $data->getUSPSEndorsement(); + } + if ($data->isInitialized('mILabelCN22Indicator') && null !== $data->getMILabelCN22Indicator()) { + $dataArray['MILabelCN22Indicator'] = $data->getMILabelCN22Indicator(); + } + if ($data->isInitialized('subClassification') && null !== $data->getSubClassification()) { + $dataArray['SubClassification'] = $data->getSubClassification(); + } + if ($data->isInitialized('costCenter') && null !== $data->getCostCenter()) { + $dataArray['CostCenter'] = $data->getCostCenter(); + } + if ($data->isInitialized('costCenterBarcodeIndicator') && null !== $data->getCostCenterBarcodeIndicator()) { + $dataArray['CostCenterBarcodeIndicator'] = $data->getCostCenterBarcodeIndicator(); + } + if ($data->isInitialized('packageID') && null !== $data->getPackageID()) { + $dataArray['PackageID'] = $data->getPackageID(); + } + if ($data->isInitialized('packageIDBarcodeIndicator') && null !== $data->getPackageIDBarcodeIndicator()) { + $dataArray['PackageIDBarcodeIndicator'] = $data->getPackageIDBarcodeIndicator(); + } + if ($data->isInitialized('irregularIndicator') && null !== $data->getIrregularIndicator()) { + $dataArray['IrregularIndicator'] = $data->getIrregularIndicator(); + } + if ($data->isInitialized('shipmentIndicationType') && null !== $data->getShipmentIndicationType()) { + $values_1 = []; + foreach ($data->getShipmentIndicationType() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['ShipmentIndicationType'] = $values_1; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentRequestShipment::class => false]; + if ($data->isInitialized('mIDualReturnShipmentKey') && null !== $data->getMIDualReturnShipmentKey()) { + $dataArray['MIDualReturnShipmentKey'] = $data->getMIDualReturnShipmentKey(); } + if ($data->isInitialized('mIDualReturnShipmentIndicator') && null !== $data->getMIDualReturnShipmentIndicator()) { + $dataArray['MIDualReturnShipmentIndicator'] = $data->getMIDualReturnShipmentIndicator(); + } + if ($data->isInitialized('ratingMethodRequestedIndicator') && null !== $data->getRatingMethodRequestedIndicator()) { + $dataArray['RatingMethodRequestedIndicator'] = $data->getRatingMethodRequestedIndicator(); + } + if ($data->isInitialized('taxInformationIndicator') && null !== $data->getTaxInformationIndicator()) { + $dataArray['TaxInformationIndicator'] = $data->getTaxInformationIndicator(); + } + if ($data->isInitialized('shipmentServiceOptions') && null !== $data->getShipmentServiceOptions()) { + $dataArray['ShipmentServiceOptions'] = $this->normalizer->normalize($data->getShipmentServiceOptions(), 'json', $context); + } + if ($data->isInitialized('locale') && null !== $data->getLocale()) { + $dataArray['Locale'] = $data->getLocale(); + } + if ($data->isInitialized('shipmentValueThresholdCode') && null !== $data->getShipmentValueThresholdCode()) { + $dataArray['ShipmentValueThresholdCode'] = $data->getShipmentValueThresholdCode(); + } + if ($data->isInitialized('masterCartonID') && null !== $data->getMasterCartonID()) { + $dataArray['MasterCartonID'] = $data->getMasterCartonID(); + } + if ($data->isInitialized('masterCartonIndicator') && null !== $data->getMasterCartonIndicator()) { + $dataArray['MasterCartonIndicator'] = $data->getMasterCartonIndicator(); + } + if ($data->isInitialized('shipmentDate') && null !== $data->getShipmentDate()) { + $dataArray['ShipmentDate'] = $data->getShipmentDate(); + } + $values_2 = []; + foreach ($data->getPackage() as $value_2) { + $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); + } + $dataArray['Package'] = $values_2; + foreach ($data as $key => $value_3) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_3; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentRequestShipment::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResponseNormalizer.php b/src/Api/Normalizer/ShipmentResponseNormalizer.php index 9c25140b..e0d9ad9c 100644 --- a/src/Api/Normalizer/ShipmentResponseNormalizer.php +++ b/src/Api/Normalizer/ShipmentResponseNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResponse::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('ShipmentResults', $data)) { - $object->setShipmentResults($this->denormalizer->denormalize($data['ShipmentResults'], \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class, 'json', $context)); - unset($data['ShipmentResults']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['ShipmentResults'] = $this->normalizer->normalize($object->getShipmentResults(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResponse::class => false]; - } - } -} else { - class ShipmentResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResponse::class; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class, 'json', $context)); + unset($data['Response']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResponse::class; + if (\array_key_exists('ShipmentResults', $data)) { + $object->setShipmentResults($this->denormalizer->denormalize($data['ShipmentResults'], \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class, 'json', $context)); + unset($data['ShipmentResults']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('ShipmentResults', $data)) { - $object->setShipmentResults($this->denormalizer->denormalize($data['ShipmentResults'], \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class, 'json', $context)); - unset($data['ShipmentResults']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['ShipmentResults'] = $this->normalizer->normalize($object->getShipmentResults(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + $dataArray['ShipmentResults'] = $this->normalizer->normalize($data->getShipmentResults(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResponseResponseNormalizer.php b/src/Api/Normalizer/ShipmentResponseResponseNormalizer.php index 77bc95d2..ecb1cd1e 100644 --- a/src/Api/Normalizer/ShipmentResponseResponseNormalizer.php +++ b/src/Api/Normalizer/ShipmentResponseResponseNormalizer.php @@ -5,176 +5,87 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data) && $data['Alert'] !== null) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - elseif (\array_key_exists('Alert', $data) && $data['Alert'] === null) { - $object->setAlert(null); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); + } + if (\array_key_exists('Alert', $data) && $data['Alert'] !== null) { + $values = []; + foreach ($data['Alert'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); } - return $data; + $object->setAlert($values); + unset($data['Alert']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResponseResponse::class => false]; + elseif (\array_key_exists('Alert', $data) && $data['Alert'] === null) { + $object->setAlert(null); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class ShipmentResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert')) { + $values = []; + foreach ($data->getAlert() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Alert'] = $values; } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data) && $data['Alert'] !== null) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - elseif (\array_key_exists('Alert', $data) && $data['Alert'] === null) { - $object->setAlert(null); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResponseShipmentResultsNormalizer.php b/src/Api/Normalizer/ShipmentResponseShipmentResultsNormalizer.php index 5ae38d4d..738e1699 100644 --- a/src/Api/Normalizer/ShipmentResponseShipmentResultsNormalizer.php +++ b/src/Api/Normalizer/ShipmentResponseShipmentResultsNormalizer.php @@ -5,598 +5,298 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResponseShipmentResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResponseShipmentResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Disclaimer', $data)) { - $values = []; - foreach ($data['Disclaimer'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class, 'json', $context); - } - $object->setDisclaimer($values); - unset($data['Disclaimer']); - } - if (\array_key_exists('ShipmentCharges', $data)) { - $object->setShipmentCharges($this->denormalizer->denormalize($data['ShipmentCharges'], \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class, 'json', $context)); - unset($data['ShipmentCharges']); - } - if (\array_key_exists('NegotiatedRateCharges', $data) && $data['NegotiatedRateCharges'] !== null) { - $object->setNegotiatedRateCharges($this->denormalizer->denormalize($data['NegotiatedRateCharges'], \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class, 'json', $context)); - unset($data['NegotiatedRateCharges']); - } - elseif (\array_key_exists('NegotiatedRateCharges', $data) && $data['NegotiatedRateCharges'] === null) { - $object->setNegotiatedRateCharges(null); - } - if (\array_key_exists('FRSShipmentData', $data) && $data['FRSShipmentData'] !== null) { - $object->setFRSShipmentData($this->denormalizer->denormalize($data['FRSShipmentData'], \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class, 'json', $context)); - unset($data['FRSShipmentData']); - } - elseif (\array_key_exists('FRSShipmentData', $data) && $data['FRSShipmentData'] === null) { - $object->setFRSShipmentData(null); - } - if (\array_key_exists('RatingMethod', $data) && $data['RatingMethod'] !== null) { - $object->setRatingMethod($data['RatingMethod']); - unset($data['RatingMethod']); - } - elseif (\array_key_exists('RatingMethod', $data) && $data['RatingMethod'] === null) { - $object->setRatingMethod(null); - } - if (\array_key_exists('BillableWeightCalculationMethod', $data) && $data['BillableWeightCalculationMethod'] !== null) { - $object->setBillableWeightCalculationMethod($data['BillableWeightCalculationMethod']); - unset($data['BillableWeightCalculationMethod']); - } - elseif (\array_key_exists('BillableWeightCalculationMethod', $data) && $data['BillableWeightCalculationMethod'] === null) { - $object->setBillableWeightCalculationMethod(null); - } - if (\array_key_exists('BillingWeight', $data)) { - $object->setBillingWeight($this->denormalizer->denormalize($data['BillingWeight'], \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class, 'json', $context)); - unset($data['BillingWeight']); - } - if (\array_key_exists('ShipmentIdentificationNumber', $data) && $data['ShipmentIdentificationNumber'] !== null) { - $object->setShipmentIdentificationNumber($data['ShipmentIdentificationNumber']); - unset($data['ShipmentIdentificationNumber']); - } - elseif (\array_key_exists('ShipmentIdentificationNumber', $data) && $data['ShipmentIdentificationNumber'] === null) { - $object->setShipmentIdentificationNumber(null); - } - if (\array_key_exists('MIDualReturnShipmentKey', $data) && $data['MIDualReturnShipmentKey'] !== null) { - $object->setMIDualReturnShipmentKey($data['MIDualReturnShipmentKey']); - unset($data['MIDualReturnShipmentKey']); - } - elseif (\array_key_exists('MIDualReturnShipmentKey', $data) && $data['MIDualReturnShipmentKey'] === null) { - $object->setMIDualReturnShipmentKey(null); - } - if (\array_key_exists('BarCodeImage', $data) && $data['BarCodeImage'] !== null) { - $object->setBarCodeImage($data['BarCodeImage']); - unset($data['BarCodeImage']); - } - elseif (\array_key_exists('BarCodeImage', $data) && $data['BarCodeImage'] === null) { - $object->setBarCodeImage(null); - } - if (\array_key_exists('PackageResults', $data) && $data['PackageResults'] !== null) { - $values_1 = []; - foreach ($data['PackageResults'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class, 'json', $context); - } - $object->setPackageResults($values_1); - unset($data['PackageResults']); - } - elseif (\array_key_exists('PackageResults', $data) && $data['PackageResults'] === null) { - $object->setPackageResults(null); - } - if (\array_key_exists('ControlLogReceipt', $data) && $data['ControlLogReceipt'] !== null) { - $values_2 = []; - foreach ($data['ControlLogReceipt'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class, 'json', $context); - } - $object->setControlLogReceipt($values_2); - unset($data['ControlLogReceipt']); - } - elseif (\array_key_exists('ControlLogReceipt', $data) && $data['ControlLogReceipt'] === null) { - $object->setControlLogReceipt(null); - } - if (\array_key_exists('Form', $data) && $data['Form'] !== null) { - $object->setForm($this->denormalizer->denormalize($data['Form'], \ShipStream\Ups\Api\Model\ShipmentResultsForm::class, 'json', $context)); - unset($data['Form']); - } - elseif (\array_key_exists('Form', $data) && $data['Form'] === null) { - $object->setForm(null); - } - if (\array_key_exists('CODTurnInPage', $data) && $data['CODTurnInPage'] !== null) { - $object->setCODTurnInPage($this->denormalizer->denormalize($data['CODTurnInPage'], \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class, 'json', $context)); - unset($data['CODTurnInPage']); - } - elseif (\array_key_exists('CODTurnInPage', $data) && $data['CODTurnInPage'] === null) { - $object->setCODTurnInPage(null); - } - if (\array_key_exists('HighValueReport', $data) && $data['HighValueReport'] !== null) { - $object->setHighValueReport($this->denormalizer->denormalize($data['HighValueReport'], \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class, 'json', $context)); - unset($data['HighValueReport']); - } - elseif (\array_key_exists('HighValueReport', $data) && $data['HighValueReport'] === null) { - $object->setHighValueReport(null); - } - if (\array_key_exists('LabelURL', $data) && $data['LabelURL'] !== null) { - $object->setLabelURL($data['LabelURL']); - unset($data['LabelURL']); - } - elseif (\array_key_exists('LabelURL', $data) && $data['LabelURL'] === null) { - $object->setLabelURL(null); - } - if (\array_key_exists('LocalLanguageLabelURL', $data) && $data['LocalLanguageLabelURL'] !== null) { - $object->setLocalLanguageLabelURL($data['LocalLanguageLabelURL']); - unset($data['LocalLanguageLabelURL']); - } - elseif (\array_key_exists('LocalLanguageLabelURL', $data) && $data['LocalLanguageLabelURL'] === null) { - $object->setLocalLanguageLabelURL(null); - } - if (\array_key_exists('ReceiptURL', $data) && $data['ReceiptURL'] !== null) { - $object->setReceiptURL($data['ReceiptURL']); - unset($data['ReceiptURL']); - } - elseif (\array_key_exists('ReceiptURL', $data) && $data['ReceiptURL'] === null) { - $object->setReceiptURL(null); - } - if (\array_key_exists('LocalLanguageReceiptURL', $data) && $data['LocalLanguageReceiptURL'] !== null) { - $object->setLocalLanguageReceiptURL($data['LocalLanguageReceiptURL']); - unset($data['LocalLanguageReceiptURL']); - } - elseif (\array_key_exists('LocalLanguageReceiptURL', $data) && $data['LocalLanguageReceiptURL'] === null) { - $object->setLocalLanguageReceiptURL(null); - } - if (\array_key_exists('DGPaperImage', $data) && $data['DGPaperImage'] !== null) { - $values_3 = []; - foreach ($data['DGPaperImage'] as $value_3) { - $values_3[] = $value_3; - } - $object->setDGPaperImage($values_3); - unset($data['DGPaperImage']); - } - elseif (\array_key_exists('DGPaperImage', $data) && $data['DGPaperImage'] === null) { - $object->setDGPaperImage(null); - } - if (\array_key_exists('MasterCartonID', $data) && $data['MasterCartonID'] !== null) { - $object->setMasterCartonID($data['MasterCartonID']); - unset($data['MasterCartonID']); - } - elseif (\array_key_exists('MasterCartonID', $data) && $data['MasterCartonID'] === null) { - $object->setMasterCartonID(null); - } - if (\array_key_exists('RoarRatedIndicator', $data) && $data['RoarRatedIndicator'] !== null) { - $object->setRoarRatedIndicator($data['RoarRatedIndicator']); - unset($data['RoarRatedIndicator']); - } - elseif (\array_key_exists('RoarRatedIndicator', $data) && $data['RoarRatedIndicator'] === null) { - $object->setRoarRatedIndicator(null); - } - foreach ($data as $key => $value_4) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_4; - } - } + return $type === \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $values = []; - foreach ($object->getDisclaimer() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Disclaimer'] = $values; - } - if ($object->isInitialized('shipmentCharges') && null !== $object->getShipmentCharges()) { - $data['ShipmentCharges'] = $this->normalizer->normalize($object->getShipmentCharges(), 'json', $context); - } - if ($object->isInitialized('negotiatedRateCharges') && null !== $object->getNegotiatedRateCharges()) { - $data['NegotiatedRateCharges'] = $this->normalizer->normalize($object->getNegotiatedRateCharges(), 'json', $context); - } - if ($object->isInitialized('fRSShipmentData') && null !== $object->getFRSShipmentData()) { - $data['FRSShipmentData'] = $this->normalizer->normalize($object->getFRSShipmentData(), 'json', $context); - } - if ($object->isInitialized('ratingMethod') && null !== $object->getRatingMethod()) { - $data['RatingMethod'] = $object->getRatingMethod(); - } - if ($object->isInitialized('billableWeightCalculationMethod') && null !== $object->getBillableWeightCalculationMethod()) { - $data['BillableWeightCalculationMethod'] = $object->getBillableWeightCalculationMethod(); - } - $data['BillingWeight'] = $this->normalizer->normalize($object->getBillingWeight(), 'json', $context); - if ($object->isInitialized('shipmentIdentificationNumber') && null !== $object->getShipmentIdentificationNumber()) { - $data['ShipmentIdentificationNumber'] = $object->getShipmentIdentificationNumber(); - } - if ($object->isInitialized('mIDualReturnShipmentKey') && null !== $object->getMIDualReturnShipmentKey()) { - $data['MIDualReturnShipmentKey'] = $object->getMIDualReturnShipmentKey(); - } - if ($object->isInitialized('barCodeImage') && null !== $object->getBarCodeImage()) { - $data['BarCodeImage'] = $object->getBarCodeImage(); - } - if ($object->isInitialized('packageResults') && null !== $object->getPackageResults()) { - $values_1 = []; - foreach ($object->getPackageResults() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['PackageResults'] = $values_1; - } - if ($object->isInitialized('controlLogReceipt') && null !== $object->getControlLogReceipt()) { - $values_2 = []; - foreach ($object->getControlLogReceipt() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['ControlLogReceipt'] = $values_2; - } - if ($object->isInitialized('form') && null !== $object->getForm()) { - $data['Form'] = $this->normalizer->normalize($object->getForm(), 'json', $context); + if (\array_key_exists('Disclaimer', $data)) { + $values = []; + foreach ($data['Disclaimer'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class, 'json', $context); } - if ($object->isInitialized('cODTurnInPage') && null !== $object->getCODTurnInPage()) { - $data['CODTurnInPage'] = $this->normalizer->normalize($object->getCODTurnInPage(), 'json', $context); - } - if ($object->isInitialized('highValueReport') && null !== $object->getHighValueReport()) { - $data['HighValueReport'] = $this->normalizer->normalize($object->getHighValueReport(), 'json', $context); - } - if ($object->isInitialized('labelURL') && null !== $object->getLabelURL()) { - $data['LabelURL'] = $object->getLabelURL(); - } - if ($object->isInitialized('localLanguageLabelURL') && null !== $object->getLocalLanguageLabelURL()) { - $data['LocalLanguageLabelURL'] = $object->getLocalLanguageLabelURL(); - } - if ($object->isInitialized('receiptURL') && null !== $object->getReceiptURL()) { - $data['ReceiptURL'] = $object->getReceiptURL(); - } - if ($object->isInitialized('localLanguageReceiptURL') && null !== $object->getLocalLanguageReceiptURL()) { - $data['LocalLanguageReceiptURL'] = $object->getLocalLanguageReceiptURL(); - } - if ($object->isInitialized('dGPaperImage') && null !== $object->getDGPaperImage()) { - $values_3 = []; - foreach ($object->getDGPaperImage() as $value_3) { - $values_3[] = $value_3; - } - $data['DGPaperImage'] = $values_3; - } - if ($object->isInitialized('masterCartonID') && null !== $object->getMasterCartonID()) { - $data['MasterCartonID'] = $object->getMasterCartonID(); + $object->setDisclaimer($values); + unset($data['Disclaimer']); + } + if (\array_key_exists('ShipmentCharges', $data)) { + $object->setShipmentCharges($this->denormalizer->denormalize($data['ShipmentCharges'], \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class, 'json', $context)); + unset($data['ShipmentCharges']); + } + if (\array_key_exists('NegotiatedRateCharges', $data) && $data['NegotiatedRateCharges'] !== null) { + $object->setNegotiatedRateCharges($this->denormalizer->denormalize($data['NegotiatedRateCharges'], \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class, 'json', $context)); + unset($data['NegotiatedRateCharges']); + } + elseif (\array_key_exists('NegotiatedRateCharges', $data) && $data['NegotiatedRateCharges'] === null) { + $object->setNegotiatedRateCharges(null); + } + if (\array_key_exists('FRSShipmentData', $data) && $data['FRSShipmentData'] !== null) { + $object->setFRSShipmentData($this->denormalizer->denormalize($data['FRSShipmentData'], \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class, 'json', $context)); + unset($data['FRSShipmentData']); + } + elseif (\array_key_exists('FRSShipmentData', $data) && $data['FRSShipmentData'] === null) { + $object->setFRSShipmentData(null); + } + if (\array_key_exists('RatingMethod', $data) && $data['RatingMethod'] !== null) { + $object->setRatingMethod($data['RatingMethod']); + unset($data['RatingMethod']); + } + elseif (\array_key_exists('RatingMethod', $data) && $data['RatingMethod'] === null) { + $object->setRatingMethod(null); + } + if (\array_key_exists('BillableWeightCalculationMethod', $data) && $data['BillableWeightCalculationMethod'] !== null) { + $object->setBillableWeightCalculationMethod($data['BillableWeightCalculationMethod']); + unset($data['BillableWeightCalculationMethod']); + } + elseif (\array_key_exists('BillableWeightCalculationMethod', $data) && $data['BillableWeightCalculationMethod'] === null) { + $object->setBillableWeightCalculationMethod(null); + } + if (\array_key_exists('BillingWeight', $data)) { + $object->setBillingWeight($this->denormalizer->denormalize($data['BillingWeight'], \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class, 'json', $context)); + unset($data['BillingWeight']); + } + if (\array_key_exists('ShipmentIdentificationNumber', $data) && $data['ShipmentIdentificationNumber'] !== null) { + $object->setShipmentIdentificationNumber($data['ShipmentIdentificationNumber']); + unset($data['ShipmentIdentificationNumber']); + } + elseif (\array_key_exists('ShipmentIdentificationNumber', $data) && $data['ShipmentIdentificationNumber'] === null) { + $object->setShipmentIdentificationNumber(null); + } + if (\array_key_exists('MIDualReturnShipmentKey', $data) && $data['MIDualReturnShipmentKey'] !== null) { + $object->setMIDualReturnShipmentKey($data['MIDualReturnShipmentKey']); + unset($data['MIDualReturnShipmentKey']); + } + elseif (\array_key_exists('MIDualReturnShipmentKey', $data) && $data['MIDualReturnShipmentKey'] === null) { + $object->setMIDualReturnShipmentKey(null); + } + if (\array_key_exists('BarCodeImage', $data) && $data['BarCodeImage'] !== null) { + $object->setBarCodeImage($data['BarCodeImage']); + unset($data['BarCodeImage']); + } + elseif (\array_key_exists('BarCodeImage', $data) && $data['BarCodeImage'] === null) { + $object->setBarCodeImage(null); + } + if (\array_key_exists('PackageResults', $data) && $data['PackageResults'] !== null) { + $values_1 = []; + foreach ($data['PackageResults'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class, 'json', $context); } - if ($object->isInitialized('roarRatedIndicator') && null !== $object->getRoarRatedIndicator()) { - $data['RoarRatedIndicator'] = $object->getRoarRatedIndicator(); + $object->setPackageResults($values_1); + unset($data['PackageResults']); + } + elseif (\array_key_exists('PackageResults', $data) && $data['PackageResults'] === null) { + $object->setPackageResults(null); + } + if (\array_key_exists('ControlLogReceipt', $data) && $data['ControlLogReceipt'] !== null) { + $values_2 = []; + foreach ($data['ControlLogReceipt'] as $value_2) { + $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class, 'json', $context); } - foreach ($object as $key => $value_4) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_4; - } + $object->setControlLogReceipt($values_2); + unset($data['ControlLogReceipt']); + } + elseif (\array_key_exists('ControlLogReceipt', $data) && $data['ControlLogReceipt'] === null) { + $object->setControlLogReceipt(null); + } + if (\array_key_exists('Form', $data) && $data['Form'] !== null) { + $object->setForm($this->denormalizer->denormalize($data['Form'], \ShipStream\Ups\Api\Model\ShipmentResultsForm::class, 'json', $context)); + unset($data['Form']); + } + elseif (\array_key_exists('Form', $data) && $data['Form'] === null) { + $object->setForm(null); + } + if (\array_key_exists('CODTurnInPage', $data) && $data['CODTurnInPage'] !== null) { + $object->setCODTurnInPage($this->denormalizer->denormalize($data['CODTurnInPage'], \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class, 'json', $context)); + unset($data['CODTurnInPage']); + } + elseif (\array_key_exists('CODTurnInPage', $data) && $data['CODTurnInPage'] === null) { + $object->setCODTurnInPage(null); + } + if (\array_key_exists('HighValueReport', $data) && $data['HighValueReport'] !== null) { + $object->setHighValueReport($this->denormalizer->denormalize($data['HighValueReport'], \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class, 'json', $context)); + unset($data['HighValueReport']); + } + elseif (\array_key_exists('HighValueReport', $data) && $data['HighValueReport'] === null) { + $object->setHighValueReport(null); + } + if (\array_key_exists('LabelURL', $data) && $data['LabelURL'] !== null) { + $object->setLabelURL($data['LabelURL']); + unset($data['LabelURL']); + } + elseif (\array_key_exists('LabelURL', $data) && $data['LabelURL'] === null) { + $object->setLabelURL(null); + } + if (\array_key_exists('LocalLanguageLabelURL', $data) && $data['LocalLanguageLabelURL'] !== null) { + $object->setLocalLanguageLabelURL($data['LocalLanguageLabelURL']); + unset($data['LocalLanguageLabelURL']); + } + elseif (\array_key_exists('LocalLanguageLabelURL', $data) && $data['LocalLanguageLabelURL'] === null) { + $object->setLocalLanguageLabelURL(null); + } + if (\array_key_exists('ReceiptURL', $data) && $data['ReceiptURL'] !== null) { + $object->setReceiptURL($data['ReceiptURL']); + unset($data['ReceiptURL']); + } + elseif (\array_key_exists('ReceiptURL', $data) && $data['ReceiptURL'] === null) { + $object->setReceiptURL(null); + } + if (\array_key_exists('LocalLanguageReceiptURL', $data) && $data['LocalLanguageReceiptURL'] !== null) { + $object->setLocalLanguageReceiptURL($data['LocalLanguageReceiptURL']); + unset($data['LocalLanguageReceiptURL']); + } + elseif (\array_key_exists('LocalLanguageReceiptURL', $data) && $data['LocalLanguageReceiptURL'] === null) { + $object->setLocalLanguageReceiptURL(null); + } + if (\array_key_exists('DGPaperImage', $data) && $data['DGPaperImage'] !== null) { + $values_3 = []; + foreach ($data['DGPaperImage'] as $value_3) { + $values_3[] = $value_3; } - return $data; + $object->setDGPaperImage($values_3); + unset($data['DGPaperImage']); + } + elseif (\array_key_exists('DGPaperImage', $data) && $data['DGPaperImage'] === null) { + $object->setDGPaperImage(null); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class => false]; + if (\array_key_exists('MasterCartonID', $data) && $data['MasterCartonID'] !== null) { + $object->setMasterCartonID($data['MasterCartonID']); + unset($data['MasterCartonID']); } + elseif (\array_key_exists('MasterCartonID', $data) && $data['MasterCartonID'] === null) { + $object->setMasterCartonID(null); + } + if (\array_key_exists('RoarRatedIndicator', $data) && $data['RoarRatedIndicator'] !== null) { + $object->setRoarRatedIndicator($data['RoarRatedIndicator']); + unset($data['RoarRatedIndicator']); + } + elseif (\array_key_exists('RoarRatedIndicator', $data) && $data['RoarRatedIndicator'] === null) { + $object->setRoarRatedIndicator(null); + } + foreach ($data as $key => $value_4) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_4; + } + } + return $object; } -} else { - class ShipmentResponseShipmentResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Disclaimer', $data)) { - $values = []; - foreach ($data['Disclaimer'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class, 'json', $context); - } - $object->setDisclaimer($values); - unset($data['Disclaimer']); - } - if (\array_key_exists('ShipmentCharges', $data)) { - $object->setShipmentCharges($this->denormalizer->denormalize($data['ShipmentCharges'], \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class, 'json', $context)); - unset($data['ShipmentCharges']); - } - if (\array_key_exists('NegotiatedRateCharges', $data) && $data['NegotiatedRateCharges'] !== null) { - $object->setNegotiatedRateCharges($this->denormalizer->denormalize($data['NegotiatedRateCharges'], \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class, 'json', $context)); - unset($data['NegotiatedRateCharges']); - } - elseif (\array_key_exists('NegotiatedRateCharges', $data) && $data['NegotiatedRateCharges'] === null) { - $object->setNegotiatedRateCharges(null); - } - if (\array_key_exists('FRSShipmentData', $data) && $data['FRSShipmentData'] !== null) { - $object->setFRSShipmentData($this->denormalizer->denormalize($data['FRSShipmentData'], \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class, 'json', $context)); - unset($data['FRSShipmentData']); - } - elseif (\array_key_exists('FRSShipmentData', $data) && $data['FRSShipmentData'] === null) { - $object->setFRSShipmentData(null); - } - if (\array_key_exists('RatingMethod', $data) && $data['RatingMethod'] !== null) { - $object->setRatingMethod($data['RatingMethod']); - unset($data['RatingMethod']); - } - elseif (\array_key_exists('RatingMethod', $data) && $data['RatingMethod'] === null) { - $object->setRatingMethod(null); - } - if (\array_key_exists('BillableWeightCalculationMethod', $data) && $data['BillableWeightCalculationMethod'] !== null) { - $object->setBillableWeightCalculationMethod($data['BillableWeightCalculationMethod']); - unset($data['BillableWeightCalculationMethod']); - } - elseif (\array_key_exists('BillableWeightCalculationMethod', $data) && $data['BillableWeightCalculationMethod'] === null) { - $object->setBillableWeightCalculationMethod(null); - } - if (\array_key_exists('BillingWeight', $data)) { - $object->setBillingWeight($this->denormalizer->denormalize($data['BillingWeight'], \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class, 'json', $context)); - unset($data['BillingWeight']); - } - if (\array_key_exists('ShipmentIdentificationNumber', $data) && $data['ShipmentIdentificationNumber'] !== null) { - $object->setShipmentIdentificationNumber($data['ShipmentIdentificationNumber']); - unset($data['ShipmentIdentificationNumber']); - } - elseif (\array_key_exists('ShipmentIdentificationNumber', $data) && $data['ShipmentIdentificationNumber'] === null) { - $object->setShipmentIdentificationNumber(null); - } - if (\array_key_exists('MIDualReturnShipmentKey', $data) && $data['MIDualReturnShipmentKey'] !== null) { - $object->setMIDualReturnShipmentKey($data['MIDualReturnShipmentKey']); - unset($data['MIDualReturnShipmentKey']); - } - elseif (\array_key_exists('MIDualReturnShipmentKey', $data) && $data['MIDualReturnShipmentKey'] === null) { - $object->setMIDualReturnShipmentKey(null); - } - if (\array_key_exists('BarCodeImage', $data) && $data['BarCodeImage'] !== null) { - $object->setBarCodeImage($data['BarCodeImage']); - unset($data['BarCodeImage']); - } - elseif (\array_key_exists('BarCodeImage', $data) && $data['BarCodeImage'] === null) { - $object->setBarCodeImage(null); - } - if (\array_key_exists('PackageResults', $data) && $data['PackageResults'] !== null) { - $values_1 = []; - foreach ($data['PackageResults'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class, 'json', $context); - } - $object->setPackageResults($values_1); - unset($data['PackageResults']); - } - elseif (\array_key_exists('PackageResults', $data) && $data['PackageResults'] === null) { - $object->setPackageResults(null); - } - if (\array_key_exists('ControlLogReceipt', $data) && $data['ControlLogReceipt'] !== null) { - $values_2 = []; - foreach ($data['ControlLogReceipt'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class, 'json', $context); - } - $object->setControlLogReceipt($values_2); - unset($data['ControlLogReceipt']); - } - elseif (\array_key_exists('ControlLogReceipt', $data) && $data['ControlLogReceipt'] === null) { - $object->setControlLogReceipt(null); - } - if (\array_key_exists('Form', $data) && $data['Form'] !== null) { - $object->setForm($this->denormalizer->denormalize($data['Form'], \ShipStream\Ups\Api\Model\ShipmentResultsForm::class, 'json', $context)); - unset($data['Form']); - } - elseif (\array_key_exists('Form', $data) && $data['Form'] === null) { - $object->setForm(null); - } - if (\array_key_exists('CODTurnInPage', $data) && $data['CODTurnInPage'] !== null) { - $object->setCODTurnInPage($this->denormalizer->denormalize($data['CODTurnInPage'], \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class, 'json', $context)); - unset($data['CODTurnInPage']); - } - elseif (\array_key_exists('CODTurnInPage', $data) && $data['CODTurnInPage'] === null) { - $object->setCODTurnInPage(null); - } - if (\array_key_exists('HighValueReport', $data) && $data['HighValueReport'] !== null) { - $object->setHighValueReport($this->denormalizer->denormalize($data['HighValueReport'], \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class, 'json', $context)); - unset($data['HighValueReport']); - } - elseif (\array_key_exists('HighValueReport', $data) && $data['HighValueReport'] === null) { - $object->setHighValueReport(null); - } - if (\array_key_exists('LabelURL', $data) && $data['LabelURL'] !== null) { - $object->setLabelURL($data['LabelURL']); - unset($data['LabelURL']); - } - elseif (\array_key_exists('LabelURL', $data) && $data['LabelURL'] === null) { - $object->setLabelURL(null); - } - if (\array_key_exists('LocalLanguageLabelURL', $data) && $data['LocalLanguageLabelURL'] !== null) { - $object->setLocalLanguageLabelURL($data['LocalLanguageLabelURL']); - unset($data['LocalLanguageLabelURL']); - } - elseif (\array_key_exists('LocalLanguageLabelURL', $data) && $data['LocalLanguageLabelURL'] === null) { - $object->setLocalLanguageLabelURL(null); - } - if (\array_key_exists('ReceiptURL', $data) && $data['ReceiptURL'] !== null) { - $object->setReceiptURL($data['ReceiptURL']); - unset($data['ReceiptURL']); - } - elseif (\array_key_exists('ReceiptURL', $data) && $data['ReceiptURL'] === null) { - $object->setReceiptURL(null); - } - if (\array_key_exists('LocalLanguageReceiptURL', $data) && $data['LocalLanguageReceiptURL'] !== null) { - $object->setLocalLanguageReceiptURL($data['LocalLanguageReceiptURL']); - unset($data['LocalLanguageReceiptURL']); - } - elseif (\array_key_exists('LocalLanguageReceiptURL', $data) && $data['LocalLanguageReceiptURL'] === null) { - $object->setLocalLanguageReceiptURL(null); + $dataArray = []; + if ($data->isInitialized('disclaimer') && null !== $data->getDisclaimer()) { + $values = []; + foreach ($data->getDisclaimer() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - if (\array_key_exists('DGPaperImage', $data) && $data['DGPaperImage'] !== null) { - $values_3 = []; - foreach ($data['DGPaperImage'] as $value_3) { - $values_3[] = $value_3; - } - $object->setDGPaperImage($values_3); - unset($data['DGPaperImage']); - } - elseif (\array_key_exists('DGPaperImage', $data) && $data['DGPaperImage'] === null) { - $object->setDGPaperImage(null); - } - if (\array_key_exists('MasterCartonID', $data) && $data['MasterCartonID'] !== null) { - $object->setMasterCartonID($data['MasterCartonID']); - unset($data['MasterCartonID']); - } - elseif (\array_key_exists('MasterCartonID', $data) && $data['MasterCartonID'] === null) { - $object->setMasterCartonID(null); - } - if (\array_key_exists('RoarRatedIndicator', $data) && $data['RoarRatedIndicator'] !== null) { - $object->setRoarRatedIndicator($data['RoarRatedIndicator']); - unset($data['RoarRatedIndicator']); - } - elseif (\array_key_exists('RoarRatedIndicator', $data) && $data['RoarRatedIndicator'] === null) { - $object->setRoarRatedIndicator(null); - } - foreach ($data as $key => $value_4) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_4; - } - } - return $object; + $dataArray['Disclaimer'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $values = []; - foreach ($object->getDisclaimer() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Disclaimer'] = $values; - } - if ($object->isInitialized('shipmentCharges') && null !== $object->getShipmentCharges()) { - $data['ShipmentCharges'] = $this->normalizer->normalize($object->getShipmentCharges(), 'json', $context); - } - if ($object->isInitialized('negotiatedRateCharges') && null !== $object->getNegotiatedRateCharges()) { - $data['NegotiatedRateCharges'] = $this->normalizer->normalize($object->getNegotiatedRateCharges(), 'json', $context); - } - if ($object->isInitialized('fRSShipmentData') && null !== $object->getFRSShipmentData()) { - $data['FRSShipmentData'] = $this->normalizer->normalize($object->getFRSShipmentData(), 'json', $context); - } - if ($object->isInitialized('ratingMethod') && null !== $object->getRatingMethod()) { - $data['RatingMethod'] = $object->getRatingMethod(); - } - if ($object->isInitialized('billableWeightCalculationMethod') && null !== $object->getBillableWeightCalculationMethod()) { - $data['BillableWeightCalculationMethod'] = $object->getBillableWeightCalculationMethod(); - } - $data['BillingWeight'] = $this->normalizer->normalize($object->getBillingWeight(), 'json', $context); - if ($object->isInitialized('shipmentIdentificationNumber') && null !== $object->getShipmentIdentificationNumber()) { - $data['ShipmentIdentificationNumber'] = $object->getShipmentIdentificationNumber(); - } - if ($object->isInitialized('mIDualReturnShipmentKey') && null !== $object->getMIDualReturnShipmentKey()) { - $data['MIDualReturnShipmentKey'] = $object->getMIDualReturnShipmentKey(); - } - if ($object->isInitialized('barCodeImage') && null !== $object->getBarCodeImage()) { - $data['BarCodeImage'] = $object->getBarCodeImage(); - } - if ($object->isInitialized('packageResults') && null !== $object->getPackageResults()) { - $values_1 = []; - foreach ($object->getPackageResults() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['PackageResults'] = $values_1; - } - if ($object->isInitialized('controlLogReceipt') && null !== $object->getControlLogReceipt()) { - $values_2 = []; - foreach ($object->getControlLogReceipt() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['ControlLogReceipt'] = $values_2; - } - if ($object->isInitialized('form') && null !== $object->getForm()) { - $data['Form'] = $this->normalizer->normalize($object->getForm(), 'json', $context); - } - if ($object->isInitialized('cODTurnInPage') && null !== $object->getCODTurnInPage()) { - $data['CODTurnInPage'] = $this->normalizer->normalize($object->getCODTurnInPage(), 'json', $context); - } - if ($object->isInitialized('highValueReport') && null !== $object->getHighValueReport()) { - $data['HighValueReport'] = $this->normalizer->normalize($object->getHighValueReport(), 'json', $context); - } - if ($object->isInitialized('labelURL') && null !== $object->getLabelURL()) { - $data['LabelURL'] = $object->getLabelURL(); - } - if ($object->isInitialized('localLanguageLabelURL') && null !== $object->getLocalLanguageLabelURL()) { - $data['LocalLanguageLabelURL'] = $object->getLocalLanguageLabelURL(); - } - if ($object->isInitialized('receiptURL') && null !== $object->getReceiptURL()) { - $data['ReceiptURL'] = $object->getReceiptURL(); - } - if ($object->isInitialized('localLanguageReceiptURL') && null !== $object->getLocalLanguageReceiptURL()) { - $data['LocalLanguageReceiptURL'] = $object->getLocalLanguageReceiptURL(); - } - if ($object->isInitialized('dGPaperImage') && null !== $object->getDGPaperImage()) { - $values_3 = []; - foreach ($object->getDGPaperImage() as $value_3) { - $values_3[] = $value_3; - } - $data['DGPaperImage'] = $values_3; - } - if ($object->isInitialized('masterCartonID') && null !== $object->getMasterCartonID()) { - $data['MasterCartonID'] = $object->getMasterCartonID(); + if ($data->isInitialized('shipmentCharges') && null !== $data->getShipmentCharges()) { + $dataArray['ShipmentCharges'] = $this->normalizer->normalize($data->getShipmentCharges(), 'json', $context); + } + if ($data->isInitialized('negotiatedRateCharges')) { + $dataArray['NegotiatedRateCharges'] = $this->normalizer->normalize($data->getNegotiatedRateCharges(), 'json', $context); + } + if ($data->isInitialized('fRSShipmentData')) { + $dataArray['FRSShipmentData'] = $this->normalizer->normalize($data->getFRSShipmentData(), 'json', $context); + } + if ($data->isInitialized('ratingMethod')) { + $dataArray['RatingMethod'] = $data->getRatingMethod(); + } + if ($data->isInitialized('billableWeightCalculationMethod')) { + $dataArray['BillableWeightCalculationMethod'] = $data->getBillableWeightCalculationMethod(); + } + $dataArray['BillingWeight'] = $this->normalizer->normalize($data->getBillingWeight(), 'json', $context); + if ($data->isInitialized('shipmentIdentificationNumber')) { + $dataArray['ShipmentIdentificationNumber'] = $data->getShipmentIdentificationNumber(); + } + if ($data->isInitialized('mIDualReturnShipmentKey')) { + $dataArray['MIDualReturnShipmentKey'] = $data->getMIDualReturnShipmentKey(); + } + if ($data->isInitialized('barCodeImage')) { + $dataArray['BarCodeImage'] = $data->getBarCodeImage(); + } + if ($data->isInitialized('packageResults')) { + $values_1 = []; + foreach ($data->getPackageResults() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - if ($object->isInitialized('roarRatedIndicator') && null !== $object->getRoarRatedIndicator()) { - $data['RoarRatedIndicator'] = $object->getRoarRatedIndicator(); + $dataArray['PackageResults'] = $values_1; + } + if ($data->isInitialized('controlLogReceipt')) { + $values_2 = []; + foreach ($data->getControlLogReceipt() as $value_2) { + $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); } - foreach ($object as $key => $value_4) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_4; - } + $dataArray['ControlLogReceipt'] = $values_2; + } + if ($data->isInitialized('form')) { + $dataArray['Form'] = $this->normalizer->normalize($data->getForm(), 'json', $context); + } + if ($data->isInitialized('cODTurnInPage')) { + $dataArray['CODTurnInPage'] = $this->normalizer->normalize($data->getCODTurnInPage(), 'json', $context); + } + if ($data->isInitialized('highValueReport')) { + $dataArray['HighValueReport'] = $this->normalizer->normalize($data->getHighValueReport(), 'json', $context); + } + if ($data->isInitialized('labelURL')) { + $dataArray['LabelURL'] = $data->getLabelURL(); + } + if ($data->isInitialized('localLanguageLabelURL')) { + $dataArray['LocalLanguageLabelURL'] = $data->getLocalLanguageLabelURL(); + } + if ($data->isInitialized('receiptURL')) { + $dataArray['ReceiptURL'] = $data->getReceiptURL(); + } + if ($data->isInitialized('localLanguageReceiptURL')) { + $dataArray['LocalLanguageReceiptURL'] = $data->getLocalLanguageReceiptURL(); + } + if ($data->isInitialized('dGPaperImage')) { + $values_3 = []; + foreach ($data->getDGPaperImage() as $value_3) { + $values_3[] = $value_3; } - return $data; + $dataArray['DGPaperImage'] = $values_3; + } + if ($data->isInitialized('masterCartonID')) { + $dataArray['MasterCartonID'] = $data->getMasterCartonID(); + } + if ($data->isInitialized('roarRatedIndicator')) { + $dataArray['RoarRatedIndicator'] = $data->getRoarRatedIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class => false]; + foreach ($data as $key => $value_4) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_4; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResponseShipmentResults::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsBillableShipmentWeightNormalizer.php b/src/Api/Normalizer/ShipmentResultsBillableShipmentWeightNormalizer.php index 7570621b..8c42659f 100644 --- a/src/Api/Normalizer/ShipmentResultsBillableShipmentWeightNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsBillableShipmentWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsBillableShipmentWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsBillableShipmentWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class => false]; - } - } -} else { - class ShipmentResultsBillableShipmentWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillableShipmentWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Value'] = $object->getValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Value'] = $data->getValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsBillableShipmentWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsBillingWeightNormalizer.php b/src/Api/Normalizer/ShipmentResultsBillingWeightNormalizer.php index 079bce17..1aeac02e 100644 --- a/src/Api/Normalizer/ShipmentResultsBillingWeightNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsBillingWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsBillingWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsBillingWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class => false]; - } - } -} else { - class ShipmentResultsBillingWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\BillingWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Weight'] = $data->getWeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsBillingWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsCODTurnInPageNormalizer.php b/src/Api/Normalizer/ShipmentResultsCODTurnInPageNormalizer.php index 3bab9e81..d4dac970 100644 --- a/src/Api/Normalizer/ShipmentResultsCODTurnInPageNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsCODTurnInPageNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsCODTurnInPageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsCODTurnInPageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\CODTurnInPageImage::class, 'json', $context)); - unset($data['Image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Image', $data)) { + $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\CODTurnInPageImage::class, 'json', $context)); + unset($data['Image']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentResultsCODTurnInPageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Image'] = $this->normalizer->normalize($data->getImage(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\CODTurnInPageImage::class, 'json', $context)); - unset($data['Image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsCODTurnInPage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsControlLogReceiptNormalizer.php b/src/Api/Normalizer/ShipmentResultsControlLogReceiptNormalizer.php index 93bda38b..8307d0cf 100644 --- a/src/Api/Normalizer/ShipmentResultsControlLogReceiptNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsControlLogReceiptNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsControlLogReceiptNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsControlLogReceiptNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class => false]; - } - } -} else { - class ShipmentResultsControlLogReceiptNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class; + if (\array_key_exists('ImageFormat', $data)) { + $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class, 'json', $context)); + unset($data['ImageFormat']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class; + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ControlLogReceiptImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ImageFormat'] = $this->normalizer->normalize($data->getImageFormat(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsControlLogReceipt::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsDisclaimerNormalizer.php b/src/Api/Normalizer/ShipmentResultsDisclaimerNormalizer.php index 51d0ab45..39e0e78f 100644 --- a/src/Api/Normalizer/ShipmentResultsDisclaimerNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsDisclaimerNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsDisclaimerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsDisclaimerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentResultsDisclaimerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsDisclaimer::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsDocumentsNormalizer.php b/src/Api/Normalizer/ShipmentResultsDocumentsNormalizer.php index fc619db0..55c676c3 100644 --- a/src/Api/Normalizer/ShipmentResultsDocumentsNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsDocumentsNormalizer.php @@ -5,176 +5,87 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsDocumentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsDocumentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsDocuments(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Image', $data)) { - $values = []; - foreach ($data['Image'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DocumentsImage::class, 'json', $context); - } - $object->setImage($values); - unset($data['Image']); - } - if (\array_key_exists('Forms', $data)) { - $values_1 = []; - foreach ($data['Forms'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\DocumentsForms::class, 'json', $context); - } - $object->setForms($values_1); - unset($data['Forms']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsDocuments(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('image') && null !== $object->getImage()) { - $values = []; - foreach ($object->getImage() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Image'] = $values; + if (\array_key_exists('Image', $data)) { + $values = []; + foreach ($data['Image'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DocumentsImage::class, 'json', $context); } - if ($object->isInitialized('forms') && null !== $object->getForms()) { - $values_1 = []; - foreach ($object->getForms() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Forms'] = $values_1; - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setImage($values); + unset($data['Image']); + } + if (\array_key_exists('Forms', $data)) { + $values_1 = []; + foreach ($data['Forms'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\DocumentsForms::class, 'json', $context); } - return $data; + $object->setForms($values_1); + unset($data['Forms']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } } + return $object; } -} else { - class ShipmentResultsDocumentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsDocuments(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Image', $data)) { - $values = []; - foreach ($data['Image'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DocumentsImage::class, 'json', $context); - } - $object->setImage($values); - unset($data['Image']); - } - if (\array_key_exists('Forms', $data)) { - $values_1 = []; - foreach ($data['Forms'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\DocumentsForms::class, 'json', $context); - } - $object->setForms($values_1); - unset($data['Forms']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } + $dataArray = []; + if ($data->isInitialized('image') && null !== $data->getImage()) { + $values = []; + foreach ($data->getImage() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['Image'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('image') && null !== $object->getImage()) { - $values = []; - foreach ($object->getImage() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Image'] = $values; - } - if ($object->isInitialized('forms') && null !== $object->getForms()) { - $values_1 = []; - foreach ($object->getForms() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Forms'] = $values_1; - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + if ($data->isInitialized('forms') && null !== $data->getForms()) { + $values_1 = []; + foreach ($data->getForms() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['Forms'] = $values_1; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsDocuments::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsFRSShipmentDataNormalizer.php b/src/Api/Normalizer/ShipmentResultsFRSShipmentDataNormalizer.php index 52f9e348..fc2b8f98 100644 --- a/src/Api/Normalizer/ShipmentResultsFRSShipmentDataNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsFRSShipmentDataNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsFRSShipmentDataNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsFRSShipmentDataNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransportationCharges', $data)) { - $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class, 'json', $context)); - unset($data['TransportationCharges']); - } - if (\array_key_exists('FreightDensityRate', $data)) { - $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class, 'json', $context)); - unset($data['FreightDensityRate']); - } - if (\array_key_exists('HandlingUnits', $data)) { - $values = []; - foreach ($data['HandlingUnits'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class, 'json', $context); - } - $object->setHandlingUnits($values); - unset($data['HandlingUnits']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['TransportationCharges'] = $this->normalizer->normalize($object->getTransportationCharges(), 'json', $context); - if ($object->isInitialized('freightDensityRate') && null !== $object->getFreightDensityRate()) { - $data['FreightDensityRate'] = $this->normalizer->normalize($object->getFreightDensityRate(), 'json', $context); - } - if ($object->isInitialized('handlingUnits') && null !== $object->getHandlingUnits()) { - $values = []; - foreach ($object->getHandlingUnits() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['HandlingUnits'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('TransportationCharges', $data)) { + $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class, 'json', $context)); + unset($data['TransportationCharges']); + } + if (\array_key_exists('FreightDensityRate', $data)) { + $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class, 'json', $context)); + unset($data['FreightDensityRate']); + } + if (\array_key_exists('HandlingUnits', $data)) { + $values = []; + foreach ($data['HandlingUnits'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class, 'json', $context); } - return $data; + $object->setHandlingUnits($values); + unset($data['HandlingUnits']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class ShipmentResultsFRSShipmentDataNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class; + $dataArray = []; + $dataArray['TransportationCharges'] = $this->normalizer->normalize($data->getTransportationCharges(), 'json', $context); + if ($data->isInitialized('freightDensityRate') && null !== $data->getFreightDensityRate()) { + $dataArray['FreightDensityRate'] = $this->normalizer->normalize($data->getFreightDensityRate(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TransportationCharges', $data)) { - $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\FRSShipmentDataTransportationCharges::class, 'json', $context)); - unset($data['TransportationCharges']); - } - if (\array_key_exists('FreightDensityRate', $data)) { - $object->setFreightDensityRate($this->denormalizer->denormalize($data['FreightDensityRate'], \ShipStream\Ups\Api\Model\FRSShipmentDataFreightDensityRate::class, 'json', $context)); - unset($data['FreightDensityRate']); - } - if (\array_key_exists('HandlingUnits', $data)) { - $values = []; - foreach ($data['HandlingUnits'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\FRSShipmentDataHandlingUnits::class, 'json', $context); - } - $object->setHandlingUnits($values); - unset($data['HandlingUnits']); + if ($data->isInitialized('handlingUnits') && null !== $data->getHandlingUnits()) { + $values = []; + foreach ($data->getHandlingUnits() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray['HandlingUnits'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['TransportationCharges'] = $this->normalizer->normalize($object->getTransportationCharges(), 'json', $context); - if ($object->isInitialized('freightDensityRate') && null !== $object->getFreightDensityRate()) { - $data['FreightDensityRate'] = $this->normalizer->normalize($object->getFreightDensityRate(), 'json', $context); - } - if ($object->isInitialized('handlingUnits') && null !== $object->getHandlingUnits()) { - $values = []; - foreach ($object->getHandlingUnits() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['HandlingUnits'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsFRSShipmentData::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsFormImageNormalizer.php b/src/Api/Normalizer/ShipmentResultsFormImageNormalizer.php index f7394f76..b3e7aa20 100644 --- a/src/Api/Normalizer/ShipmentResultsFormImageNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsFormImageNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsFormImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsFormImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsFormImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsFormImage(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class => false]; - } - } -} else { - class ShipmentResultsFormImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class; + if (\array_key_exists('ImageFormat', $data)) { + $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class, 'json', $context)); + unset($data['ImageFormat']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class; + if (\array_key_exists('GraphicImage', $data)) { + $object->setGraphicImage($data['GraphicImage']); + unset($data['GraphicImage']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsFormImage(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ImageFormat', $data)) { - $object->setImageFormat($this->denormalizer->denormalize($data['ImageFormat'], \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class, 'json', $context)); - unset($data['ImageFormat']); - } - if (\array_key_exists('GraphicImage', $data)) { - $object->setGraphicImage($data['GraphicImage']); - unset($data['GraphicImage']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ImageFormat'] = $this->normalizer->normalize($object->getImageFormat(), 'json', $context); - $data['GraphicImage'] = $object->getGraphicImage(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ImageFormat'] = $this->normalizer->normalize($data->getImageFormat(), 'json', $context); + $dataArray['GraphicImage'] = $data->getGraphicImage(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsFormNormalizer.php b/src/Api/Normalizer/ShipmentResultsFormNormalizer.php index 7c63c6c0..a5a6b80c 100644 --- a/src/Api/Normalizer/ShipmentResultsFormNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsFormNormalizer.php @@ -5,178 +5,88 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsForm::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsForm::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsForm::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsForm::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class, 'json', $context)); - unset($data['Image']); - } - if (\array_key_exists('FormGroupId', $data)) { - $object->setFormGroupId($data['FormGroupId']); - unset($data['FormGroupId']); - } - if (\array_key_exists('FormGroupIdName', $data)) { - $object->setFormGroupIdName($data['FormGroupIdName']); - unset($data['FormGroupIdName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsForm(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - if ($object->isInitialized('image') && null !== $object->getImage()) { - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - } - if ($object->isInitialized('formGroupId') && null !== $object->getFormGroupId()) { - $data['FormGroupId'] = $object->getFormGroupId(); - } - if ($object->isInitialized('formGroupIdName') && null !== $object->getFormGroupIdName()) { - $data['FormGroupIdName'] = $object->getFormGroupIdName(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); + } + if (\array_key_exists('Image', $data)) { + $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class, 'json', $context)); + unset($data['Image']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsForm::class => false]; + if (\array_key_exists('FormGroupId', $data)) { + $object->setFormGroupId($data['FormGroupId']); + unset($data['FormGroupId']); } + if (\array_key_exists('FormGroupIdName', $data)) { + $object->setFormGroupIdName($data['FormGroupIdName']); + unset($data['FormGroupIdName']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentResultsFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsForm::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + if ($data->isInitialized('image') && null !== $data->getImage()) { + $dataArray['Image'] = $this->normalizer->normalize($data->getImage(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsForm::class; + if ($data->isInitialized('formGroupId') && null !== $data->getFormGroupId()) { + $dataArray['FormGroupId'] = $data->getFormGroupId(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\ShipmentResultsFormImage::class, 'json', $context)); - unset($data['Image']); - } - if (\array_key_exists('FormGroupId', $data)) { - $object->setFormGroupId($data['FormGroupId']); - unset($data['FormGroupId']); - } - if (\array_key_exists('FormGroupIdName', $data)) { - $object->setFormGroupIdName($data['FormGroupIdName']); - unset($data['FormGroupIdName']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('formGroupIdName') && null !== $data->getFormGroupIdName()) { + $dataArray['FormGroupIdName'] = $data->getFormGroupIdName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - if ($object->isInitialized('image') && null !== $object->getImage()) { - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - } - if ($object->isInitialized('formGroupId') && null !== $object->getFormGroupId()) { - $data['FormGroupId'] = $object->getFormGroupId(); - } - if ($object->isInitialized('formGroupIdName') && null !== $object->getFormGroupIdName()) { - $data['FormGroupIdName'] = $object->getFormGroupIdName(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsForm::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsForm::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsFreightDensityRateNormalizer.php b/src/Api/Normalizer/ShipmentResultsFreightDensityRateNormalizer.php index 024f0d23..a3032297 100644 --- a/src/Api/Normalizer/ShipmentResultsFreightDensityRateNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsFreightDensityRateNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsFreightDensityRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsFreightDensityRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Density', $data)) { - $object->setDensity($data['Density']); - unset($data['Density']); - } - if (\array_key_exists('TotalCubicFeet', $data)) { - $object->setTotalCubicFeet($data['TotalCubicFeet']); - unset($data['TotalCubicFeet']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('density') && null !== $object->getDensity()) { - $data['Density'] = $object->getDensity(); - } - if ($object->isInitialized('totalCubicFeet') && null !== $object->getTotalCubicFeet()) { - $data['TotalCubicFeet'] = $object->getTotalCubicFeet(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Density', $data)) { + $object->setDensity($data['Density']); + unset($data['Density']); + } + if (\array_key_exists('TotalCubicFeet', $data)) { + $object->setTotalCubicFeet($data['TotalCubicFeet']); + unset($data['TotalCubicFeet']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentResultsFreightDensityRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class; + $dataArray = []; + if ($data->isInitialized('density') && null !== $data->getDensity()) { + $dataArray['Density'] = $data->getDensity(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Density', $data)) { - $object->setDensity($data['Density']); - unset($data['Density']); - } - if (\array_key_exists('TotalCubicFeet', $data)) { - $object->setTotalCubicFeet($data['TotalCubicFeet']); - unset($data['TotalCubicFeet']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('totalCubicFeet') && null !== $data->getTotalCubicFeet()) { + $dataArray['TotalCubicFeet'] = $data->getTotalCubicFeet(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('density') && null !== $object->getDensity()) { - $data['Density'] = $object->getDensity(); - } - if ($object->isInitialized('totalCubicFeet') && null !== $object->getTotalCubicFeet()) { - $data['TotalCubicFeet'] = $object->getTotalCubicFeet(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsFreightDensityRate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsHighValueReportNormalizer.php b/src/Api/Normalizer/ShipmentResultsHighValueReportNormalizer.php index 624e32d8..25ba15d6 100644 --- a/src/Api/Normalizer/ShipmentResultsHighValueReportNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsHighValueReportNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsHighValueReportNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsHighValueReportNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\HighValueReportImage::class, 'json', $context)); - unset($data['Image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Image', $data)) { + $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\HighValueReportImage::class, 'json', $context)); + unset($data['Image']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentResultsHighValueReportNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Image'] = $this->normalizer->normalize($data->getImage(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Image', $data)) { - $object->setImage($this->denormalizer->denormalize($data['Image'], \ShipStream\Ups\Api\Model\HighValueReportImage::class, 'json', $context)); - unset($data['Image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsHighValueReport::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsImageImageFormatNormalizer.php b/src/Api/Normalizer/ShipmentResultsImageImageFormatNormalizer.php index 4e61c419..a441951b 100644 --- a/src/Api/Normalizer/ShipmentResultsImageImageFormatNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsImageImageFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentResultsImageImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsImageImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsNegotiatedRateChargesNormalizer.php b/src/Api/Normalizer/ShipmentResultsNegotiatedRateChargesNormalizer.php index f464ee6a..9ca6132e 100644 --- a/src/Api/Normalizer/ShipmentResultsNegotiatedRateChargesNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsNegotiatedRateChargesNormalizer.php @@ -5,204 +5,101 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsNegotiatedRateChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsNegotiatedRateChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values = []; - foreach ($data['ItemizedCharges'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values); - unset($data['ItemizedCharges']); - } - if (\array_key_exists('TaxCharges', $data)) { - $values_1 = []; - foreach ($data['TaxCharges'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class, 'json', $context); - } - $object->setTaxCharges($values_1); - unset($data['TaxCharges']); - } - if (\array_key_exists('TotalCharge', $data)) { - $object->setTotalCharge($this->denormalizer->denormalize($data['TotalCharge'], \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class, 'json', $context)); - unset($data['TotalCharge']); - } - if (\array_key_exists('TotalChargesWithTaxes', $data)) { - $object->setTotalChargesWithTaxes($this->denormalizer->denormalize($data['TotalChargesWithTaxes'], \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class, 'json', $context)); - unset($data['TotalChargesWithTaxes']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values = []; - foreach ($object->getItemizedCharges() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ItemizedCharges'] = $values; - } - if ($object->isInitialized('taxCharges') && null !== $object->getTaxCharges()) { - $values_1 = []; - foreach ($object->getTaxCharges() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['TaxCharges'] = $values_1; - } - if ($object->isInitialized('totalCharge') && null !== $object->getTotalCharge()) { - $data['TotalCharge'] = $this->normalizer->normalize($object->getTotalCharge(), 'json', $context); - } - if ($object->isInitialized('totalChargesWithTaxes') && null !== $object->getTotalChargesWithTaxes()) { - $data['TotalChargesWithTaxes'] = $this->normalizer->normalize($object->getTotalChargesWithTaxes(), 'json', $context); + if (\array_key_exists('ItemizedCharges', $data)) { + $values = []; + foreach ($data['ItemizedCharges'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; + $object->setItemizedCharges($values); + unset($data['ItemizedCharges']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class => false]; + if (\array_key_exists('TaxCharges', $data)) { + $values_1 = []; + foreach ($data['TaxCharges'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class, 'json', $context); + } + $object->setTaxCharges($values_1); + unset($data['TaxCharges']); } - } -} else { - class ShipmentResultsNegotiatedRateChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class; + if (\array_key_exists('TotalCharge', $data)) { + $object->setTotalCharge($this->denormalizer->denormalize($data['TotalCharge'], \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class, 'json', $context)); + unset($data['TotalCharge']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class; + if (\array_key_exists('TotalChargesWithTaxes', $data)) { + $object->setTotalChargesWithTaxes($this->denormalizer->denormalize($data['TotalChargesWithTaxes'], \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class, 'json', $context)); + unset($data['TotalChargesWithTaxes']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values = []; - foreach ($data['ItemizedCharges'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\NegotiatedRateChargesItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values); - unset($data['ItemizedCharges']); - } - if (\array_key_exists('TaxCharges', $data)) { - $values_1 = []; - foreach ($data['TaxCharges'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\NegotiatedRateChargesTaxCharges::class, 'json', $context); - } - $object->setTaxCharges($values_1); - unset($data['TaxCharges']); - } - if (\array_key_exists('TotalCharge', $data)) { - $object->setTotalCharge($this->denormalizer->denormalize($data['TotalCharge'], \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalCharge::class, 'json', $context)); - unset($data['TotalCharge']); - } - if (\array_key_exists('TotalChargesWithTaxes', $data)) { - $object->setTotalChargesWithTaxes($this->denormalizer->denormalize($data['TotalChargesWithTaxes'], \ShipStream\Ups\Api\Model\NegotiatedRateChargesTotalChargesWithTaxes::class, 'json', $context)); - unset($data['TotalChargesWithTaxes']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values = []; - foreach ($object->getItemizedCharges() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ItemizedCharges'] = $values; - } - if ($object->isInitialized('taxCharges') && null !== $object->getTaxCharges()) { - $values_1 = []; - foreach ($object->getTaxCharges() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['TaxCharges'] = $values_1; - } - if ($object->isInitialized('totalCharge') && null !== $object->getTotalCharge()) { - $data['TotalCharge'] = $this->normalizer->normalize($object->getTotalCharge(), 'json', $context); - } - if ($object->isInitialized('totalChargesWithTaxes') && null !== $object->getTotalChargesWithTaxes()) { - $data['TotalChargesWithTaxes'] = $this->normalizer->normalize($object->getTotalChargesWithTaxes(), 'json', $context); + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('itemizedCharges') && null !== $data->getItemizedCharges()) { + $values = []; + foreach ($data->getItemizedCharges() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $dataArray['ItemizedCharges'] = $values; + } + if ($data->isInitialized('taxCharges') && null !== $data->getTaxCharges()) { + $values_1 = []; + foreach ($data->getTaxCharges() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['TaxCharges'] = $values_1; + } + if ($data->isInitialized('totalCharge') && null !== $data->getTotalCharge()) { + $dataArray['TotalCharge'] = $this->normalizer->normalize($data->getTotalCharge(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class => false]; + if ($data->isInitialized('totalChargesWithTaxes') && null !== $data->getTotalChargesWithTaxes()) { + $dataArray['TotalChargesWithTaxes'] = $this->normalizer->normalize($data->getTotalChargesWithTaxes(), 'json', $context); } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsNegotiatedRateCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsPackageResultsNormalizer.php b/src/Api/Normalizer/ShipmentResultsPackageResultsNormalizer.php index 23152ff0..df5bb7b3 100644 --- a/src/Api/Normalizer/ShipmentResultsPackageResultsNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsPackageResultsNormalizer.php @@ -5,338 +5,168 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsPackageResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsPackageResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('RateModifier', $data)) { - $object->setRateModifier($this->denormalizer->denormalize($data['RateModifier'], \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class, 'json', $context)); - unset($data['RateModifier']); - } - if (\array_key_exists('BaseServiceCharge', $data)) { - $object->setBaseServiceCharge($this->denormalizer->denormalize($data['BaseServiceCharge'], \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class, 'json', $context)); - unset($data['BaseServiceCharge']); - } - if (\array_key_exists('ServiceOptionsCharges', $data)) { - $object->setServiceOptionsCharges($this->denormalizer->denormalize($data['ServiceOptionsCharges'], \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class, 'json', $context)); - unset($data['ServiceOptionsCharges']); - } - if (\array_key_exists('ShippingLabel', $data) && $data['ShippingLabel'] !== null) { - $object->setShippingLabel($this->denormalizer->denormalize($data['ShippingLabel'], \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class, 'json', $context)); - unset($data['ShippingLabel']); - } - elseif (\array_key_exists('ShippingLabel', $data) && $data['ShippingLabel'] === null) { - $object->setShippingLabel(null); - } - if (\array_key_exists('ShippingReceipt', $data)) { - $object->setShippingReceipt($this->denormalizer->denormalize($data['ShippingReceipt'], \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class, 'json', $context)); - unset($data['ShippingReceipt']); - } - if (\array_key_exists('USPSPICNumber', $data)) { - $object->setUSPSPICNumber($data['USPSPICNumber']); - unset($data['USPSPICNumber']); - } - if (\array_key_exists('CN22Number', $data)) { - $object->setCN22Number($data['CN22Number']); - unset($data['CN22Number']); - } - if (\array_key_exists('Accessorial', $data)) { - $values = []; - foreach ($data['Accessorial'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class, 'json', $context); - } - $object->setAccessorial($values); - unset($data['Accessorial']); - } - if (\array_key_exists('SimpleRate', $data)) { - $object->setSimpleRate($this->denormalizer->denormalize($data['SimpleRate'], \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class, 'json', $context)); - unset($data['SimpleRate']); - } - if (\array_key_exists('Form', $data) && $data['Form'] !== null) { - $object->setForm($this->denormalizer->denormalize($data['Form'], \ShipStream\Ups\Api\Model\PackageResultsForm::class, 'json', $context)); - unset($data['Form']); - } - elseif (\array_key_exists('Form', $data) && $data['Form'] === null) { - $object->setForm(null); - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values_1 = []; - foreach ($data['ItemizedCharges'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values_1); - unset($data['ItemizedCharges']); - } - if (\array_key_exists('NegotiatedCharges', $data)) { - $object->setNegotiatedCharges($this->denormalizer->denormalize($data['NegotiatedCharges'], \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class, 'json', $context)); - unset($data['NegotiatedCharges']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['TrackingNumber'] = $object->getTrackingNumber(); - if ($object->isInitialized('rateModifier') && null !== $object->getRateModifier()) { - $data['RateModifier'] = $this->normalizer->normalize($object->getRateModifier(), 'json', $context); - } - if ($object->isInitialized('baseServiceCharge') && null !== $object->getBaseServiceCharge()) { - $data['BaseServiceCharge'] = $this->normalizer->normalize($object->getBaseServiceCharge(), 'json', $context); - } - if ($object->isInitialized('serviceOptionsCharges') && null !== $object->getServiceOptionsCharges()) { - $data['ServiceOptionsCharges'] = $this->normalizer->normalize($object->getServiceOptionsCharges(), 'json', $context); - } - if ($object->isInitialized('shippingLabel') && null !== $object->getShippingLabel()) { - $data['ShippingLabel'] = $this->normalizer->normalize($object->getShippingLabel(), 'json', $context); - } - if ($object->isInitialized('shippingReceipt') && null !== $object->getShippingReceipt()) { - $data['ShippingReceipt'] = $this->normalizer->normalize($object->getShippingReceipt(), 'json', $context); - } - if ($object->isInitialized('uSPSPICNumber') && null !== $object->getUSPSPICNumber()) { - $data['USPSPICNumber'] = $object->getUSPSPICNumber(); - } - if ($object->isInitialized('cN22Number') && null !== $object->getCN22Number()) { - $data['CN22Number'] = $object->getCN22Number(); - } - if ($object->isInitialized('accessorial') && null !== $object->getAccessorial()) { - $values = []; - foreach ($object->getAccessorial() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Accessorial'] = $values; - } - if ($object->isInitialized('simpleRate') && null !== $object->getSimpleRate()) { - $data['SimpleRate'] = $this->normalizer->normalize($object->getSimpleRate(), 'json', $context); - } - if ($object->isInitialized('form') && null !== $object->getForm()) { - $data['Form'] = $this->normalizer->normalize($object->getForm(), 'json', $context); - } - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values_1 = []; - foreach ($object->getItemizedCharges() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ItemizedCharges'] = $values_1; - } - if ($object->isInitialized('negotiatedCharges') && null !== $object->getNegotiatedCharges()) { - $data['NegotiatedCharges'] = $this->normalizer->normalize($object->getNegotiatedCharges(), 'json', $context); + if (\array_key_exists('TrackingNumber', $data)) { + $object->setTrackingNumber($data['TrackingNumber']); + unset($data['TrackingNumber']); + } + if (\array_key_exists('RateModifier', $data)) { + $object->setRateModifier($this->denormalizer->denormalize($data['RateModifier'], \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class, 'json', $context)); + unset($data['RateModifier']); + } + if (\array_key_exists('BaseServiceCharge', $data)) { + $object->setBaseServiceCharge($this->denormalizer->denormalize($data['BaseServiceCharge'], \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class, 'json', $context)); + unset($data['BaseServiceCharge']); + } + if (\array_key_exists('ServiceOptionsCharges', $data)) { + $object->setServiceOptionsCharges($this->denormalizer->denormalize($data['ServiceOptionsCharges'], \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class, 'json', $context)); + unset($data['ServiceOptionsCharges']); + } + if (\array_key_exists('ShippingLabel', $data) && $data['ShippingLabel'] !== null) { + $object->setShippingLabel($this->denormalizer->denormalize($data['ShippingLabel'], \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class, 'json', $context)); + unset($data['ShippingLabel']); + } + elseif (\array_key_exists('ShippingLabel', $data) && $data['ShippingLabel'] === null) { + $object->setShippingLabel(null); + } + if (\array_key_exists('ShippingReceipt', $data)) { + $object->setShippingReceipt($this->denormalizer->denormalize($data['ShippingReceipt'], \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class, 'json', $context)); + unset($data['ShippingReceipt']); + } + if (\array_key_exists('USPSPICNumber', $data)) { + $object->setUSPSPICNumber($data['USPSPICNumber']); + unset($data['USPSPICNumber']); + } + if (\array_key_exists('CN22Number', $data)) { + $object->setCN22Number($data['CN22Number']); + unset($data['CN22Number']); + } + if (\array_key_exists('Accessorial', $data)) { + $values = []; + foreach ($data['Accessorial'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setAccessorial($values); + unset($data['Accessorial']); + } + if (\array_key_exists('SimpleRate', $data)) { + $object->setSimpleRate($this->denormalizer->denormalize($data['SimpleRate'], \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class, 'json', $context)); + unset($data['SimpleRate']); + } + if (\array_key_exists('Form', $data) && $data['Form'] !== null) { + $object->setForm($this->denormalizer->denormalize($data['Form'], \ShipStream\Ups\Api\Model\PackageResultsForm::class, 'json', $context)); + unset($data['Form']); + } + elseif (\array_key_exists('Form', $data) && $data['Form'] === null) { + $object->setForm(null); + } + if (\array_key_exists('ItemizedCharges', $data)) { + $values_1 = []; + foreach ($data['ItemizedCharges'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class, 'json', $context); } - return $data; + $object->setItemizedCharges($values_1); + unset($data['ItemizedCharges']); + } + if (\array_key_exists('NegotiatedCharges', $data)) { + $object->setNegotiatedCharges($this->denormalizer->denormalize($data['NegotiatedCharges'], \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class, 'json', $context)); + unset($data['NegotiatedCharges']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } } + return $object; } -} else { - class ShipmentResultsPackageResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsPackageResults(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('RateModifier', $data)) { - $object->setRateModifier($this->denormalizer->denormalize($data['RateModifier'], \ShipStream\Ups\Api\Model\PackageResultsRateModifier::class, 'json', $context)); - unset($data['RateModifier']); - } - if (\array_key_exists('BaseServiceCharge', $data)) { - $object->setBaseServiceCharge($this->denormalizer->denormalize($data['BaseServiceCharge'], \ShipStream\Ups\Api\Model\PackageResultsBaseServiceCharge::class, 'json', $context)); - unset($data['BaseServiceCharge']); - } - if (\array_key_exists('ServiceOptionsCharges', $data)) { - $object->setServiceOptionsCharges($this->denormalizer->denormalize($data['ServiceOptionsCharges'], \ShipStream\Ups\Api\Model\PackageResultsServiceOptionsCharges::class, 'json', $context)); - unset($data['ServiceOptionsCharges']); - } - if (\array_key_exists('ShippingLabel', $data) && $data['ShippingLabel'] !== null) { - $object->setShippingLabel($this->denormalizer->denormalize($data['ShippingLabel'], \ShipStream\Ups\Api\Model\PackageResultsShippingLabel::class, 'json', $context)); - unset($data['ShippingLabel']); - } - elseif (\array_key_exists('ShippingLabel', $data) && $data['ShippingLabel'] === null) { - $object->setShippingLabel(null); - } - if (\array_key_exists('ShippingReceipt', $data)) { - $object->setShippingReceipt($this->denormalizer->denormalize($data['ShippingReceipt'], \ShipStream\Ups\Api\Model\PackageResultsShippingReceipt::class, 'json', $context)); - unset($data['ShippingReceipt']); - } - if (\array_key_exists('USPSPICNumber', $data)) { - $object->setUSPSPICNumber($data['USPSPICNumber']); - unset($data['USPSPICNumber']); - } - if (\array_key_exists('CN22Number', $data)) { - $object->setCN22Number($data['CN22Number']); - unset($data['CN22Number']); - } - if (\array_key_exists('Accessorial', $data)) { - $values = []; - foreach ($data['Accessorial'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\PackageResultsAccessorial::class, 'json', $context); - } - $object->setAccessorial($values); - unset($data['Accessorial']); - } - if (\array_key_exists('SimpleRate', $data)) { - $object->setSimpleRate($this->denormalizer->denormalize($data['SimpleRate'], \ShipStream\Ups\Api\Model\PackageResultsSimpleRate::class, 'json', $context)); - unset($data['SimpleRate']); - } - if (\array_key_exists('Form', $data) && $data['Form'] !== null) { - $object->setForm($this->denormalizer->denormalize($data['Form'], \ShipStream\Ups\Api\Model\PackageResultsForm::class, 'json', $context)); - unset($data['Form']); - } - elseif (\array_key_exists('Form', $data) && $data['Form'] === null) { - $object->setForm(null); - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values_1 = []; - foreach ($data['ItemizedCharges'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\PackageResultsItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values_1); - unset($data['ItemizedCharges']); - } - if (\array_key_exists('NegotiatedCharges', $data)) { - $object->setNegotiatedCharges($this->denormalizer->denormalize($data['NegotiatedCharges'], \ShipStream\Ups\Api\Model\PackageResultsNegotiatedCharges::class, 'json', $context)); - unset($data['NegotiatedCharges']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray = []; + $dataArray['TrackingNumber'] = $data->getTrackingNumber(); + if ($data->isInitialized('rateModifier') && null !== $data->getRateModifier()) { + $dataArray['RateModifier'] = $this->normalizer->normalize($data->getRateModifier(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['TrackingNumber'] = $object->getTrackingNumber(); - if ($object->isInitialized('rateModifier') && null !== $object->getRateModifier()) { - $data['RateModifier'] = $this->normalizer->normalize($object->getRateModifier(), 'json', $context); - } - if ($object->isInitialized('baseServiceCharge') && null !== $object->getBaseServiceCharge()) { - $data['BaseServiceCharge'] = $this->normalizer->normalize($object->getBaseServiceCharge(), 'json', $context); - } - if ($object->isInitialized('serviceOptionsCharges') && null !== $object->getServiceOptionsCharges()) { - $data['ServiceOptionsCharges'] = $this->normalizer->normalize($object->getServiceOptionsCharges(), 'json', $context); - } - if ($object->isInitialized('shippingLabel') && null !== $object->getShippingLabel()) { - $data['ShippingLabel'] = $this->normalizer->normalize($object->getShippingLabel(), 'json', $context); - } - if ($object->isInitialized('shippingReceipt') && null !== $object->getShippingReceipt()) { - $data['ShippingReceipt'] = $this->normalizer->normalize($object->getShippingReceipt(), 'json', $context); - } - if ($object->isInitialized('uSPSPICNumber') && null !== $object->getUSPSPICNumber()) { - $data['USPSPICNumber'] = $object->getUSPSPICNumber(); - } - if ($object->isInitialized('cN22Number') && null !== $object->getCN22Number()) { - $data['CN22Number'] = $object->getCN22Number(); - } - if ($object->isInitialized('accessorial') && null !== $object->getAccessorial()) { - $values = []; - foreach ($object->getAccessorial() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Accessorial'] = $values; - } - if ($object->isInitialized('simpleRate') && null !== $object->getSimpleRate()) { - $data['SimpleRate'] = $this->normalizer->normalize($object->getSimpleRate(), 'json', $context); - } - if ($object->isInitialized('form') && null !== $object->getForm()) { - $data['Form'] = $this->normalizer->normalize($object->getForm(), 'json', $context); - } - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values_1 = []; - foreach ($object->getItemizedCharges() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ItemizedCharges'] = $values_1; - } - if ($object->isInitialized('negotiatedCharges') && null !== $object->getNegotiatedCharges()) { - $data['NegotiatedCharges'] = $this->normalizer->normalize($object->getNegotiatedCharges(), 'json', $context); + if ($data->isInitialized('baseServiceCharge') && null !== $data->getBaseServiceCharge()) { + $dataArray['BaseServiceCharge'] = $this->normalizer->normalize($data->getBaseServiceCharge(), 'json', $context); + } + if ($data->isInitialized('serviceOptionsCharges') && null !== $data->getServiceOptionsCharges()) { + $dataArray['ServiceOptionsCharges'] = $this->normalizer->normalize($data->getServiceOptionsCharges(), 'json', $context); + } + if ($data->isInitialized('shippingLabel')) { + $dataArray['ShippingLabel'] = $this->normalizer->normalize($data->getShippingLabel(), 'json', $context); + } + if ($data->isInitialized('shippingReceipt') && null !== $data->getShippingReceipt()) { + $dataArray['ShippingReceipt'] = $this->normalizer->normalize($data->getShippingReceipt(), 'json', $context); + } + if ($data->isInitialized('uSPSPICNumber') && null !== $data->getUSPSPICNumber()) { + $dataArray['USPSPICNumber'] = $data->getUSPSPICNumber(); + } + if ($data->isInitialized('cN22Number') && null !== $data->getCN22Number()) { + $dataArray['CN22Number'] = $data->getCN22Number(); + } + if ($data->isInitialized('accessorial') && null !== $data->getAccessorial()) { + $values = []; + foreach ($data->getAccessorial() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $dataArray['Accessorial'] = $values; + } + if ($data->isInitialized('simpleRate') && null !== $data->getSimpleRate()) { + $dataArray['SimpleRate'] = $this->normalizer->normalize($data->getSimpleRate(), 'json', $context); + } + if ($data->isInitialized('form')) { + $dataArray['Form'] = $this->normalizer->normalize($data->getForm(), 'json', $context); + } + if ($data->isInitialized('itemizedCharges') && null !== $data->getItemizedCharges()) { + $values_1 = []; + foreach ($data->getItemizedCharges() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['ItemizedCharges'] = $values_1; + } + if ($data->isInitialized('negotiatedCharges') && null !== $data->getNegotiatedCharges()) { + $dataArray['NegotiatedCharges'] = $this->normalizer->normalize($data->getNegotiatedCharges(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsPackageResults::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsRateNormalizer.php b/src/Api/Normalizer/ShipmentResultsRateNormalizer.php index f81abd44..b99b1600 100644 --- a/src/Api/Normalizer/ShipmentResultsRateNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsRateNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsRate::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsRate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsRate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsRate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\RateType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Factor', $data)) { - $object->setFactor($this->denormalizer->denormalize($data['Factor'], \ShipStream\Ups\Api\Model\RateFactor::class, 'json', $context)); - unset($data['Factor']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsRate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Factor'] = $this->normalizer->normalize($object->getFactor(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsRate::class => false]; - } - } -} else { - class ShipmentResultsRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsRate::class; + if (\array_key_exists('Type', $data)) { + $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\RateType::class, 'json', $context)); + unset($data['Type']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsRate::class; + if (\array_key_exists('Factor', $data)) { + $object->setFactor($this->denormalizer->denormalize($data['Factor'], \ShipStream\Ups\Api\Model\RateFactor::class, 'json', $context)); + unset($data['Factor']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsRate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($this->denormalizer->denormalize($data['Type'], \ShipStream\Ups\Api\Model\RateType::class, 'json', $context)); - unset($data['Type']); - } - if (\array_key_exists('Factor', $data)) { - $object->setFactor($this->denormalizer->denormalize($data['Factor'], \ShipStream\Ups\Api\Model\RateFactor::class, 'json', $context)); - unset($data['Factor']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Type'] = $this->normalizer->normalize($object->getType(), 'json', $context); - $data['Factor'] = $this->normalizer->normalize($object->getFactor(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Type'] = $this->normalizer->normalize($data->getType(), 'json', $context); + $dataArray['Factor'] = $this->normalizer->normalize($data->getFactor(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsRate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsRate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsServiceNormalizer.php b/src/Api/Normalizer/ShipmentResultsServiceNormalizer.php index 270bc28d..47f5fb43 100644 --- a/src/Api/Normalizer/ShipmentResultsServiceNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsServiceNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsService::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsService::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsService::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsService::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsService(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsService::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentResultsServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsService::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsService::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsService::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsService::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsShipmentChargesNormalizer.php b/src/Api/Normalizer/ShipmentResultsShipmentChargesNormalizer.php index 2153acea..a6adb4b1 100644 --- a/src/Api/Normalizer/ShipmentResultsShipmentChargesNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsShipmentChargesNormalizer.php @@ -5,248 +5,123 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsShipmentChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsShipmentChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RateChart', $data)) { - $object->setRateChart($data['RateChart']); - unset($data['RateChart']); - } - if (\array_key_exists('BaseServiceCharge', $data)) { - $object->setBaseServiceCharge($this->denormalizer->denormalize($data['BaseServiceCharge'], \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class, 'json', $context)); - unset($data['BaseServiceCharge']); - } - if (\array_key_exists('TransportationCharges', $data)) { - $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class, 'json', $context)); - unset($data['TransportationCharges']); - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values = []; - foreach ($data['ItemizedCharges'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values); - unset($data['ItemizedCharges']); - } - if (\array_key_exists('ServiceOptionsCharges', $data)) { - $object->setServiceOptionsCharges($this->denormalizer->denormalize($data['ServiceOptionsCharges'], \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class, 'json', $context)); - unset($data['ServiceOptionsCharges']); - } - if (\array_key_exists('TaxCharges', $data)) { - $values_1 = []; - foreach ($data['TaxCharges'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class, 'json', $context); - } - $object->setTaxCharges($values_1); - unset($data['TaxCharges']); - } - if (\array_key_exists('TotalCharges', $data)) { - $object->setTotalCharges($this->denormalizer->denormalize($data['TotalCharges'], \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class, 'json', $context)); - unset($data['TotalCharges']); - } - if (\array_key_exists('TotalChargesWithTaxes', $data)) { - $object->setTotalChargesWithTaxes($this->denormalizer->denormalize($data['TotalChargesWithTaxes'], \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class, 'json', $context)); - unset($data['TotalChargesWithTaxes']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('rateChart') && null !== $object->getRateChart()) { - $data['RateChart'] = $object->getRateChart(); - } - if ($object->isInitialized('baseServiceCharge') && null !== $object->getBaseServiceCharge()) { - $data['BaseServiceCharge'] = $this->normalizer->normalize($object->getBaseServiceCharge(), 'json', $context); - } - $data['TransportationCharges'] = $this->normalizer->normalize($object->getTransportationCharges(), 'json', $context); - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values = []; - foreach ($object->getItemizedCharges() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ItemizedCharges'] = $values; - } - $data['ServiceOptionsCharges'] = $this->normalizer->normalize($object->getServiceOptionsCharges(), 'json', $context); - if ($object->isInitialized('taxCharges') && null !== $object->getTaxCharges()) { - $values_1 = []; - foreach ($object->getTaxCharges() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['TaxCharges'] = $values_1; - } - $data['TotalCharges'] = $this->normalizer->normalize($object->getTotalCharges(), 'json', $context); - if ($object->isInitialized('totalChargesWithTaxes') && null !== $object->getTotalChargesWithTaxes()) { - $data['TotalChargesWithTaxes'] = $this->normalizer->normalize($object->getTotalChargesWithTaxes(), 'json', $context); + if (\array_key_exists('RateChart', $data)) { + $object->setRateChart($data['RateChart']); + unset($data['RateChart']); + } + if (\array_key_exists('BaseServiceCharge', $data)) { + $object->setBaseServiceCharge($this->denormalizer->denormalize($data['BaseServiceCharge'], \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class, 'json', $context)); + unset($data['BaseServiceCharge']); + } + if (\array_key_exists('TransportationCharges', $data)) { + $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class, 'json', $context)); + unset($data['TransportationCharges']); + } + if (\array_key_exists('ItemizedCharges', $data)) { + $values = []; + foreach ($data['ItemizedCharges'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setItemizedCharges($values); + unset($data['ItemizedCharges']); + } + if (\array_key_exists('ServiceOptionsCharges', $data)) { + $object->setServiceOptionsCharges($this->denormalizer->denormalize($data['ServiceOptionsCharges'], \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class, 'json', $context)); + unset($data['ServiceOptionsCharges']); + } + if (\array_key_exists('TaxCharges', $data)) { + $values_1 = []; + foreach ($data['TaxCharges'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class, 'json', $context); } - return $data; + $object->setTaxCharges($values_1); + unset($data['TaxCharges']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class => false]; + if (\array_key_exists('TotalCharges', $data)) { + $object->setTotalCharges($this->denormalizer->denormalize($data['TotalCharges'], \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class, 'json', $context)); + unset($data['TotalCharges']); } + if (\array_key_exists('TotalChargesWithTaxes', $data)) { + $object->setTotalChargesWithTaxes($this->denormalizer->denormalize($data['TotalChargesWithTaxes'], \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class, 'json', $context)); + unset($data['TotalChargesWithTaxes']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } -} else { - class ShipmentResultsShipmentChargesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RateChart', $data)) { - $object->setRateChart($data['RateChart']); - unset($data['RateChart']); - } - if (\array_key_exists('BaseServiceCharge', $data)) { - $object->setBaseServiceCharge($this->denormalizer->denormalize($data['BaseServiceCharge'], \ShipStream\Ups\Api\Model\ShipmentChargesBaseServiceCharge::class, 'json', $context)); - unset($data['BaseServiceCharge']); - } - if (\array_key_exists('TransportationCharges', $data)) { - $object->setTransportationCharges($this->denormalizer->denormalize($data['TransportationCharges'], \ShipStream\Ups\Api\Model\ShipmentChargesTransportationCharges::class, 'json', $context)); - unset($data['TransportationCharges']); - } - if (\array_key_exists('ItemizedCharges', $data)) { - $values = []; - foreach ($data['ItemizedCharges'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentChargesItemizedCharges::class, 'json', $context); - } - $object->setItemizedCharges($values); - unset($data['ItemizedCharges']); - } - if (\array_key_exists('ServiceOptionsCharges', $data)) { - $object->setServiceOptionsCharges($this->denormalizer->denormalize($data['ServiceOptionsCharges'], \ShipStream\Ups\Api\Model\ShipmentChargesServiceOptionsCharges::class, 'json', $context)); - unset($data['ServiceOptionsCharges']); - } - if (\array_key_exists('TaxCharges', $data)) { - $values_1 = []; - foreach ($data['TaxCharges'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentChargesTaxCharges::class, 'json', $context); - } - $object->setTaxCharges($values_1); - unset($data['TaxCharges']); - } - if (\array_key_exists('TotalCharges', $data)) { - $object->setTotalCharges($this->denormalizer->denormalize($data['TotalCharges'], \ShipStream\Ups\Api\Model\ShipmentChargesTotalCharges::class, 'json', $context)); - unset($data['TotalCharges']); - } - if (\array_key_exists('TotalChargesWithTaxes', $data)) { - $object->setTotalChargesWithTaxes($this->denormalizer->denormalize($data['TotalChargesWithTaxes'], \ShipStream\Ups\Api\Model\ShipmentChargesTotalChargesWithTaxes::class, 'json', $context)); - unset($data['TotalChargesWithTaxes']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('rateChart') && null !== $data->getRateChart()) { + $dataArray['RateChart'] = $data->getRateChart(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('rateChart') && null !== $object->getRateChart()) { - $data['RateChart'] = $object->getRateChart(); - } - if ($object->isInitialized('baseServiceCharge') && null !== $object->getBaseServiceCharge()) { - $data['BaseServiceCharge'] = $this->normalizer->normalize($object->getBaseServiceCharge(), 'json', $context); - } - $data['TransportationCharges'] = $this->normalizer->normalize($object->getTransportationCharges(), 'json', $context); - if ($object->isInitialized('itemizedCharges') && null !== $object->getItemizedCharges()) { - $values = []; - foreach ($object->getItemizedCharges() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ItemizedCharges'] = $values; - } - $data['ServiceOptionsCharges'] = $this->normalizer->normalize($object->getServiceOptionsCharges(), 'json', $context); - if ($object->isInitialized('taxCharges') && null !== $object->getTaxCharges()) { - $values_1 = []; - foreach ($object->getTaxCharges() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['TaxCharges'] = $values_1; - } - $data['TotalCharges'] = $this->normalizer->normalize($object->getTotalCharges(), 'json', $context); - if ($object->isInitialized('totalChargesWithTaxes') && null !== $object->getTotalChargesWithTaxes()) { - $data['TotalChargesWithTaxes'] = $this->normalizer->normalize($object->getTotalChargesWithTaxes(), 'json', $context); + if ($data->isInitialized('baseServiceCharge') && null !== $data->getBaseServiceCharge()) { + $dataArray['BaseServiceCharge'] = $this->normalizer->normalize($data->getBaseServiceCharge(), 'json', $context); + } + $dataArray['TransportationCharges'] = $this->normalizer->normalize($data->getTransportationCharges(), 'json', $context); + if ($data->isInitialized('itemizedCharges') && null !== $data->getItemizedCharges()) { + $values = []; + foreach ($data->getItemizedCharges() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $dataArray['ItemizedCharges'] = $values; + } + $dataArray['ServiceOptionsCharges'] = $this->normalizer->normalize($data->getServiceOptionsCharges(), 'json', $context); + if ($data->isInitialized('taxCharges') && null !== $data->getTaxCharges()) { + $values_1 = []; + foreach ($data->getTaxCharges() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['TaxCharges'] = $values_1; + } + $dataArray['TotalCharges'] = $this->normalizer->normalize($data->getTotalCharges(), 'json', $context); + if ($data->isInitialized('totalChargesWithTaxes') && null !== $data->getTotalChargesWithTaxes()) { + $dataArray['TotalChargesWithTaxes'] = $this->normalizer->normalize($data->getTotalChargesWithTaxes(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsShipmentCharges::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsTimeInTransitNormalizer.php b/src/Api/Normalizer/ShipmentResultsTimeInTransitNormalizer.php index a45095cb..4df38896 100644 --- a/src/Api/Normalizer/ShipmentResultsTimeInTransitNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsTimeInTransitNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsTimeInTransitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsTimeInTransitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DaysInTransit', $data)) { - $object->setDaysInTransit($data['DaysInTransit']); - unset($data['DaysInTransit']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('daysInTransit') && null !== $object->getDaysInTransit()) { - $data['DaysInTransit'] = $object->getDaysInTransit(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DaysInTransit', $data)) { + $object->setDaysInTransit($data['DaysInTransit']); + unset($data['DaysInTransit']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentResultsTimeInTransitNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class; + $dataArray = []; + if ($data->isInitialized('daysInTransit') && null !== $data->getDaysInTransit()) { + $dataArray['DaysInTransit'] = $data->getDaysInTransit(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DaysInTransit', $data)) { - $object->setDaysInTransit($data['DaysInTransit']); - unset($data['DaysInTransit']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('daysInTransit') && null !== $object->getDaysInTransit()) { - $data['DaysInTransit'] = $object->getDaysInTransit(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsTimeInTransit::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentResultsTotalShipmentChargeNormalizer.php b/src/Api/Normalizer/ShipmentResultsTotalShipmentChargeNormalizer.php index 45798f95..217fc27c 100644 --- a/src/Api/Normalizer/ShipmentResultsTotalShipmentChargeNormalizer.php +++ b/src/Api/Normalizer/ShipmentResultsTotalShipmentChargeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsTotalShipmentChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentResultsTotalShipmentChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class => false]; - } - } -} else { - class ShipmentResultsTotalShipmentChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentResultsTotalShipmentCharge::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentReturnServiceNormalizer.php b/src/Api/Normalizer/ShipmentReturnServiceNormalizer.php index 7399456a..c75ad2d8 100644 --- a/src/Api/Normalizer/ShipmentReturnServiceNormalizer.php +++ b/src/Api/Normalizer/ShipmentReturnServiceNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentReturnServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentReturnServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentReturnService::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentReturnService::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentReturnService::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentReturnService::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentReturnService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentReturnService(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentReturnService::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentReturnServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentReturnService::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentReturnService::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentReturnService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentReturnService::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentReturnService::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceNormalizer.php b/src/Api/Normalizer/ShipmentServiceNormalizer.php index 59b98901..5252b992 100644 --- a/src/Api/Normalizer/ShipmentServiceNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentService::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentService::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentService::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentService::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentService(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentService::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentService::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentService::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentService::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentService::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsAccessPointCODNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsAccessPointCODNormalizer.php index 6a01dead..210576f0 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsAccessPointCODNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsAccessPointCODNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsAccessPointCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsAccessPointCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class => false]; - } - } -} else { - class ShipmentServiceOptionsAccessPointCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsAdjustedHeightNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsAdjustedHeightNormalizer.php index eab0075c..58098a11 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsAdjustedHeightNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsAdjustedHeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsAdjustedHeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsAdjustedHeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class => false]; - } - } -} else { - class ShipmentServiceOptionsAdjustedHeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($data['Value']); + unset($data['Value']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Value', $data)) { - $object->setValue($data['Value']); - unset($data['Value']); - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\AdjustedHeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Value'] = $object->getValue(); - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Value'] = $data->getValue(); + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsAdjustedHeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsCODCODAmountNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsCODCODAmountNormalizer.php index 6f964ec2..8afb2328 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsCODCODAmountNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsCODCODAmountNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsCODCODAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsCODCODAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class => false]; - } - } -} else { - class ShipmentServiceOptionsCODCODAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsCODCODAmount::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsCODNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsCODNormalizer.php index 8342b4c1..21f73c06 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsCODNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsCODNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CODFundsCode', $data)) { - $object->setCODFundsCode($data['CODFundsCode']); - unset($data['CODFundsCode']); - } - if (\array_key_exists('CODAmount', $data)) { - $object->setCODAmount($this->denormalizer->denormalize($data['CODAmount'], \ShipStream\Ups\Api\Model\CODCODAmount::class, 'json', $context)); - unset($data['CODAmount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CODFundsCode'] = $object->getCODFundsCode(); - $data['CODAmount'] = $this->normalizer->normalize($object->getCODAmount(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class => false]; - } - } -} else { - class ShipmentServiceOptionsCODNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class; + if (\array_key_exists('CODFundsCode', $data)) { + $object->setCODFundsCode($data['CODFundsCode']); + unset($data['CODFundsCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class; + if (\array_key_exists('CODAmount', $data)) { + $object->setCODAmount($this->denormalizer->denormalize($data['CODAmount'], \ShipStream\Ups\Api\Model\CODCODAmount::class, 'json', $context)); + unset($data['CODAmount']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CODFundsCode', $data)) { - $object->setCODFundsCode($data['CODFundsCode']); - unset($data['CODFundsCode']); - } - if (\array_key_exists('CODAmount', $data)) { - $object->setCODAmount($this->denormalizer->denormalize($data['CODAmount'], \ShipStream\Ups\Api\Model\CODCODAmount::class, 'json', $context)); - unset($data['CODAmount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CODFundsCode'] = $object->getCODFundsCode(); - $data['CODAmount'] = $this->normalizer->normalize($object->getCODAmount(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CODFundsCode'] = $data->getCODFundsCode(); + $dataArray['CODAmount'] = $this->normalizer->normalize($data->getCODAmount(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsCallTagARSNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsCallTagARSNormalizer.php index a0e3ec1f..b2c5d347 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsCallTagARSNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsCallTagARSNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsCallTagARSNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsCallTagARSNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentServiceOptionsCallTagARSNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class; + $dataArray = []; + if ($data->isInitialized('number') && null !== $data->getNumber()) { + $dataArray['Number'] = $data->getNumber(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['Code'] = $data->getCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['Number'] = $object->getNumber(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['Code'] = $object->getCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsCallTagARS::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsDangerousGoodsNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsDangerousGoodsNormalizer.php index 7d8be4fe..0779bc4f 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsDangerousGoodsNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsDangerousGoodsNormalizer.php @@ -5,150 +5,74 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsDangerousGoodsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsDangerousGoodsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('TransportationMode', $data)) { - $object->setTransportationMode($this->denormalizer->denormalize($data['TransportationMode'], \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class, 'json', $context)); - unset($data['TransportationMode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - if ($object->isInitialized('transportationMode') && null !== $object->getTransportationMode()) { - $data['TransportationMode'] = $this->normalizer->normalize($object->getTransportationMode(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class => false]; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); } - } -} else { - class ShipmentServiceOptionsDangerousGoodsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class; + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class, 'json', $context)); + unset($data['Phone']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class; + if (\array_key_exists('TransportationMode', $data)) { + $object->setTransportationMode($this->denormalizer->denormalize($data['TransportationMode'], \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class, 'json', $context)); + unset($data['TransportationMode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\DangerousGoodsPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('TransportationMode', $data)) { - $object->setTransportationMode($this->denormalizer->denormalize($data['TransportationMode'], \ShipStream\Ups\Api\Model\DangerousGoodsTransportationMode::class, 'json', $context)); - unset($data['TransportationMode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - if ($object->isInitialized('transportationMode') && null !== $object->getTransportationMode()) { - $data['TransportationMode'] = $this->normalizer->normalize($object->getTransportationMode(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Name'] = $data->getName(); + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); + if ($data->isInitialized('transportationMode') && null !== $data->getTransportationMode()) { + $dataArray['TransportationMode'] = $this->normalizer->normalize($data->getTransportationMode(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsDangerousGoods::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsDeclaredValueNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsDeclaredValueNormalizer.php index 4e8191c7..3538b687 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsDeclaredValueNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsDeclaredValueNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class => false]; - } - } -} else { - class ShipmentServiceOptionsDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeclaredValue::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsDeliveryConfirmationNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsDeliveryConfirmationNormalizer.php index 0f6b3483..9c4b3b86 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsDeliveryConfirmationNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsDeliveryConfirmationNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsDeliveryConfirmationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsDeliveryConfirmationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DCISType', $data)) { - $object->setDCISType($data['DCISType']); - unset($data['DCISType']); - } - if (\array_key_exists('DCISNumber', $data)) { - $object->setDCISNumber($data['DCISNumber']); - unset($data['DCISNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['DCISType'] = $object->getDCISType(); - if ($object->isInitialized('dCISNumber') && null !== $object->getDCISNumber()) { - $data['DCISNumber'] = $object->getDCISNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DCISType', $data)) { + $object->setDCISType($data['DCISType']); + unset($data['DCISType']); + } + if (\array_key_exists('DCISNumber', $data)) { + $object->setDCISNumber($data['DCISNumber']); + unset($data['DCISNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentServiceOptionsDeliveryConfirmationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class; + $dataArray = []; + $dataArray['DCISType'] = $data->getDCISType(); + if ($data->isInitialized('dCISNumber') && null !== $data->getDCISNumber()) { + $dataArray['DCISNumber'] = $data->getDCISNumber(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DCISType', $data)) { - $object->setDCISType($data['DCISType']); - unset($data['DCISType']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('DCISNumber', $data)) { - $object->setDCISNumber($data['DCISNumber']); - unset($data['DCISNumber']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['DCISType'] = $object->getDCISType(); - if ($object->isInitialized('dCISNumber') && null !== $object->getDCISNumber()) { - $data['DCISNumber'] = $object->getDCISNumber(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsDeliveryOptionsNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsDeliveryOptionsNormalizer.php index 1411ef48..817d2e10 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsDeliveryOptionsNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsDeliveryOptionsNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsDeliveryOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsDeliveryOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LiftGateAtDeliveryIndicator', $data)) { - $object->setLiftGateAtDeliveryIndicator($data['LiftGateAtDeliveryIndicator']); - unset($data['LiftGateAtDeliveryIndicator']); - } - if (\array_key_exists('DropOffAtUPSFacilityIndicator', $data)) { - $object->setDropOffAtUPSFacilityIndicator($data['DropOffAtUPSFacilityIndicator']); - unset($data['DropOffAtUPSFacilityIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('liftGateAtDeliveryIndicator') && null !== $object->getLiftGateAtDeliveryIndicator()) { - $data['LiftGateAtDeliveryIndicator'] = $object->getLiftGateAtDeliveryIndicator(); - } - if ($object->isInitialized('dropOffAtUPSFacilityIndicator') && null !== $object->getDropOffAtUPSFacilityIndicator()) { - $data['DropOffAtUPSFacilityIndicator'] = $object->getDropOffAtUPSFacilityIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('LiftGateAtDeliveryIndicator', $data)) { + $object->setLiftGateAtDeliveryIndicator($data['LiftGateAtDeliveryIndicator']); + unset($data['LiftGateAtDeliveryIndicator']); + } + if (\array_key_exists('DropOffAtUPSFacilityIndicator', $data)) { + $object->setDropOffAtUPSFacilityIndicator($data['DropOffAtUPSFacilityIndicator']); + unset($data['DropOffAtUPSFacilityIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentServiceOptionsDeliveryOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class; + $dataArray = []; + if ($data->isInitialized('liftGateAtDeliveryIndicator') && null !== $data->getLiftGateAtDeliveryIndicator()) { + $dataArray['LiftGateAtDeliveryIndicator'] = $data->getLiftGateAtDeliveryIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LiftGateAtDeliveryIndicator', $data)) { - $object->setLiftGateAtDeliveryIndicator($data['LiftGateAtDeliveryIndicator']); - unset($data['LiftGateAtDeliveryIndicator']); - } - if (\array_key_exists('DropOffAtUPSFacilityIndicator', $data)) { - $object->setDropOffAtUPSFacilityIndicator($data['DropOffAtUPSFacilityIndicator']); - unset($data['DropOffAtUPSFacilityIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('dropOffAtUPSFacilityIndicator') && null !== $data->getDropOffAtUPSFacilityIndicator()) { + $dataArray['DropOffAtUPSFacilityIndicator'] = $data->getDropOffAtUPSFacilityIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('liftGateAtDeliveryIndicator') && null !== $object->getLiftGateAtDeliveryIndicator()) { - $data['LiftGateAtDeliveryIndicator'] = $object->getLiftGateAtDeliveryIndicator(); - } - if ($object->isInitialized('dropOffAtUPSFacilityIndicator') && null !== $object->getDropOffAtUPSFacilityIndicator()) { - $data['DropOffAtUPSFacilityIndicator'] = $object->getDropOffAtUPSFacilityIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsEMailInformationNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsEMailInformationNormalizer.php index e20d6365..d8d9dfa5 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsEMailInformationNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsEMailInformationNormalizer.php @@ -5,152 +5,75 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsEMailInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsEMailInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailType', $data)) { - $values = []; - foreach ($data['EMailType'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\EMailInformationEMailType::class, 'json', $context); - } - $object->setEMailType($values); - unset($data['EMailType']); - } - if (\array_key_exists('EMail', $data)) { - $object->setEMail($this->denormalizer->denormalize($data['EMail'], \ShipStream\Ups\Api\Model\EMailInformationEMail::class, 'json', $context)); - unset($data['EMail']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('EMailType', $data)) { $values = []; - foreach ($object->getEMailType() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['EMailType'] = $values; - $data['EMail'] = $this->normalizer->normalize($object->getEMail(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data['EMailType'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\EMailInformationEMailType::class, 'json', $context); } - return $data; + $object->setEMailType($values); + unset($data['EMailType']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class => false]; + if (\array_key_exists('EMail', $data)) { + $object->setEMail($this->denormalizer->denormalize($data['EMail'], \ShipStream\Ups\Api\Model\EMailInformationEMail::class, 'json', $context)); + unset($data['EMail']); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class ShipmentServiceOptionsEMailInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class; + $dataArray = []; + $values = []; + foreach ($data->getEMailType() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['EMailType'] = $values; + $dataArray['EMail'] = $this->normalizer->normalize($data->getEMail(), 'json', $context); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailType', $data)) { - $values = []; - foreach ($data['EMailType'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\EMailInformationEMailType::class, 'json', $context); - } - $object->setEMailType($values); - unset($data['EMailType']); - } - if (\array_key_exists('EMail', $data)) { - $object->setEMail($this->denormalizer->denormalize($data['EMail'], \ShipStream\Ups\Api\Model\EMailInformationEMail::class, 'json', $context)); - unset($data['EMail']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getEMailType() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['EMailType'] = $values; - $data['EMail'] = $this->normalizer->normalize($object->getEMail(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsEMailInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsExcessDeclaredValueNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsExcessDeclaredValueNormalizer.php index 51a7ccc2..2e1b2126 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsExcessDeclaredValueNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsExcessDeclaredValueNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsExcessDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsExcessDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class => false]; - } - } -} else { - class ShipmentServiceOptionsExcessDeclaredValueNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsExcessDeclaredValue::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsHandlingChargeNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsHandlingChargeNormalizer.php index 86791f47..48d1c003 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsHandlingChargeNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsHandlingChargeNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsHandlingChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsHandlingChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Percentage', $data)) { - $object->setPercentage($data['Percentage']); - unset($data['Percentage']); - } - if (\array_key_exists('Amount', $data)) { - $object->setAmount($this->denormalizer->denormalize($data['Amount'], \ShipStream\Ups\Api\Model\HandlingChargeAmount::class, 'json', $context)); - unset($data['Amount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('percentage') && null !== $object->getPercentage()) { - $data['Percentage'] = $object->getPercentage(); - } - if ($object->isInitialized('amount') && null !== $object->getAmount()) { - $data['Amount'] = $this->normalizer->normalize($object->getAmount(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Percentage', $data)) { + $object->setPercentage($data['Percentage']); + unset($data['Percentage']); + } + if (\array_key_exists('Amount', $data)) { + $object->setAmount($this->denormalizer->denormalize($data['Amount'], \ShipStream\Ups\Api\Model\HandlingChargeAmount::class, 'json', $context)); + unset($data['Amount']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentServiceOptionsHandlingChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class; + $dataArray = []; + if ($data->isInitialized('percentage') && null !== $data->getPercentage()) { + $dataArray['Percentage'] = $data->getPercentage(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Percentage', $data)) { - $object->setPercentage($data['Percentage']); - unset($data['Percentage']); - } - if (\array_key_exists('Amount', $data)) { - $object->setAmount($this->denormalizer->denormalize($data['Amount'], \ShipStream\Ups\Api\Model\HandlingChargeAmount::class, 'json', $context)); - unset($data['Amount']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('amount') && null !== $data->getAmount()) { + $dataArray['Amount'] = $this->normalizer->normalize($data->getAmount(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('percentage') && null !== $object->getPercentage()) { - $data['Percentage'] = $object->getPercentage(); - } - if ($object->isInitialized('amount') && null !== $object->getAmount()) { - $data['Amount'] = $this->normalizer->normalize($object->getAmount(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsHandlingCharge::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsImportControlNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsImportControlNormalizer.php index 68c24d2b..fd6a331b 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsImportControlNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsImportControlNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsImportControlNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsImportControlNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentServiceOptionsImportControlNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsImportControl::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsInternationalFormsNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsInternationalFormsNormalizer.php index 37299492..5643d482 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsInternationalFormsNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsInternationalFormsNormalizer.php @@ -5,692 +5,345 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsInternationalFormsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsInternationalFormsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FormType', $data)) { - $values = []; - foreach ($data['FormType'] as $value) { - $values[] = $value; - } - $object->setFormType($values); - unset($data['FormType']); - } - if (\array_key_exists('UserCreatedForm', $data)) { - $object->setUserCreatedForm($this->denormalizer->denormalize($data['UserCreatedForm'], \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class, 'json', $context)); - unset($data['UserCreatedForm']); - } - if (\array_key_exists('UPSPremiumCareForm', $data)) { - $object->setUPSPremiumCareForm($this->denormalizer->denormalize($data['UPSPremiumCareForm'], \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class, 'json', $context)); - unset($data['UPSPremiumCareForm']); - } - if (\array_key_exists('CN22Form', $data)) { - $object->setCN22Form($this->denormalizer->denormalize($data['CN22Form'], \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class, 'json', $context)); - unset($data['CN22Form']); - } - if (\array_key_exists('AdditionalDocumentIndicator', $data)) { - $object->setAdditionalDocumentIndicator($data['AdditionalDocumentIndicator']); - unset($data['AdditionalDocumentIndicator']); - } - if (\array_key_exists('FormGroupIdName', $data)) { - $object->setFormGroupIdName($data['FormGroupIdName']); - unset($data['FormGroupIdName']); - } - if (\array_key_exists('EEIFilingOption', $data)) { - $object->setEEIFilingOption($this->denormalizer->denormalize($data['EEIFilingOption'], \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class, 'json', $context)); - unset($data['EEIFilingOption']); - } - if (\array_key_exists('Contacts', $data)) { - $object->setContacts($this->denormalizer->denormalize($data['Contacts'], \ShipStream\Ups\Api\Model\InternationalFormsContacts::class, 'json', $context)); - unset($data['Contacts']); - } - if (\array_key_exists('Product', $data) && $data['Product'] !== null) { - $values_1 = []; - foreach ($data['Product'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\InternationalFormsProduct::class, 'json', $context); - } - $object->setProduct($values_1); - unset($data['Product']); - } - elseif (\array_key_exists('Product', $data) && $data['Product'] === null) { - $object->setProduct(null); - } - if (\array_key_exists('InvoiceNumber', $data)) { - $object->setInvoiceNumber($data['InvoiceNumber']); - unset($data['InvoiceNumber']); - } - if (\array_key_exists('InvoiceDate', $data)) { - $object->setInvoiceDate($data['InvoiceDate']); - unset($data['InvoiceDate']); - } - if (\array_key_exists('PurchaseOrderNumber', $data)) { - $object->setPurchaseOrderNumber($data['PurchaseOrderNumber']); - unset($data['PurchaseOrderNumber']); - } - if (\array_key_exists('TermsOfShipment', $data)) { - $object->setTermsOfShipment($data['TermsOfShipment']); - unset($data['TermsOfShipment']); - } - if (\array_key_exists('ReasonForExport', $data)) { - $object->setReasonForExport($data['ReasonForExport']); - unset($data['ReasonForExport']); - } - if (\array_key_exists('Comments', $data)) { - $object->setComments($data['Comments']); - unset($data['Comments']); - } - if (\array_key_exists('DeclarationStatement', $data)) { - $object->setDeclarationStatement($data['DeclarationStatement']); - unset($data['DeclarationStatement']); - } - if (\array_key_exists('Discount', $data)) { - $object->setDiscount($this->denormalizer->denormalize($data['Discount'], \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class, 'json', $context)); - unset($data['Discount']); - } - if (\array_key_exists('FreightCharges', $data)) { - $object->setFreightCharges($this->denormalizer->denormalize($data['FreightCharges'], \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class, 'json', $context)); - unset($data['FreightCharges']); - } - if (\array_key_exists('InsuranceCharges', $data)) { - $object->setInsuranceCharges($this->denormalizer->denormalize($data['InsuranceCharges'], \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class, 'json', $context)); - unset($data['InsuranceCharges']); - } - if (\array_key_exists('OtherCharges', $data)) { - $object->setOtherCharges($this->denormalizer->denormalize($data['OtherCharges'], \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class, 'json', $context)); - unset($data['OtherCharges']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('BlanketPeriod', $data)) { - $object->setBlanketPeriod($this->denormalizer->denormalize($data['BlanketPeriod'], \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class, 'json', $context)); - unset($data['BlanketPeriod']); - } - if (\array_key_exists('ExportDate', $data)) { - $object->setExportDate($data['ExportDate']); - unset($data['ExportDate']); - } - if (\array_key_exists('ExportingCarrier', $data)) { - $object->setExportingCarrier($data['ExportingCarrier']); - unset($data['ExportingCarrier']); - } - if (\array_key_exists('CarrierID', $data)) { - $object->setCarrierID($data['CarrierID']); - unset($data['CarrierID']); - } - if (\array_key_exists('InBondCode', $data)) { - $object->setInBondCode($data['InBondCode']); - unset($data['InBondCode']); - } - if (\array_key_exists('EntryNumber', $data)) { - $object->setEntryNumber($data['EntryNumber']); - unset($data['EntryNumber']); - } - if (\array_key_exists('PointOfOrigin', $data)) { - $object->setPointOfOrigin($data['PointOfOrigin']); - unset($data['PointOfOrigin']); - } - if (\array_key_exists('PointOfOriginType', $data)) { - $object->setPointOfOriginType($data['PointOfOriginType']); - unset($data['PointOfOriginType']); - } - if (\array_key_exists('ModeOfTransport', $data)) { - $object->setModeOfTransport($data['ModeOfTransport']); - unset($data['ModeOfTransport']); - } - if (\array_key_exists('PortOfExport', $data)) { - $object->setPortOfExport($data['PortOfExport']); - unset($data['PortOfExport']); - } - if (\array_key_exists('PortOfUnloading', $data)) { - $object->setPortOfUnloading($data['PortOfUnloading']); - unset($data['PortOfUnloading']); - } - if (\array_key_exists('LoadingPier', $data)) { - $object->setLoadingPier($data['LoadingPier']); - unset($data['LoadingPier']); - } - if (\array_key_exists('PartiesToTransaction', $data)) { - $object->setPartiesToTransaction($data['PartiesToTransaction']); - unset($data['PartiesToTransaction']); - } - if (\array_key_exists('RoutedExportTransactionIndicator', $data)) { - $object->setRoutedExportTransactionIndicator($data['RoutedExportTransactionIndicator']); - unset($data['RoutedExportTransactionIndicator']); - } - if (\array_key_exists('ContainerizedIndicator', $data)) { - $object->setContainerizedIndicator($data['ContainerizedIndicator']); - unset($data['ContainerizedIndicator']); - } - if (\array_key_exists('OverridePaperlessIndicator', $data)) { - $object->setOverridePaperlessIndicator($data['OverridePaperlessIndicator']); - unset($data['OverridePaperlessIndicator']); - } - if (\array_key_exists('ShipperMemo', $data)) { - $object->setShipperMemo($data['ShipperMemo']); - unset($data['ShipperMemo']); - } - if (\array_key_exists('HazardousMaterialsIndicator', $data)) { - $object->setHazardousMaterialsIndicator($data['HazardousMaterialsIndicator']); - unset($data['HazardousMaterialsIndicator']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('FormType', $data)) { $values = []; - foreach ($object->getFormType() as $value) { + foreach ($data['FormType'] as $value) { $values[] = $value; } - $data['FormType'] = $values; - if ($object->isInitialized('userCreatedForm') && null !== $object->getUserCreatedForm()) { - $data['UserCreatedForm'] = $this->normalizer->normalize($object->getUserCreatedForm(), 'json', $context); - } - if ($object->isInitialized('uPSPremiumCareForm') && null !== $object->getUPSPremiumCareForm()) { - $data['UPSPremiumCareForm'] = $this->normalizer->normalize($object->getUPSPremiumCareForm(), 'json', $context); - } - if ($object->isInitialized('cN22Form') && null !== $object->getCN22Form()) { - $data['CN22Form'] = $this->normalizer->normalize($object->getCN22Form(), 'json', $context); - } - if ($object->isInitialized('additionalDocumentIndicator') && null !== $object->getAdditionalDocumentIndicator()) { - $data['AdditionalDocumentIndicator'] = $object->getAdditionalDocumentIndicator(); - } - if ($object->isInitialized('formGroupIdName') && null !== $object->getFormGroupIdName()) { - $data['FormGroupIdName'] = $object->getFormGroupIdName(); - } - if ($object->isInitialized('eEIFilingOption') && null !== $object->getEEIFilingOption()) { - $data['EEIFilingOption'] = $this->normalizer->normalize($object->getEEIFilingOption(), 'json', $context); - } - if ($object->isInitialized('contacts') && null !== $object->getContacts()) { - $data['Contacts'] = $this->normalizer->normalize($object->getContacts(), 'json', $context); - } + $object->setFormType($values); + unset($data['FormType']); + } + if (\array_key_exists('UserCreatedForm', $data)) { + $object->setUserCreatedForm($this->denormalizer->denormalize($data['UserCreatedForm'], \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class, 'json', $context)); + unset($data['UserCreatedForm']); + } + if (\array_key_exists('UPSPremiumCareForm', $data)) { + $object->setUPSPremiumCareForm($this->denormalizer->denormalize($data['UPSPremiumCareForm'], \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class, 'json', $context)); + unset($data['UPSPremiumCareForm']); + } + if (\array_key_exists('CN22Form', $data)) { + $object->setCN22Form($this->denormalizer->denormalize($data['CN22Form'], \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class, 'json', $context)); + unset($data['CN22Form']); + } + if (\array_key_exists('AdditionalDocumentIndicator', $data)) { + $object->setAdditionalDocumentIndicator($data['AdditionalDocumentIndicator']); + unset($data['AdditionalDocumentIndicator']); + } + if (\array_key_exists('FormGroupIdName', $data)) { + $object->setFormGroupIdName($data['FormGroupIdName']); + unset($data['FormGroupIdName']); + } + if (\array_key_exists('EEIFilingOption', $data)) { + $object->setEEIFilingOption($this->denormalizer->denormalize($data['EEIFilingOption'], \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class, 'json', $context)); + unset($data['EEIFilingOption']); + } + if (\array_key_exists('Contacts', $data)) { + $object->setContacts($this->denormalizer->denormalize($data['Contacts'], \ShipStream\Ups\Api\Model\InternationalFormsContacts::class, 'json', $context)); + unset($data['Contacts']); + } + if (\array_key_exists('Product', $data) && $data['Product'] !== null) { $values_1 = []; - foreach ($object->getProduct() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Product'] = $values_1; - if ($object->isInitialized('invoiceNumber') && null !== $object->getInvoiceNumber()) { - $data['InvoiceNumber'] = $object->getInvoiceNumber(); - } - if ($object->isInitialized('invoiceDate') && null !== $object->getInvoiceDate()) { - $data['InvoiceDate'] = $object->getInvoiceDate(); - } - if ($object->isInitialized('purchaseOrderNumber') && null !== $object->getPurchaseOrderNumber()) { - $data['PurchaseOrderNumber'] = $object->getPurchaseOrderNumber(); - } - if ($object->isInitialized('termsOfShipment') && null !== $object->getTermsOfShipment()) { - $data['TermsOfShipment'] = $object->getTermsOfShipment(); - } - if ($object->isInitialized('reasonForExport') && null !== $object->getReasonForExport()) { - $data['ReasonForExport'] = $object->getReasonForExport(); - } - if ($object->isInitialized('comments') && null !== $object->getComments()) { - $data['Comments'] = $object->getComments(); - } - if ($object->isInitialized('declarationStatement') && null !== $object->getDeclarationStatement()) { - $data['DeclarationStatement'] = $object->getDeclarationStatement(); - } - if ($object->isInitialized('discount') && null !== $object->getDiscount()) { - $data['Discount'] = $this->normalizer->normalize($object->getDiscount(), 'json', $context); - } - if ($object->isInitialized('freightCharges') && null !== $object->getFreightCharges()) { - $data['FreightCharges'] = $this->normalizer->normalize($object->getFreightCharges(), 'json', $context); - } - if ($object->isInitialized('insuranceCharges') && null !== $object->getInsuranceCharges()) { - $data['InsuranceCharges'] = $this->normalizer->normalize($object->getInsuranceCharges(), 'json', $context); - } - if ($object->isInitialized('otherCharges') && null !== $object->getOtherCharges()) { - $data['OtherCharges'] = $this->normalizer->normalize($object->getOtherCharges(), 'json', $context); - } - if ($object->isInitialized('currencyCode') && null !== $object->getCurrencyCode()) { - $data['CurrencyCode'] = $object->getCurrencyCode(); - } - if ($object->isInitialized('blanketPeriod') && null !== $object->getBlanketPeriod()) { - $data['BlanketPeriod'] = $this->normalizer->normalize($object->getBlanketPeriod(), 'json', $context); - } - if ($object->isInitialized('exportDate') && null !== $object->getExportDate()) { - $data['ExportDate'] = $object->getExportDate(); - } - if ($object->isInitialized('exportingCarrier') && null !== $object->getExportingCarrier()) { - $data['ExportingCarrier'] = $object->getExportingCarrier(); - } - if ($object->isInitialized('carrierID') && null !== $object->getCarrierID()) { - $data['CarrierID'] = $object->getCarrierID(); - } - if ($object->isInitialized('inBondCode') && null !== $object->getInBondCode()) { - $data['InBondCode'] = $object->getInBondCode(); - } - if ($object->isInitialized('entryNumber') && null !== $object->getEntryNumber()) { - $data['EntryNumber'] = $object->getEntryNumber(); - } - if ($object->isInitialized('pointOfOrigin') && null !== $object->getPointOfOrigin()) { - $data['PointOfOrigin'] = $object->getPointOfOrigin(); - } - if ($object->isInitialized('pointOfOriginType') && null !== $object->getPointOfOriginType()) { - $data['PointOfOriginType'] = $object->getPointOfOriginType(); - } - if ($object->isInitialized('modeOfTransport') && null !== $object->getModeOfTransport()) { - $data['ModeOfTransport'] = $object->getModeOfTransport(); - } - if ($object->isInitialized('portOfExport') && null !== $object->getPortOfExport()) { - $data['PortOfExport'] = $object->getPortOfExport(); - } - if ($object->isInitialized('portOfUnloading') && null !== $object->getPortOfUnloading()) { - $data['PortOfUnloading'] = $object->getPortOfUnloading(); - } - if ($object->isInitialized('loadingPier') && null !== $object->getLoadingPier()) { - $data['LoadingPier'] = $object->getLoadingPier(); - } - if ($object->isInitialized('partiesToTransaction') && null !== $object->getPartiesToTransaction()) { - $data['PartiesToTransaction'] = $object->getPartiesToTransaction(); - } - if ($object->isInitialized('routedExportTransactionIndicator') && null !== $object->getRoutedExportTransactionIndicator()) { - $data['RoutedExportTransactionIndicator'] = $object->getRoutedExportTransactionIndicator(); - } - if ($object->isInitialized('containerizedIndicator') && null !== $object->getContainerizedIndicator()) { - $data['ContainerizedIndicator'] = $object->getContainerizedIndicator(); - } - if ($object->isInitialized('overridePaperlessIndicator') && null !== $object->getOverridePaperlessIndicator()) { - $data['OverridePaperlessIndicator'] = $object->getOverridePaperlessIndicator(); - } - if ($object->isInitialized('shipperMemo') && null !== $object->getShipperMemo()) { - $data['ShipperMemo'] = $object->getShipperMemo(); - } - if ($object->isInitialized('hazardousMaterialsIndicator') && null !== $object->getHazardousMaterialsIndicator()) { - $data['HazardousMaterialsIndicator'] = $object->getHazardousMaterialsIndicator(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + foreach ($data['Product'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\InternationalFormsProduct::class, 'json', $context); } - return $data; + $object->setProduct($values_1); + unset($data['Product']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class => false]; + elseif (\array_key_exists('Product', $data) && $data['Product'] === null) { + $object->setProduct(null); + } + if (\array_key_exists('InvoiceNumber', $data)) { + $object->setInvoiceNumber($data['InvoiceNumber']); + unset($data['InvoiceNumber']); + } + if (\array_key_exists('InvoiceDate', $data)) { + $object->setInvoiceDate($data['InvoiceDate']); + unset($data['InvoiceDate']); + } + if (\array_key_exists('PurchaseOrderNumber', $data)) { + $object->setPurchaseOrderNumber($data['PurchaseOrderNumber']); + unset($data['PurchaseOrderNumber']); + } + if (\array_key_exists('TermsOfShipment', $data)) { + $object->setTermsOfShipment($data['TermsOfShipment']); + unset($data['TermsOfShipment']); + } + if (\array_key_exists('ReasonForExport', $data)) { + $object->setReasonForExport($data['ReasonForExport']); + unset($data['ReasonForExport']); + } + if (\array_key_exists('Comments', $data)) { + $object->setComments($data['Comments']); + unset($data['Comments']); + } + if (\array_key_exists('DeclarationStatement', $data)) { + $object->setDeclarationStatement($data['DeclarationStatement']); + unset($data['DeclarationStatement']); + } + if (\array_key_exists('Discount', $data)) { + $object->setDiscount($this->denormalizer->denormalize($data['Discount'], \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class, 'json', $context)); + unset($data['Discount']); + } + if (\array_key_exists('FreightCharges', $data)) { + $object->setFreightCharges($this->denormalizer->denormalize($data['FreightCharges'], \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class, 'json', $context)); + unset($data['FreightCharges']); + } + if (\array_key_exists('InsuranceCharges', $data)) { + $object->setInsuranceCharges($this->denormalizer->denormalize($data['InsuranceCharges'], \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class, 'json', $context)); + unset($data['InsuranceCharges']); + } + if (\array_key_exists('OtherCharges', $data)) { + $object->setOtherCharges($this->denormalizer->denormalize($data['OtherCharges'], \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class, 'json', $context)); + unset($data['OtherCharges']); + } + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); + } + if (\array_key_exists('BlanketPeriod', $data)) { + $object->setBlanketPeriod($this->denormalizer->denormalize($data['BlanketPeriod'], \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class, 'json', $context)); + unset($data['BlanketPeriod']); + } + if (\array_key_exists('ExportDate', $data)) { + $object->setExportDate($data['ExportDate']); + unset($data['ExportDate']); + } + if (\array_key_exists('ExportingCarrier', $data)) { + $object->setExportingCarrier($data['ExportingCarrier']); + unset($data['ExportingCarrier']); + } + if (\array_key_exists('CarrierID', $data)) { + $object->setCarrierID($data['CarrierID']); + unset($data['CarrierID']); + } + if (\array_key_exists('InBondCode', $data)) { + $object->setInBondCode($data['InBondCode']); + unset($data['InBondCode']); + } + if (\array_key_exists('EntryNumber', $data)) { + $object->setEntryNumber($data['EntryNumber']); + unset($data['EntryNumber']); + } + if (\array_key_exists('PointOfOrigin', $data)) { + $object->setPointOfOrigin($data['PointOfOrigin']); + unset($data['PointOfOrigin']); + } + if (\array_key_exists('PointOfOriginType', $data)) { + $object->setPointOfOriginType($data['PointOfOriginType']); + unset($data['PointOfOriginType']); + } + if (\array_key_exists('ModeOfTransport', $data)) { + $object->setModeOfTransport($data['ModeOfTransport']); + unset($data['ModeOfTransport']); + } + if (\array_key_exists('PortOfExport', $data)) { + $object->setPortOfExport($data['PortOfExport']); + unset($data['PortOfExport']); + } + if (\array_key_exists('PortOfUnloading', $data)) { + $object->setPortOfUnloading($data['PortOfUnloading']); + unset($data['PortOfUnloading']); + } + if (\array_key_exists('LoadingPier', $data)) { + $object->setLoadingPier($data['LoadingPier']); + unset($data['LoadingPier']); + } + if (\array_key_exists('PartiesToTransaction', $data)) { + $object->setPartiesToTransaction($data['PartiesToTransaction']); + unset($data['PartiesToTransaction']); + } + if (\array_key_exists('RoutedExportTransactionIndicator', $data)) { + $object->setRoutedExportTransactionIndicator($data['RoutedExportTransactionIndicator']); + unset($data['RoutedExportTransactionIndicator']); + } + if (\array_key_exists('ContainerizedIndicator', $data)) { + $object->setContainerizedIndicator($data['ContainerizedIndicator']); + unset($data['ContainerizedIndicator']); + } + if (\array_key_exists('OverridePaperlessIndicator', $data)) { + $object->setOverridePaperlessIndicator($data['OverridePaperlessIndicator']); + unset($data['OverridePaperlessIndicator']); + } + if (\array_key_exists('ShipperMemo', $data)) { + $object->setShipperMemo($data['ShipperMemo']); + unset($data['ShipperMemo']); + } + if (\array_key_exists('HazardousMaterialsIndicator', $data)) { + $object->setHazardousMaterialsIndicator($data['HazardousMaterialsIndicator']); + unset($data['HazardousMaterialsIndicator']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } } + return $object; } -} else { - class ShipmentServiceOptionsInternationalFormsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FormType', $data)) { - $values = []; - foreach ($data['FormType'] as $value) { - $values[] = $value; - } - $object->setFormType($values); - unset($data['FormType']); - } - if (\array_key_exists('UserCreatedForm', $data)) { - $object->setUserCreatedForm($this->denormalizer->denormalize($data['UserCreatedForm'], \ShipStream\Ups\Api\Model\InternationalFormsUserCreatedForm::class, 'json', $context)); - unset($data['UserCreatedForm']); - } - if (\array_key_exists('UPSPremiumCareForm', $data)) { - $object->setUPSPremiumCareForm($this->denormalizer->denormalize($data['UPSPremiumCareForm'], \ShipStream\Ups\Api\Model\InternationalFormsUPSPremiumCareForm::class, 'json', $context)); - unset($data['UPSPremiumCareForm']); - } - if (\array_key_exists('CN22Form', $data)) { - $object->setCN22Form($this->denormalizer->denormalize($data['CN22Form'], \ShipStream\Ups\Api\Model\InternationalFormsCN22Form::class, 'json', $context)); - unset($data['CN22Form']); - } - if (\array_key_exists('AdditionalDocumentIndicator', $data)) { - $object->setAdditionalDocumentIndicator($data['AdditionalDocumentIndicator']); - unset($data['AdditionalDocumentIndicator']); - } - if (\array_key_exists('FormGroupIdName', $data)) { - $object->setFormGroupIdName($data['FormGroupIdName']); - unset($data['FormGroupIdName']); - } - if (\array_key_exists('EEIFilingOption', $data)) { - $object->setEEIFilingOption($this->denormalizer->denormalize($data['EEIFilingOption'], \ShipStream\Ups\Api\Model\InternationalFormsEEIFilingOption::class, 'json', $context)); - unset($data['EEIFilingOption']); - } - if (\array_key_exists('Contacts', $data)) { - $object->setContacts($this->denormalizer->denormalize($data['Contacts'], \ShipStream\Ups\Api\Model\InternationalFormsContacts::class, 'json', $context)); - unset($data['Contacts']); - } - if (\array_key_exists('Product', $data) && $data['Product'] !== null) { - $values_1 = []; - foreach ($data['Product'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\InternationalFormsProduct::class, 'json', $context); - } - $object->setProduct($values_1); - unset($data['Product']); - } - elseif (\array_key_exists('Product', $data) && $data['Product'] === null) { - $object->setProduct(null); - } - if (\array_key_exists('InvoiceNumber', $data)) { - $object->setInvoiceNumber($data['InvoiceNumber']); - unset($data['InvoiceNumber']); - } - if (\array_key_exists('InvoiceDate', $data)) { - $object->setInvoiceDate($data['InvoiceDate']); - unset($data['InvoiceDate']); - } - if (\array_key_exists('PurchaseOrderNumber', $data)) { - $object->setPurchaseOrderNumber($data['PurchaseOrderNumber']); - unset($data['PurchaseOrderNumber']); - } - if (\array_key_exists('TermsOfShipment', $data)) { - $object->setTermsOfShipment($data['TermsOfShipment']); - unset($data['TermsOfShipment']); - } - if (\array_key_exists('ReasonForExport', $data)) { - $object->setReasonForExport($data['ReasonForExport']); - unset($data['ReasonForExport']); - } - if (\array_key_exists('Comments', $data)) { - $object->setComments($data['Comments']); - unset($data['Comments']); - } - if (\array_key_exists('DeclarationStatement', $data)) { - $object->setDeclarationStatement($data['DeclarationStatement']); - unset($data['DeclarationStatement']); - } - if (\array_key_exists('Discount', $data)) { - $object->setDiscount($this->denormalizer->denormalize($data['Discount'], \ShipStream\Ups\Api\Model\InternationalFormsDiscount::class, 'json', $context)); - unset($data['Discount']); - } - if (\array_key_exists('FreightCharges', $data)) { - $object->setFreightCharges($this->denormalizer->denormalize($data['FreightCharges'], \ShipStream\Ups\Api\Model\InternationalFormsFreightCharges::class, 'json', $context)); - unset($data['FreightCharges']); - } - if (\array_key_exists('InsuranceCharges', $data)) { - $object->setInsuranceCharges($this->denormalizer->denormalize($data['InsuranceCharges'], \ShipStream\Ups\Api\Model\InternationalFormsInsuranceCharges::class, 'json', $context)); - unset($data['InsuranceCharges']); - } - if (\array_key_exists('OtherCharges', $data)) { - $object->setOtherCharges($this->denormalizer->denormalize($data['OtherCharges'], \ShipStream\Ups\Api\Model\InternationalFormsOtherCharges::class, 'json', $context)); - unset($data['OtherCharges']); - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('BlanketPeriod', $data)) { - $object->setBlanketPeriod($this->denormalizer->denormalize($data['BlanketPeriod'], \ShipStream\Ups\Api\Model\InternationalFormsBlanketPeriod::class, 'json', $context)); - unset($data['BlanketPeriod']); - } - if (\array_key_exists('ExportDate', $data)) { - $object->setExportDate($data['ExportDate']); - unset($data['ExportDate']); - } - if (\array_key_exists('ExportingCarrier', $data)) { - $object->setExportingCarrier($data['ExportingCarrier']); - unset($data['ExportingCarrier']); - } - if (\array_key_exists('CarrierID', $data)) { - $object->setCarrierID($data['CarrierID']); - unset($data['CarrierID']); - } - if (\array_key_exists('InBondCode', $data)) { - $object->setInBondCode($data['InBondCode']); - unset($data['InBondCode']); - } - if (\array_key_exists('EntryNumber', $data)) { - $object->setEntryNumber($data['EntryNumber']); - unset($data['EntryNumber']); - } - if (\array_key_exists('PointOfOrigin', $data)) { - $object->setPointOfOrigin($data['PointOfOrigin']); - unset($data['PointOfOrigin']); - } - if (\array_key_exists('PointOfOriginType', $data)) { - $object->setPointOfOriginType($data['PointOfOriginType']); - unset($data['PointOfOriginType']); - } - if (\array_key_exists('ModeOfTransport', $data)) { - $object->setModeOfTransport($data['ModeOfTransport']); - unset($data['ModeOfTransport']); - } - if (\array_key_exists('PortOfExport', $data)) { - $object->setPortOfExport($data['PortOfExport']); - unset($data['PortOfExport']); - } - if (\array_key_exists('PortOfUnloading', $data)) { - $object->setPortOfUnloading($data['PortOfUnloading']); - unset($data['PortOfUnloading']); - } - if (\array_key_exists('LoadingPier', $data)) { - $object->setLoadingPier($data['LoadingPier']); - unset($data['LoadingPier']); - } - if (\array_key_exists('PartiesToTransaction', $data)) { - $object->setPartiesToTransaction($data['PartiesToTransaction']); - unset($data['PartiesToTransaction']); - } - if (\array_key_exists('RoutedExportTransactionIndicator', $data)) { - $object->setRoutedExportTransactionIndicator($data['RoutedExportTransactionIndicator']); - unset($data['RoutedExportTransactionIndicator']); - } - if (\array_key_exists('ContainerizedIndicator', $data)) { - $object->setContainerizedIndicator($data['ContainerizedIndicator']); - unset($data['ContainerizedIndicator']); - } - if (\array_key_exists('OverridePaperlessIndicator', $data)) { - $object->setOverridePaperlessIndicator($data['OverridePaperlessIndicator']); - unset($data['OverridePaperlessIndicator']); - } - if (\array_key_exists('ShipperMemo', $data)) { - $object->setShipperMemo($data['ShipperMemo']); - unset($data['ShipperMemo']); - } - if (\array_key_exists('HazardousMaterialsIndicator', $data)) { - $object->setHazardousMaterialsIndicator($data['HazardousMaterialsIndicator']); - unset($data['HazardousMaterialsIndicator']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray = []; + $values = []; + foreach ($data->getFormType() as $value) { + $values[] = $value; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getFormType() as $value) { - $values[] = $value; - } - $data['FormType'] = $values; - if ($object->isInitialized('userCreatedForm') && null !== $object->getUserCreatedForm()) { - $data['UserCreatedForm'] = $this->normalizer->normalize($object->getUserCreatedForm(), 'json', $context); - } - if ($object->isInitialized('uPSPremiumCareForm') && null !== $object->getUPSPremiumCareForm()) { - $data['UPSPremiumCareForm'] = $this->normalizer->normalize($object->getUPSPremiumCareForm(), 'json', $context); - } - if ($object->isInitialized('cN22Form') && null !== $object->getCN22Form()) { - $data['CN22Form'] = $this->normalizer->normalize($object->getCN22Form(), 'json', $context); - } - if ($object->isInitialized('additionalDocumentIndicator') && null !== $object->getAdditionalDocumentIndicator()) { - $data['AdditionalDocumentIndicator'] = $object->getAdditionalDocumentIndicator(); - } - if ($object->isInitialized('formGroupIdName') && null !== $object->getFormGroupIdName()) { - $data['FormGroupIdName'] = $object->getFormGroupIdName(); - } - if ($object->isInitialized('eEIFilingOption') && null !== $object->getEEIFilingOption()) { - $data['EEIFilingOption'] = $this->normalizer->normalize($object->getEEIFilingOption(), 'json', $context); - } - if ($object->isInitialized('contacts') && null !== $object->getContacts()) { - $data['Contacts'] = $this->normalizer->normalize($object->getContacts(), 'json', $context); - } - $values_1 = []; - foreach ($object->getProduct() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Product'] = $values_1; - if ($object->isInitialized('invoiceNumber') && null !== $object->getInvoiceNumber()) { - $data['InvoiceNumber'] = $object->getInvoiceNumber(); - } - if ($object->isInitialized('invoiceDate') && null !== $object->getInvoiceDate()) { - $data['InvoiceDate'] = $object->getInvoiceDate(); - } - if ($object->isInitialized('purchaseOrderNumber') && null !== $object->getPurchaseOrderNumber()) { - $data['PurchaseOrderNumber'] = $object->getPurchaseOrderNumber(); - } - if ($object->isInitialized('termsOfShipment') && null !== $object->getTermsOfShipment()) { - $data['TermsOfShipment'] = $object->getTermsOfShipment(); - } - if ($object->isInitialized('reasonForExport') && null !== $object->getReasonForExport()) { - $data['ReasonForExport'] = $object->getReasonForExport(); - } - if ($object->isInitialized('comments') && null !== $object->getComments()) { - $data['Comments'] = $object->getComments(); - } - if ($object->isInitialized('declarationStatement') && null !== $object->getDeclarationStatement()) { - $data['DeclarationStatement'] = $object->getDeclarationStatement(); - } - if ($object->isInitialized('discount') && null !== $object->getDiscount()) { - $data['Discount'] = $this->normalizer->normalize($object->getDiscount(), 'json', $context); - } - if ($object->isInitialized('freightCharges') && null !== $object->getFreightCharges()) { - $data['FreightCharges'] = $this->normalizer->normalize($object->getFreightCharges(), 'json', $context); - } - if ($object->isInitialized('insuranceCharges') && null !== $object->getInsuranceCharges()) { - $data['InsuranceCharges'] = $this->normalizer->normalize($object->getInsuranceCharges(), 'json', $context); - } - if ($object->isInitialized('otherCharges') && null !== $object->getOtherCharges()) { - $data['OtherCharges'] = $this->normalizer->normalize($object->getOtherCharges(), 'json', $context); - } - if ($object->isInitialized('currencyCode') && null !== $object->getCurrencyCode()) { - $data['CurrencyCode'] = $object->getCurrencyCode(); - } - if ($object->isInitialized('blanketPeriod') && null !== $object->getBlanketPeriod()) { - $data['BlanketPeriod'] = $this->normalizer->normalize($object->getBlanketPeriod(), 'json', $context); - } - if ($object->isInitialized('exportDate') && null !== $object->getExportDate()) { - $data['ExportDate'] = $object->getExportDate(); - } - if ($object->isInitialized('exportingCarrier') && null !== $object->getExportingCarrier()) { - $data['ExportingCarrier'] = $object->getExportingCarrier(); - } - if ($object->isInitialized('carrierID') && null !== $object->getCarrierID()) { - $data['CarrierID'] = $object->getCarrierID(); - } - if ($object->isInitialized('inBondCode') && null !== $object->getInBondCode()) { - $data['InBondCode'] = $object->getInBondCode(); - } - if ($object->isInitialized('entryNumber') && null !== $object->getEntryNumber()) { - $data['EntryNumber'] = $object->getEntryNumber(); - } - if ($object->isInitialized('pointOfOrigin') && null !== $object->getPointOfOrigin()) { - $data['PointOfOrigin'] = $object->getPointOfOrigin(); - } - if ($object->isInitialized('pointOfOriginType') && null !== $object->getPointOfOriginType()) { - $data['PointOfOriginType'] = $object->getPointOfOriginType(); - } - if ($object->isInitialized('modeOfTransport') && null !== $object->getModeOfTransport()) { - $data['ModeOfTransport'] = $object->getModeOfTransport(); - } - if ($object->isInitialized('portOfExport') && null !== $object->getPortOfExport()) { - $data['PortOfExport'] = $object->getPortOfExport(); - } - if ($object->isInitialized('portOfUnloading') && null !== $object->getPortOfUnloading()) { - $data['PortOfUnloading'] = $object->getPortOfUnloading(); - } - if ($object->isInitialized('loadingPier') && null !== $object->getLoadingPier()) { - $data['LoadingPier'] = $object->getLoadingPier(); - } - if ($object->isInitialized('partiesToTransaction') && null !== $object->getPartiesToTransaction()) { - $data['PartiesToTransaction'] = $object->getPartiesToTransaction(); - } - if ($object->isInitialized('routedExportTransactionIndicator') && null !== $object->getRoutedExportTransactionIndicator()) { - $data['RoutedExportTransactionIndicator'] = $object->getRoutedExportTransactionIndicator(); - } - if ($object->isInitialized('containerizedIndicator') && null !== $object->getContainerizedIndicator()) { - $data['ContainerizedIndicator'] = $object->getContainerizedIndicator(); - } - if ($object->isInitialized('overridePaperlessIndicator') && null !== $object->getOverridePaperlessIndicator()) { - $data['OverridePaperlessIndicator'] = $object->getOverridePaperlessIndicator(); - } - if ($object->isInitialized('shipperMemo') && null !== $object->getShipperMemo()) { - $data['ShipperMemo'] = $object->getShipperMemo(); - } - if ($object->isInitialized('hazardousMaterialsIndicator') && null !== $object->getHazardousMaterialsIndicator()) { - $data['HazardousMaterialsIndicator'] = $object->getHazardousMaterialsIndicator(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; + $dataArray['FormType'] = $values; + if ($data->isInitialized('userCreatedForm') && null !== $data->getUserCreatedForm()) { + $dataArray['UserCreatedForm'] = $this->normalizer->normalize($data->getUserCreatedForm(), 'json', $context); + } + if ($data->isInitialized('uPSPremiumCareForm') && null !== $data->getUPSPremiumCareForm()) { + $dataArray['UPSPremiumCareForm'] = $this->normalizer->normalize($data->getUPSPremiumCareForm(), 'json', $context); + } + if ($data->isInitialized('cN22Form') && null !== $data->getCN22Form()) { + $dataArray['CN22Form'] = $this->normalizer->normalize($data->getCN22Form(), 'json', $context); + } + if ($data->isInitialized('additionalDocumentIndicator') && null !== $data->getAdditionalDocumentIndicator()) { + $dataArray['AdditionalDocumentIndicator'] = $data->getAdditionalDocumentIndicator(); + } + if ($data->isInitialized('formGroupIdName') && null !== $data->getFormGroupIdName()) { + $dataArray['FormGroupIdName'] = $data->getFormGroupIdName(); + } + if ($data->isInitialized('eEIFilingOption') && null !== $data->getEEIFilingOption()) { + $dataArray['EEIFilingOption'] = $this->normalizer->normalize($data->getEEIFilingOption(), 'json', $context); + } + if ($data->isInitialized('contacts') && null !== $data->getContacts()) { + $dataArray['Contacts'] = $this->normalizer->normalize($data->getContacts(), 'json', $context); + } + $values_1 = []; + foreach ($data->getProduct() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + } + $dataArray['Product'] = $values_1; + if ($data->isInitialized('invoiceNumber') && null !== $data->getInvoiceNumber()) { + $dataArray['InvoiceNumber'] = $data->getInvoiceNumber(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class => false]; + if ($data->isInitialized('invoiceDate') && null !== $data->getInvoiceDate()) { + $dataArray['InvoiceDate'] = $data->getInvoiceDate(); } + if ($data->isInitialized('purchaseOrderNumber') && null !== $data->getPurchaseOrderNumber()) { + $dataArray['PurchaseOrderNumber'] = $data->getPurchaseOrderNumber(); + } + if ($data->isInitialized('termsOfShipment') && null !== $data->getTermsOfShipment()) { + $dataArray['TermsOfShipment'] = $data->getTermsOfShipment(); + } + if ($data->isInitialized('reasonForExport') && null !== $data->getReasonForExport()) { + $dataArray['ReasonForExport'] = $data->getReasonForExport(); + } + if ($data->isInitialized('comments') && null !== $data->getComments()) { + $dataArray['Comments'] = $data->getComments(); + } + if ($data->isInitialized('declarationStatement') && null !== $data->getDeclarationStatement()) { + $dataArray['DeclarationStatement'] = $data->getDeclarationStatement(); + } + if ($data->isInitialized('discount') && null !== $data->getDiscount()) { + $dataArray['Discount'] = $this->normalizer->normalize($data->getDiscount(), 'json', $context); + } + if ($data->isInitialized('freightCharges') && null !== $data->getFreightCharges()) { + $dataArray['FreightCharges'] = $this->normalizer->normalize($data->getFreightCharges(), 'json', $context); + } + if ($data->isInitialized('insuranceCharges') && null !== $data->getInsuranceCharges()) { + $dataArray['InsuranceCharges'] = $this->normalizer->normalize($data->getInsuranceCharges(), 'json', $context); + } + if ($data->isInitialized('otherCharges') && null !== $data->getOtherCharges()) { + $dataArray['OtherCharges'] = $this->normalizer->normalize($data->getOtherCharges(), 'json', $context); + } + if ($data->isInitialized('currencyCode') && null !== $data->getCurrencyCode()) { + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + } + if ($data->isInitialized('blanketPeriod') && null !== $data->getBlanketPeriod()) { + $dataArray['BlanketPeriod'] = $this->normalizer->normalize($data->getBlanketPeriod(), 'json', $context); + } + if ($data->isInitialized('exportDate') && null !== $data->getExportDate()) { + $dataArray['ExportDate'] = $data->getExportDate(); + } + if ($data->isInitialized('exportingCarrier') && null !== $data->getExportingCarrier()) { + $dataArray['ExportingCarrier'] = $data->getExportingCarrier(); + } + if ($data->isInitialized('carrierID') && null !== $data->getCarrierID()) { + $dataArray['CarrierID'] = $data->getCarrierID(); + } + if ($data->isInitialized('inBondCode') && null !== $data->getInBondCode()) { + $dataArray['InBondCode'] = $data->getInBondCode(); + } + if ($data->isInitialized('entryNumber') && null !== $data->getEntryNumber()) { + $dataArray['EntryNumber'] = $data->getEntryNumber(); + } + if ($data->isInitialized('pointOfOrigin') && null !== $data->getPointOfOrigin()) { + $dataArray['PointOfOrigin'] = $data->getPointOfOrigin(); + } + if ($data->isInitialized('pointOfOriginType') && null !== $data->getPointOfOriginType()) { + $dataArray['PointOfOriginType'] = $data->getPointOfOriginType(); + } + if ($data->isInitialized('modeOfTransport') && null !== $data->getModeOfTransport()) { + $dataArray['ModeOfTransport'] = $data->getModeOfTransport(); + } + if ($data->isInitialized('portOfExport') && null !== $data->getPortOfExport()) { + $dataArray['PortOfExport'] = $data->getPortOfExport(); + } + if ($data->isInitialized('portOfUnloading') && null !== $data->getPortOfUnloading()) { + $dataArray['PortOfUnloading'] = $data->getPortOfUnloading(); + } + if ($data->isInitialized('loadingPier') && null !== $data->getLoadingPier()) { + $dataArray['LoadingPier'] = $data->getLoadingPier(); + } + if ($data->isInitialized('partiesToTransaction') && null !== $data->getPartiesToTransaction()) { + $dataArray['PartiesToTransaction'] = $data->getPartiesToTransaction(); + } + if ($data->isInitialized('routedExportTransactionIndicator') && null !== $data->getRoutedExportTransactionIndicator()) { + $dataArray['RoutedExportTransactionIndicator'] = $data->getRoutedExportTransactionIndicator(); + } + if ($data->isInitialized('containerizedIndicator') && null !== $data->getContainerizedIndicator()) { + $dataArray['ContainerizedIndicator'] = $data->getContainerizedIndicator(); + } + if ($data->isInitialized('overridePaperlessIndicator') && null !== $data->getOverridePaperlessIndicator()) { + $dataArray['OverridePaperlessIndicator'] = $data->getOverridePaperlessIndicator(); + } + if ($data->isInitialized('shipperMemo') && null !== $data->getShipperMemo()) { + $dataArray['ShipperMemo'] = $data->getShipperMemo(); + } + if ($data->isInitialized('hazardousMaterialsIndicator') && null !== $data->getHazardousMaterialsIndicator()) { + $dataArray['HazardousMaterialsIndicator'] = $data->getHazardousMaterialsIndicator(); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsLabelDeliveryNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsLabelDeliveryNormalizer.php index 0c823f97..bf30d95b 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsLabelDeliveryNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsLabelDeliveryNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsLabelDeliveryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsLabelDeliveryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMail', $data)) { - $object->setEMail($this->denormalizer->denormalize($data['EMail'], \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class, 'json', $context)); - unset($data['EMail']); - } - if (\array_key_exists('LabelLinksIndicator', $data)) { - $object->setLabelLinksIndicator($data['LabelLinksIndicator']); - unset($data['LabelLinksIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('eMail') && null !== $object->getEMail()) { - $data['EMail'] = $this->normalizer->normalize($object->getEMail(), 'json', $context); - } - if ($object->isInitialized('labelLinksIndicator') && null !== $object->getLabelLinksIndicator()) { - $data['LabelLinksIndicator'] = $object->getLabelLinksIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('EMail', $data)) { + $object->setEMail($this->denormalizer->denormalize($data['EMail'], \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class, 'json', $context)); + unset($data['EMail']); + } + if (\array_key_exists('LabelLinksIndicator', $data)) { + $object->setLabelLinksIndicator($data['LabelLinksIndicator']); + unset($data['LabelLinksIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentServiceOptionsLabelDeliveryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class; + $dataArray = []; + if ($data->isInitialized('eMail') && null !== $data->getEMail()) { + $dataArray['EMail'] = $this->normalizer->normalize($data->getEMail(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMail', $data)) { - $object->setEMail($this->denormalizer->denormalize($data['EMail'], \ShipStream\Ups\Api\Model\LabelDeliveryEMail::class, 'json', $context)); - unset($data['EMail']); - } - if (\array_key_exists('LabelLinksIndicator', $data)) { - $object->setLabelLinksIndicator($data['LabelLinksIndicator']); - unset($data['LabelLinksIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('labelLinksIndicator') && null !== $data->getLabelLinksIndicator()) { + $dataArray['LabelLinksIndicator'] = $data->getLabelLinksIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('eMail') && null !== $object->getEMail()) { - $data['EMail'] = $this->normalizer->normalize($object->getEMail(), 'json', $context); - } - if ($object->isInitialized('labelLinksIndicator') && null !== $object->getLabelLinksIndicator()) { - $data['LabelLinksIndicator'] = $object->getLabelLinksIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsLabelMethodNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsLabelMethodNormalizer.php index ef82f222..ab81291d 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsLabelMethodNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsLabelMethodNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsLabelMethodNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsLabelMethodNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentServiceOptionsLabelMethodNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsNotificationNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsNotificationNormalizer.php index fdf5cb7c..6b907785 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsNotificationNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsNotificationNormalizer.php @@ -5,178 +5,88 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('NotificationCode', $data)) { - $object->setNotificationCode($data['NotificationCode']); - unset($data['NotificationCode']); - } - if (\array_key_exists('EMail', $data)) { - $object->setEMail($this->denormalizer->denormalize($data['EMail'], \ShipStream\Ups\Api\Model\NotificationEMail::class, 'json', $context)); - unset($data['EMail']); - } - if (\array_key_exists('VoiceMessage', $data)) { - $object->setVoiceMessage($this->denormalizer->denormalize($data['VoiceMessage'], \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class, 'json', $context)); - unset($data['VoiceMessage']); - } - if (\array_key_exists('TextMessage', $data)) { - $object->setTextMessage($this->denormalizer->denormalize($data['TextMessage'], \ShipStream\Ups\Api\Model\NotificationTextMessage::class, 'json', $context)); - unset($data['TextMessage']); - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($this->denormalizer->denormalize($data['Locale'], \ShipStream\Ups\Api\Model\NotificationLocale::class, 'json', $context)); - unset($data['Locale']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['NotificationCode'] = $object->getNotificationCode(); - $data['EMail'] = $this->normalizer->normalize($object->getEMail(), 'json', $context); - if ($object->isInitialized('voiceMessage') && null !== $object->getVoiceMessage()) { - $data['VoiceMessage'] = $this->normalizer->normalize($object->getVoiceMessage(), 'json', $context); - } - if ($object->isInitialized('textMessage') && null !== $object->getTextMessage()) { - $data['TextMessage'] = $this->normalizer->normalize($object->getTextMessage(), 'json', $context); - } - if ($object->isInitialized('locale') && null !== $object->getLocale()) { - $data['Locale'] = $this->normalizer->normalize($object->getLocale(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('NotificationCode', $data)) { + $object->setNotificationCode($data['NotificationCode']); + unset($data['NotificationCode']); + } + if (\array_key_exists('EMail', $data)) { + $object->setEMail($this->denormalizer->denormalize($data['EMail'], \ShipStream\Ups\Api\Model\NotificationEMail::class, 'json', $context)); + unset($data['EMail']); + } + if (\array_key_exists('VoiceMessage', $data)) { + $object->setVoiceMessage($this->denormalizer->denormalize($data['VoiceMessage'], \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class, 'json', $context)); + unset($data['VoiceMessage']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class => false]; + if (\array_key_exists('TextMessage', $data)) { + $object->setTextMessage($this->denormalizer->denormalize($data['TextMessage'], \ShipStream\Ups\Api\Model\NotificationTextMessage::class, 'json', $context)); + unset($data['TextMessage']); } + if (\array_key_exists('Locale', $data)) { + $object->setLocale($this->denormalizer->denormalize($data['Locale'], \ShipStream\Ups\Api\Model\NotificationLocale::class, 'json', $context)); + unset($data['Locale']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentServiceOptionsNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class; + $dataArray = []; + $dataArray['NotificationCode'] = $data->getNotificationCode(); + $dataArray['EMail'] = $this->normalizer->normalize($data->getEMail(), 'json', $context); + if ($data->isInitialized('voiceMessage') && null !== $data->getVoiceMessage()) { + $dataArray['VoiceMessage'] = $this->normalizer->normalize($data->getVoiceMessage(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class; + if ($data->isInitialized('textMessage') && null !== $data->getTextMessage()) { + $dataArray['TextMessage'] = $this->normalizer->normalize($data->getTextMessage(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('NotificationCode', $data)) { - $object->setNotificationCode($data['NotificationCode']); - unset($data['NotificationCode']); - } - if (\array_key_exists('EMail', $data)) { - $object->setEMail($this->denormalizer->denormalize($data['EMail'], \ShipStream\Ups\Api\Model\NotificationEMail::class, 'json', $context)); - unset($data['EMail']); - } - if (\array_key_exists('VoiceMessage', $data)) { - $object->setVoiceMessage($this->denormalizer->denormalize($data['VoiceMessage'], \ShipStream\Ups\Api\Model\NotificationVoiceMessage::class, 'json', $context)); - unset($data['VoiceMessage']); - } - if (\array_key_exists('TextMessage', $data)) { - $object->setTextMessage($this->denormalizer->denormalize($data['TextMessage'], \ShipStream\Ups\Api\Model\NotificationTextMessage::class, 'json', $context)); - unset($data['TextMessage']); - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($this->denormalizer->denormalize($data['Locale'], \ShipStream\Ups\Api\Model\NotificationLocale::class, 'json', $context)); - unset($data['Locale']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('locale') && null !== $data->getLocale()) { + $dataArray['Locale'] = $this->normalizer->normalize($data->getLocale(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['NotificationCode'] = $object->getNotificationCode(); - $data['EMail'] = $this->normalizer->normalize($object->getEMail(), 'json', $context); - if ($object->isInitialized('voiceMessage') && null !== $object->getVoiceMessage()) { - $data['VoiceMessage'] = $this->normalizer->normalize($object->getVoiceMessage(), 'json', $context); - } - if ($object->isInitialized('textMessage') && null !== $object->getTextMessage()) { - $data['TextMessage'] = $this->normalizer->normalize($object->getTextMessage(), 'json', $context); - } - if ($object->isInitialized('locale') && null !== $object->getLocale()) { - $data['Locale'] = $this->normalizer->normalize($object->getLocale(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsOverSeasLegNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsOverSeasLegNormalizer.php index 02834487..197a24df 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsOverSeasLegNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsOverSeasLegNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsOverSeasLegNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsOverSeasLegNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($this->denormalizer->denormalize($data['Value'], \ShipStream\Ups\Api\Model\OverSeasLegValue::class, 'json', $context)); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - $data['Value'] = $this->normalizer->normalize($object->getValue(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class => false]; - } - } -} else { - class ShipmentServiceOptionsOverSeasLegNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class; + if (\array_key_exists('Dimensions', $data)) { + $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class, 'json', $context)); + unset($data['Dimensions']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class; + if (\array_key_exists('Value', $data)) { + $object->setValue($this->denormalizer->denormalize($data['Value'], \ShipStream\Ups\Api\Model\OverSeasLegValue::class, 'json', $context)); + unset($data['Value']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Dimensions', $data)) { - $object->setDimensions($this->denormalizer->denormalize($data['Dimensions'], \ShipStream\Ups\Api\Model\OverSeasLegDimensions::class, 'json', $context)); - unset($data['Dimensions']); - } - if (\array_key_exists('Value', $data)) { - $object->setValue($this->denormalizer->denormalize($data['Value'], \ShipStream\Ups\Api\Model\OverSeasLegValue::class, 'json', $context)); - unset($data['Value']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Dimensions'] = $this->normalizer->normalize($object->getDimensions(), 'json', $context); - $data['Value'] = $this->normalizer->normalize($object->getValue(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Dimensions'] = $this->normalizer->normalize($data->getDimensions(), 'json', $context); + $dataArray['Value'] = $this->normalizer->normalize($data->getValue(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsOverSeasLeg::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsPickupOptionsNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsPickupOptionsNormalizer.php index cb5baae9..df59b71f 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsPickupOptionsNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsPickupOptionsNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsPickupOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsPickupOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LiftGateAtPickupIndicator', $data)) { - $object->setLiftGateAtPickupIndicator($data['LiftGateAtPickupIndicator']); - unset($data['LiftGateAtPickupIndicator']); - } - if (\array_key_exists('HoldForPickupIndicator', $data)) { - $object->setHoldForPickupIndicator($data['HoldForPickupIndicator']); - unset($data['HoldForPickupIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('liftGateAtPickupIndicator') && null !== $object->getLiftGateAtPickupIndicator()) { - $data['LiftGateAtPickupIndicator'] = $object->getLiftGateAtPickupIndicator(); - } - if ($object->isInitialized('holdForPickupIndicator') && null !== $object->getHoldForPickupIndicator()) { - $data['HoldForPickupIndicator'] = $object->getHoldForPickupIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('LiftGateAtPickupIndicator', $data)) { + $object->setLiftGateAtPickupIndicator($data['LiftGateAtPickupIndicator']); + unset($data['LiftGateAtPickupIndicator']); + } + if (\array_key_exists('HoldForPickupIndicator', $data)) { + $object->setHoldForPickupIndicator($data['HoldForPickupIndicator']); + unset($data['HoldForPickupIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentServiceOptionsPickupOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class; + $dataArray = []; + if ($data->isInitialized('liftGateAtPickupIndicator') && null !== $data->getLiftGateAtPickupIndicator()) { + $dataArray['LiftGateAtPickupIndicator'] = $data->getLiftGateAtPickupIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('LiftGateAtPickupIndicator', $data)) { - $object->setLiftGateAtPickupIndicator($data['LiftGateAtPickupIndicator']); - unset($data['LiftGateAtPickupIndicator']); - } - if (\array_key_exists('HoldForPickupIndicator', $data)) { - $object->setHoldForPickupIndicator($data['HoldForPickupIndicator']); - unset($data['HoldForPickupIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('holdForPickupIndicator') && null !== $data->getHoldForPickupIndicator()) { + $dataArray['HoldForPickupIndicator'] = $data->getHoldForPickupIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('liftGateAtPickupIndicator') && null !== $object->getLiftGateAtPickupIndicator()) { - $data['LiftGateAtPickupIndicator'] = $object->getLiftGateAtPickupIndicator(); - } - if ($object->isInitialized('holdForPickupIndicator') && null !== $object->getHoldForPickupIndicator()) { - $data['HoldForPickupIndicator'] = $object->getHoldForPickupIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsPickupOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsPreAlertNotificationNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsPreAlertNotificationNormalizer.php index 1bb50ad6..96621828 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsPreAlertNotificationNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsPreAlertNotificationNormalizer.php @@ -5,168 +5,83 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsPreAlertNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsPreAlertNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailMessage', $data)) { - $object->setEMailMessage($this->denormalizer->denormalize($data['EMailMessage'], \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class, 'json', $context)); - unset($data['EMailMessage']); - } - if (\array_key_exists('VoiceMessage', $data)) { - $object->setVoiceMessage($this->denormalizer->denormalize($data['VoiceMessage'], \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class, 'json', $context)); - unset($data['VoiceMessage']); - } - if (\array_key_exists('TextMessage', $data)) { - $object->setTextMessage($this->denormalizer->denormalize($data['TextMessage'], \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class, 'json', $context)); - unset($data['TextMessage']); - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($this->denormalizer->denormalize($data['Locale'], \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class, 'json', $context)); - unset($data['Locale']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('eMailMessage') && null !== $object->getEMailMessage()) { - $data['EMailMessage'] = $this->normalizer->normalize($object->getEMailMessage(), 'json', $context); - } - if ($object->isInitialized('voiceMessage') && null !== $object->getVoiceMessage()) { - $data['VoiceMessage'] = $this->normalizer->normalize($object->getVoiceMessage(), 'json', $context); - } - if ($object->isInitialized('textMessage') && null !== $object->getTextMessage()) { - $data['TextMessage'] = $this->normalizer->normalize($object->getTextMessage(), 'json', $context); - } - $data['Locale'] = $this->normalizer->normalize($object->getLocale(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('EMailMessage', $data)) { + $object->setEMailMessage($this->denormalizer->denormalize($data['EMailMessage'], \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class, 'json', $context)); + unset($data['EMailMessage']); + } + if (\array_key_exists('VoiceMessage', $data)) { + $object->setVoiceMessage($this->denormalizer->denormalize($data['VoiceMessage'], \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class, 'json', $context)); + unset($data['VoiceMessage']); + } + if (\array_key_exists('TextMessage', $data)) { + $object->setTextMessage($this->denormalizer->denormalize($data['TextMessage'], \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class, 'json', $context)); + unset($data['TextMessage']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class => false]; + if (\array_key_exists('Locale', $data)) { + $object->setLocale($this->denormalizer->denormalize($data['Locale'], \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class, 'json', $context)); + unset($data['Locale']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentServiceOptionsPreAlertNotificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class; + $dataArray = []; + if ($data->isInitialized('eMailMessage') && null !== $data->getEMailMessage()) { + $dataArray['EMailMessage'] = $this->normalizer->normalize($data->getEMailMessage(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class; + if ($data->isInitialized('voiceMessage') && null !== $data->getVoiceMessage()) { + $dataArray['VoiceMessage'] = $this->normalizer->normalize($data->getVoiceMessage(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('EMailMessage', $data)) { - $object->setEMailMessage($this->denormalizer->denormalize($data['EMailMessage'], \ShipStream\Ups\Api\Model\PreAlertNotificationEMailMessage::class, 'json', $context)); - unset($data['EMailMessage']); - } - if (\array_key_exists('VoiceMessage', $data)) { - $object->setVoiceMessage($this->denormalizer->denormalize($data['VoiceMessage'], \ShipStream\Ups\Api\Model\PreAlertNotificationVoiceMessage::class, 'json', $context)); - unset($data['VoiceMessage']); - } - if (\array_key_exists('TextMessage', $data)) { - $object->setTextMessage($this->denormalizer->denormalize($data['TextMessage'], \ShipStream\Ups\Api\Model\PreAlertNotificationTextMessage::class, 'json', $context)); - unset($data['TextMessage']); - } - if (\array_key_exists('Locale', $data)) { - $object->setLocale($this->denormalizer->denormalize($data['Locale'], \ShipStream\Ups\Api\Model\PreAlertNotificationLocale::class, 'json', $context)); - unset($data['Locale']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('textMessage') && null !== $data->getTextMessage()) { + $dataArray['TextMessage'] = $this->normalizer->normalize($data->getTextMessage(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('eMailMessage') && null !== $object->getEMailMessage()) { - $data['EMailMessage'] = $this->normalizer->normalize($object->getEMailMessage(), 'json', $context); - } - if ($object->isInitialized('voiceMessage') && null !== $object->getVoiceMessage()) { - $data['VoiceMessage'] = $this->normalizer->normalize($object->getVoiceMessage(), 'json', $context); - } - if ($object->isInitialized('textMessage') && null !== $object->getTextMessage()) { - $data['TextMessage'] = $this->normalizer->normalize($object->getTextMessage(), 'json', $context); + $dataArray['Locale'] = $this->normalizer->normalize($data->getLocale(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - $data['Locale'] = $this->normalizer->normalize($object->getLocale(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsRestrictedArticlesNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsRestrictedArticlesNormalizer.php index c90c27a3..0e24ac37 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsRestrictedArticlesNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsRestrictedArticlesNormalizer.php @@ -5,214 +5,106 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsRestrictedArticlesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsRestrictedArticlesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DiagnosticSpecimensIndicator', $data)) { - $object->setDiagnosticSpecimensIndicator($data['DiagnosticSpecimensIndicator']); - unset($data['DiagnosticSpecimensIndicator']); - } - if (\array_key_exists('AlcoholicBeveragesIndicator', $data)) { - $object->setAlcoholicBeveragesIndicator($data['AlcoholicBeveragesIndicator']); - unset($data['AlcoholicBeveragesIndicator']); - } - if (\array_key_exists('PerishablesIndicator', $data)) { - $object->setPerishablesIndicator($data['PerishablesIndicator']); - unset($data['PerishablesIndicator']); - } - if (\array_key_exists('PlantsIndicator', $data)) { - $object->setPlantsIndicator($data['PlantsIndicator']); - unset($data['PlantsIndicator']); - } - if (\array_key_exists('SeedsIndicator', $data)) { - $object->setSeedsIndicator($data['SeedsIndicator']); - unset($data['SeedsIndicator']); - } - if (\array_key_exists('SpecialExceptionsIndicator', $data)) { - $object->setSpecialExceptionsIndicator($data['SpecialExceptionsIndicator']); - unset($data['SpecialExceptionsIndicator']); - } - if (\array_key_exists('TobaccoIndicator', $data)) { - $object->setTobaccoIndicator($data['TobaccoIndicator']); - unset($data['TobaccoIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('diagnosticSpecimensIndicator') && null !== $object->getDiagnosticSpecimensIndicator()) { - $data['DiagnosticSpecimensIndicator'] = $object->getDiagnosticSpecimensIndicator(); - } - if ($object->isInitialized('alcoholicBeveragesIndicator') && null !== $object->getAlcoholicBeveragesIndicator()) { - $data['AlcoholicBeveragesIndicator'] = $object->getAlcoholicBeveragesIndicator(); - } - if ($object->isInitialized('perishablesIndicator') && null !== $object->getPerishablesIndicator()) { - $data['PerishablesIndicator'] = $object->getPerishablesIndicator(); - } - if ($object->isInitialized('plantsIndicator') && null !== $object->getPlantsIndicator()) { - $data['PlantsIndicator'] = $object->getPlantsIndicator(); - } - if ($object->isInitialized('seedsIndicator') && null !== $object->getSeedsIndicator()) { - $data['SeedsIndicator'] = $object->getSeedsIndicator(); - } - if ($object->isInitialized('specialExceptionsIndicator') && null !== $object->getSpecialExceptionsIndicator()) { - $data['SpecialExceptionsIndicator'] = $object->getSpecialExceptionsIndicator(); - } - if ($object->isInitialized('tobaccoIndicator') && null !== $object->getTobaccoIndicator()) { - $data['TobaccoIndicator'] = $object->getTobaccoIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('DiagnosticSpecimensIndicator', $data)) { + $object->setDiagnosticSpecimensIndicator($data['DiagnosticSpecimensIndicator']); + unset($data['DiagnosticSpecimensIndicator']); + } + if (\array_key_exists('AlcoholicBeveragesIndicator', $data)) { + $object->setAlcoholicBeveragesIndicator($data['AlcoholicBeveragesIndicator']); + unset($data['AlcoholicBeveragesIndicator']); + } + if (\array_key_exists('PerishablesIndicator', $data)) { + $object->setPerishablesIndicator($data['PerishablesIndicator']); + unset($data['PerishablesIndicator']); + } + if (\array_key_exists('PlantsIndicator', $data)) { + $object->setPlantsIndicator($data['PlantsIndicator']); + unset($data['PlantsIndicator']); + } + if (\array_key_exists('SeedsIndicator', $data)) { + $object->setSeedsIndicator($data['SeedsIndicator']); + unset($data['SeedsIndicator']); + } + if (\array_key_exists('SpecialExceptionsIndicator', $data)) { + $object->setSpecialExceptionsIndicator($data['SpecialExceptionsIndicator']); + unset($data['SpecialExceptionsIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class => false]; + if (\array_key_exists('TobaccoIndicator', $data)) { + $object->setTobaccoIndicator($data['TobaccoIndicator']); + unset($data['TobaccoIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentServiceOptionsRestrictedArticlesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DiagnosticSpecimensIndicator', $data)) { - $object->setDiagnosticSpecimensIndicator($data['DiagnosticSpecimensIndicator']); - unset($data['DiagnosticSpecimensIndicator']); - } - if (\array_key_exists('AlcoholicBeveragesIndicator', $data)) { - $object->setAlcoholicBeveragesIndicator($data['AlcoholicBeveragesIndicator']); - unset($data['AlcoholicBeveragesIndicator']); - } - if (\array_key_exists('PerishablesIndicator', $data)) { - $object->setPerishablesIndicator($data['PerishablesIndicator']); - unset($data['PerishablesIndicator']); - } - if (\array_key_exists('PlantsIndicator', $data)) { - $object->setPlantsIndicator($data['PlantsIndicator']); - unset($data['PlantsIndicator']); - } - if (\array_key_exists('SeedsIndicator', $data)) { - $object->setSeedsIndicator($data['SeedsIndicator']); - unset($data['SeedsIndicator']); - } - if (\array_key_exists('SpecialExceptionsIndicator', $data)) { - $object->setSpecialExceptionsIndicator($data['SpecialExceptionsIndicator']); - unset($data['SpecialExceptionsIndicator']); - } - if (\array_key_exists('TobaccoIndicator', $data)) { - $object->setTobaccoIndicator($data['TobaccoIndicator']); - unset($data['TobaccoIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('diagnosticSpecimensIndicator') && null !== $data->getDiagnosticSpecimensIndicator()) { + $dataArray['DiagnosticSpecimensIndicator'] = $data->getDiagnosticSpecimensIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('diagnosticSpecimensIndicator') && null !== $object->getDiagnosticSpecimensIndicator()) { - $data['DiagnosticSpecimensIndicator'] = $object->getDiagnosticSpecimensIndicator(); - } - if ($object->isInitialized('alcoholicBeveragesIndicator') && null !== $object->getAlcoholicBeveragesIndicator()) { - $data['AlcoholicBeveragesIndicator'] = $object->getAlcoholicBeveragesIndicator(); - } - if ($object->isInitialized('perishablesIndicator') && null !== $object->getPerishablesIndicator()) { - $data['PerishablesIndicator'] = $object->getPerishablesIndicator(); - } - if ($object->isInitialized('plantsIndicator') && null !== $object->getPlantsIndicator()) { - $data['PlantsIndicator'] = $object->getPlantsIndicator(); - } - if ($object->isInitialized('seedsIndicator') && null !== $object->getSeedsIndicator()) { - $data['SeedsIndicator'] = $object->getSeedsIndicator(); - } - if ($object->isInitialized('specialExceptionsIndicator') && null !== $object->getSpecialExceptionsIndicator()) { - $data['SpecialExceptionsIndicator'] = $object->getSpecialExceptionsIndicator(); - } - if ($object->isInitialized('tobaccoIndicator') && null !== $object->getTobaccoIndicator()) { - $data['TobaccoIndicator'] = $object->getTobaccoIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('alcoholicBeveragesIndicator') && null !== $data->getAlcoholicBeveragesIndicator()) { + $dataArray['AlcoholicBeveragesIndicator'] = $data->getAlcoholicBeveragesIndicator(); + } + if ($data->isInitialized('perishablesIndicator') && null !== $data->getPerishablesIndicator()) { + $dataArray['PerishablesIndicator'] = $data->getPerishablesIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class => false]; + if ($data->isInitialized('plantsIndicator') && null !== $data->getPlantsIndicator()) { + $dataArray['PlantsIndicator'] = $data->getPlantsIndicator(); } + if ($data->isInitialized('seedsIndicator') && null !== $data->getSeedsIndicator()) { + $dataArray['SeedsIndicator'] = $data->getSeedsIndicator(); + } + if ($data->isInitialized('specialExceptionsIndicator') && null !== $data->getSpecialExceptionsIndicator()) { + $dataArray['SpecialExceptionsIndicator'] = $data->getSpecialExceptionsIndicator(); + } + if ($data->isInitialized('tobaccoIndicator') && null !== $data->getTobaccoIndicator()) { + $dataArray['TobaccoIndicator'] = $data->getTobaccoIndicator(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsReturnServiceNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsReturnServiceNormalizer.php index eca6af08..e54e63c4 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsReturnServiceNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsReturnServiceNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsReturnServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsReturnServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentServiceOptionsReturnServiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsReturnService::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentServiceOptionsSortingAndSegregatingNormalizer.php b/src/Api/Normalizer/ShipmentServiceOptionsSortingAndSegregatingNormalizer.php index a766829e..c244d93e 100644 --- a/src/Api/Normalizer/ShipmentServiceOptionsSortingAndSegregatingNormalizer.php +++ b/src/Api/Normalizer/ShipmentServiceOptionsSortingAndSegregatingNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentServiceOptionsSortingAndSegregatingNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentServiceOptionsSortingAndSegregatingNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Quantity', $data)) { + $object->setQuantity($data['Quantity']); + unset($data['Quantity']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentServiceOptionsSortingAndSegregatingNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Quantity'] = $data->getQuantity(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Quantity', $data)) { - $object->setQuantity($data['Quantity']); - unset($data['Quantity']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Quantity'] = $object->getQuantity(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentServiceOptionsSortingAndSegregating::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentShipFromNormalizer.php b/src/Api/Normalizer/ShipmentShipFromNormalizer.php index b8494a9c..36ca5e43 100644 --- a/src/Api/Normalizer/ShipmentShipFromNormalizer.php +++ b/src/Api/Normalizer/ShipmentShipFromNormalizer.php @@ -5,234 +5,116 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipFrom::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipFrom::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipFrom(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('CompanyDisplayableName', $data)) { - $object->setCompanyDisplayableName($data['CompanyDisplayableName']); - unset($data['CompanyDisplayableName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('TaxIDType', $data)) { - $object->setTaxIDType($this->denormalizer->denormalize($data['TaxIDType'], \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class, 'json', $context)); - unset($data['TaxIDType']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipFromPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipFromAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('VendorInfo', $data)) { - $object->setVendorInfo($this->denormalizer->denormalize($data['VendorInfo'], \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class, 'json', $context)); - unset($data['VendorInfo']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ShipmentShipFrom::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipFrom::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ShipmentShipFrom(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('companyDisplayableName') && null !== $object->getCompanyDisplayableName()) { - $data['CompanyDisplayableName'] = $object->getCompanyDisplayableName(); - } - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('taxIDType') && null !== $object->getTaxIDType()) { - $data['TaxIDType'] = $this->normalizer->normalize($object->getTaxIDType(), 'json', $context); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('vendorInfo') && null !== $object->getVendorInfo()) { - $data['VendorInfo'] = $this->normalizer->normalize($object->getVendorInfo(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('CompanyDisplayableName', $data)) { + $object->setCompanyDisplayableName($data['CompanyDisplayableName']); + unset($data['CompanyDisplayableName']); + } + if (\array_key_exists('TaxIdentificationNumber', $data)) { + $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); + unset($data['TaxIdentificationNumber']); + } + if (\array_key_exists('TaxIDType', $data)) { + $object->setTaxIDType($this->denormalizer->denormalize($data['TaxIDType'], \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class, 'json', $context)); + unset($data['TaxIDType']); + } + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipFromPhone::class, 'json', $context)); + unset($data['Phone']); + } + if (\array_key_exists('FaxNumber', $data)) { + $object->setFaxNumber($data['FaxNumber']); + unset($data['FaxNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipFrom::class => false]; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipFromAddress::class, 'json', $context)); + unset($data['Address']); } + if (\array_key_exists('VendorInfo', $data)) { + $object->setVendorInfo($this->denormalizer->denormalize($data['VendorInfo'], \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class, 'json', $context)); + unset($data['VendorInfo']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentShipFromNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipFrom::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipFrom::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipFrom(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('CompanyDisplayableName', $data)) { - $object->setCompanyDisplayableName($data['CompanyDisplayableName']); - unset($data['CompanyDisplayableName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('TaxIDType', $data)) { - $object->setTaxIDType($this->denormalizer->denormalize($data['TaxIDType'], \ShipStream\Ups\Api\Model\ShipFromTaxIDType::class, 'json', $context)); - unset($data['TaxIDType']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipFromPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipFromAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('VendorInfo', $data)) { - $object->setVendorInfo($this->denormalizer->denormalize($data['VendorInfo'], \ShipStream\Ups\Api\Model\ShipFromVendorInfo::class, 'json', $context)); - unset($data['VendorInfo']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Name'] = $data->getName(); + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('companyDisplayableName') && null !== $object->getCompanyDisplayableName()) { - $data['CompanyDisplayableName'] = $object->getCompanyDisplayableName(); - } - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('taxIDType') && null !== $object->getTaxIDType()) { - $data['TaxIDType'] = $this->normalizer->normalize($object->getTaxIDType(), 'json', $context); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('vendorInfo') && null !== $object->getVendorInfo()) { - $data['VendorInfo'] = $this->normalizer->normalize($object->getVendorInfo(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('companyDisplayableName') && null !== $data->getCompanyDisplayableName()) { + $dataArray['CompanyDisplayableName'] = $data->getCompanyDisplayableName(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipFrom::class => false]; + if ($data->isInitialized('taxIdentificationNumber') && null !== $data->getTaxIdentificationNumber()) { + $dataArray['TaxIdentificationNumber'] = $data->getTaxIdentificationNumber(); } + if ($data->isInitialized('taxIDType') && null !== $data->getTaxIDType()) { + $dataArray['TaxIDType'] = $this->normalizer->normalize($data->getTaxIDType(), 'json', $context); + } + if ($data->isInitialized('phone') && null !== $data->getPhone()) { + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); + } + if ($data->isInitialized('faxNumber') && null !== $data->getFaxNumber()) { + $dataArray['FaxNumber'] = $data->getFaxNumber(); + } + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + if ($data->isInitialized('vendorInfo') && null !== $data->getVendorInfo()) { + $dataArray['VendorInfo'] = $this->normalizer->normalize($data->getVendorInfo(), 'json', $context); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentShipFrom::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentShipToNormalizer.php b/src/Api/Normalizer/ShipmentShipToNormalizer.php index 2f5c60fa..630cccfe 100644 --- a/src/Api/Normalizer/ShipmentShipToNormalizer.php +++ b/src/Api/Normalizer/ShipmentShipToNormalizer.php @@ -5,234 +5,116 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipTo::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipTo::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('CompanyDisplayableName', $data)) { - $object->setCompanyDisplayableName($data['CompanyDisplayableName']); - unset($data['CompanyDisplayableName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipToPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('LocationID', $data)) { - $object->setLocationID($data['LocationID']); - unset($data['LocationID']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ShipmentShipTo::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipTo::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ShipmentShipTo(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('companyDisplayableName') && null !== $object->getCompanyDisplayableName()) { - $data['CompanyDisplayableName'] = $object->getCompanyDisplayableName(); - } - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('locationID') && null !== $object->getLocationID()) { - $data['LocationID'] = $object->getLocationID(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('CompanyDisplayableName', $data)) { + $object->setCompanyDisplayableName($data['CompanyDisplayableName']); + unset($data['CompanyDisplayableName']); + } + if (\array_key_exists('TaxIdentificationNumber', $data)) { + $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); + unset($data['TaxIdentificationNumber']); + } + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipToPhone::class, 'json', $context)); + unset($data['Phone']); + } + if (\array_key_exists('FaxNumber', $data)) { + $object->setFaxNumber($data['FaxNumber']); + unset($data['FaxNumber']); + } + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipTo::class => false]; + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipToAddress::class, 'json', $context)); + unset($data['Address']); } + if (\array_key_exists('LocationID', $data)) { + $object->setLocationID($data['LocationID']); + unset($data['LocationID']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentShipToNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipTo::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipTo::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipTo(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('CompanyDisplayableName', $data)) { - $object->setCompanyDisplayableName($data['CompanyDisplayableName']); - unset($data['CompanyDisplayableName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipToPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipToAddress::class, 'json', $context)); - unset($data['Address']); - } - if (\array_key_exists('LocationID', $data)) { - $object->setLocationID($data['LocationID']); - unset($data['LocationID']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Name'] = $data->getName(); + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('companyDisplayableName') && null !== $object->getCompanyDisplayableName()) { - $data['CompanyDisplayableName'] = $object->getCompanyDisplayableName(); - } - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - if ($object->isInitialized('locationID') && null !== $object->getLocationID()) { - $data['LocationID'] = $object->getLocationID(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('companyDisplayableName') && null !== $data->getCompanyDisplayableName()) { + $dataArray['CompanyDisplayableName'] = $data->getCompanyDisplayableName(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipTo::class => false]; + if ($data->isInitialized('taxIdentificationNumber') && null !== $data->getTaxIdentificationNumber()) { + $dataArray['TaxIdentificationNumber'] = $data->getTaxIdentificationNumber(); } + if ($data->isInitialized('phone') && null !== $data->getPhone()) { + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); + } + if ($data->isInitialized('faxNumber') && null !== $data->getFaxNumber()) { + $dataArray['FaxNumber'] = $data->getFaxNumber(); + } + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); + } + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + if ($data->isInitialized('locationID') && null !== $data->getLocationID()) { + $dataArray['LocationID'] = $data->getLocationID(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentShipTo::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentShipmentIndicationTypeNormalizer.php b/src/Api/Normalizer/ShipmentShipmentIndicationTypeNormalizer.php index 593992dc..cab69ff0 100644 --- a/src/Api/Normalizer/ShipmentShipmentIndicationTypeNormalizer.php +++ b/src/Api/Normalizer/ShipmentShipmentIndicationTypeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentShipmentIndicationTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentShipmentIndicationTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipmentShipmentIndicationTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentShipmentIndicationType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentShipmentRatingOptionsNormalizer.php b/src/Api/Normalizer/ShipmentShipmentRatingOptionsNormalizer.php index 54b07010..494850a1 100644 --- a/src/Api/Normalizer/ShipmentShipmentRatingOptionsNormalizer.php +++ b/src/Api/Normalizer/ShipmentShipmentRatingOptionsNormalizer.php @@ -5,186 +5,92 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentShipmentRatingOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentShipmentRatingOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('NegotiatedRatesIndicator', $data)) { - $object->setNegotiatedRatesIndicator($data['NegotiatedRatesIndicator']); - unset($data['NegotiatedRatesIndicator']); - } - if (\array_key_exists('FRSShipmentIndicator', $data)) { - $object->setFRSShipmentIndicator($data['FRSShipmentIndicator']); - unset($data['FRSShipmentIndicator']); - } - if (\array_key_exists('RateChartIndicator', $data)) { - $object->setRateChartIndicator($data['RateChartIndicator']); - unset($data['RateChartIndicator']); - } - if (\array_key_exists('TPFCNegotiatedRatesIndicator', $data)) { - $object->setTPFCNegotiatedRatesIndicator($data['TPFCNegotiatedRatesIndicator']); - unset($data['TPFCNegotiatedRatesIndicator']); - } - if (\array_key_exists('UserLevelDiscountIndicator', $data)) { - $object->setUserLevelDiscountIndicator($data['UserLevelDiscountIndicator']); - unset($data['UserLevelDiscountIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('negotiatedRatesIndicator') && null !== $object->getNegotiatedRatesIndicator()) { - $data['NegotiatedRatesIndicator'] = $object->getNegotiatedRatesIndicator(); - } - if ($object->isInitialized('fRSShipmentIndicator') && null !== $object->getFRSShipmentIndicator()) { - $data['FRSShipmentIndicator'] = $object->getFRSShipmentIndicator(); - } - if ($object->isInitialized('rateChartIndicator') && null !== $object->getRateChartIndicator()) { - $data['RateChartIndicator'] = $object->getRateChartIndicator(); - } - if ($object->isInitialized('tPFCNegotiatedRatesIndicator') && null !== $object->getTPFCNegotiatedRatesIndicator()) { - $data['TPFCNegotiatedRatesIndicator'] = $object->getTPFCNegotiatedRatesIndicator(); - } - if ($object->isInitialized('userLevelDiscountIndicator') && null !== $object->getUserLevelDiscountIndicator()) { - $data['UserLevelDiscountIndicator'] = $object->getUserLevelDiscountIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('NegotiatedRatesIndicator', $data)) { + $object->setNegotiatedRatesIndicator($data['NegotiatedRatesIndicator']); + unset($data['NegotiatedRatesIndicator']); + } + if (\array_key_exists('FRSShipmentIndicator', $data)) { + $object->setFRSShipmentIndicator($data['FRSShipmentIndicator']); + unset($data['FRSShipmentIndicator']); + } + if (\array_key_exists('RateChartIndicator', $data)) { + $object->setRateChartIndicator($data['RateChartIndicator']); + unset($data['RateChartIndicator']); + } + if (\array_key_exists('TPFCNegotiatedRatesIndicator', $data)) { + $object->setTPFCNegotiatedRatesIndicator($data['TPFCNegotiatedRatesIndicator']); + unset($data['TPFCNegotiatedRatesIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class => false]; + if (\array_key_exists('UserLevelDiscountIndicator', $data)) { + $object->setUserLevelDiscountIndicator($data['UserLevelDiscountIndicator']); + unset($data['UserLevelDiscountIndicator']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentShipmentRatingOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class; + $dataArray = []; + if ($data->isInitialized('negotiatedRatesIndicator') && null !== $data->getNegotiatedRatesIndicator()) { + $dataArray['NegotiatedRatesIndicator'] = $data->getNegotiatedRatesIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class; + if ($data->isInitialized('fRSShipmentIndicator') && null !== $data->getFRSShipmentIndicator()) { + $dataArray['FRSShipmentIndicator'] = $data->getFRSShipmentIndicator(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('NegotiatedRatesIndicator', $data)) { - $object->setNegotiatedRatesIndicator($data['NegotiatedRatesIndicator']); - unset($data['NegotiatedRatesIndicator']); - } - if (\array_key_exists('FRSShipmentIndicator', $data)) { - $object->setFRSShipmentIndicator($data['FRSShipmentIndicator']); - unset($data['FRSShipmentIndicator']); - } - if (\array_key_exists('RateChartIndicator', $data)) { - $object->setRateChartIndicator($data['RateChartIndicator']); - unset($data['RateChartIndicator']); - } - if (\array_key_exists('TPFCNegotiatedRatesIndicator', $data)) { - $object->setTPFCNegotiatedRatesIndicator($data['TPFCNegotiatedRatesIndicator']); - unset($data['TPFCNegotiatedRatesIndicator']); - } - if (\array_key_exists('UserLevelDiscountIndicator', $data)) { - $object->setUserLevelDiscountIndicator($data['UserLevelDiscountIndicator']); - unset($data['UserLevelDiscountIndicator']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('rateChartIndicator') && null !== $data->getRateChartIndicator()) { + $dataArray['RateChartIndicator'] = $data->getRateChartIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('negotiatedRatesIndicator') && null !== $object->getNegotiatedRatesIndicator()) { - $data['NegotiatedRatesIndicator'] = $object->getNegotiatedRatesIndicator(); - } - if ($object->isInitialized('fRSShipmentIndicator') && null !== $object->getFRSShipmentIndicator()) { - $data['FRSShipmentIndicator'] = $object->getFRSShipmentIndicator(); - } - if ($object->isInitialized('rateChartIndicator') && null !== $object->getRateChartIndicator()) { - $data['RateChartIndicator'] = $object->getRateChartIndicator(); - } - if ($object->isInitialized('tPFCNegotiatedRatesIndicator') && null !== $object->getTPFCNegotiatedRatesIndicator()) { - $data['TPFCNegotiatedRatesIndicator'] = $object->getTPFCNegotiatedRatesIndicator(); - } - if ($object->isInitialized('userLevelDiscountIndicator') && null !== $object->getUserLevelDiscountIndicator()) { - $data['UserLevelDiscountIndicator'] = $object->getUserLevelDiscountIndicator(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('tPFCNegotiatedRatesIndicator') && null !== $data->getTPFCNegotiatedRatesIndicator()) { + $dataArray['TPFCNegotiatedRatesIndicator'] = $data->getTPFCNegotiatedRatesIndicator(); + } + if ($data->isInitialized('userLevelDiscountIndicator') && null !== $data->getUserLevelDiscountIndicator()) { + $dataArray['UserLevelDiscountIndicator'] = $data->getUserLevelDiscountIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentShipmentRatingOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentShipmentServiceOptionsNormalizer.php b/src/Api/Normalizer/ShipmentShipmentServiceOptionsNormalizer.php index cb0c0084..fcbdd88a 100644 --- a/src/Api/Normalizer/ShipmentShipmentServiceOptionsNormalizer.php +++ b/src/Api/Normalizer/ShipmentShipmentServiceOptionsNormalizer.php @@ -5,512 +5,255 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SaturdayDeliveryIndicator', $data)) { - $object->setSaturdayDeliveryIndicator($data['SaturdayDeliveryIndicator']); - unset($data['SaturdayDeliveryIndicator']); - } - if (\array_key_exists('SaturdayPickupIndicator', $data)) { - $object->setSaturdayPickupIndicator($data['SaturdayPickupIndicator']); - unset($data['SaturdayPickupIndicator']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('AccessPointCOD', $data)) { - $object->setAccessPointCOD($this->denormalizer->denormalize($data['AccessPointCOD'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class, 'json', $context)); - unset($data['AccessPointCOD']); - } - if (\array_key_exists('DeliverToAddresseeOnlyIndicator', $data)) { - $object->setDeliverToAddresseeOnlyIndicator($data['DeliverToAddresseeOnlyIndicator']); - unset($data['DeliverToAddresseeOnlyIndicator']); - } - if (\array_key_exists('DirectDeliveryOnlyIndicator', $data)) { - $object->setDirectDeliveryOnlyIndicator($data['DirectDeliveryOnlyIndicator']); - unset($data['DirectDeliveryOnlyIndicator']); - } - if (\array_key_exists('Notification', $data)) { - $values = []; - foreach ($data['Notification'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class, 'json', $context); - } - $object->setNotification($values); - unset($data['Notification']); - } - if (\array_key_exists('LabelDelivery', $data)) { - $object->setLabelDelivery($this->denormalizer->denormalize($data['LabelDelivery'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class, 'json', $context)); - unset($data['LabelDelivery']); - } - if (\array_key_exists('InternationalForms', $data)) { - $object->setInternationalForms($this->denormalizer->denormalize($data['InternationalForms'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class, 'json', $context)); - unset($data['InternationalForms']); - } - if (\array_key_exists('DeliveryConfirmation', $data)) { - $object->setDeliveryConfirmation($this->denormalizer->denormalize($data['DeliveryConfirmation'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class, 'json', $context)); - unset($data['DeliveryConfirmation']); - } - if (\array_key_exists('ReturnOfDocumentIndicator', $data)) { - $object->setReturnOfDocumentIndicator($data['ReturnOfDocumentIndicator']); - unset($data['ReturnOfDocumentIndicator']); - } - if (\array_key_exists('ImportControlIndicator', $data)) { - $object->setImportControlIndicator($data['ImportControlIndicator']); - unset($data['ImportControlIndicator']); - } - if (\array_key_exists('LabelMethod', $data)) { - $object->setLabelMethod($this->denormalizer->denormalize($data['LabelMethod'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class, 'json', $context)); - unset($data['LabelMethod']); - } - if (\array_key_exists('CommercialInvoiceRemovalIndicator', $data)) { - $object->setCommercialInvoiceRemovalIndicator($data['CommercialInvoiceRemovalIndicator']); - unset($data['CommercialInvoiceRemovalIndicator']); - } - if (\array_key_exists('UPScarbonneutralIndicator', $data)) { - $object->setUPScarbonneutralIndicator($data['UPScarbonneutralIndicator']); - unset($data['UPScarbonneutralIndicator']); - } - if (\array_key_exists('PreAlertNotification', $data)) { - $values_1 = []; - foreach ($data['PreAlertNotification'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class, 'json', $context); - } - $object->setPreAlertNotification($values_1); - unset($data['PreAlertNotification']); - } - if (\array_key_exists('ExchangeForwardIndicator', $data)) { - $object->setExchangeForwardIndicator($data['ExchangeForwardIndicator']); - unset($data['ExchangeForwardIndicator']); - } - if (\array_key_exists('HoldForPickupIndicator', $data)) { - $object->setHoldForPickupIndicator($data['HoldForPickupIndicator']); - unset($data['HoldForPickupIndicator']); - } - if (\array_key_exists('DropoffAtUPSFacilityIndicator', $data)) { - $object->setDropoffAtUPSFacilityIndicator($data['DropoffAtUPSFacilityIndicator']); - unset($data['DropoffAtUPSFacilityIndicator']); - } - if (\array_key_exists('LiftGateForPickUpIndicator', $data)) { - $object->setLiftGateForPickUpIndicator($data['LiftGateForPickUpIndicator']); - unset($data['LiftGateForPickUpIndicator']); - } - if (\array_key_exists('LiftGateForDeliveryIndicator', $data)) { - $object->setLiftGateForDeliveryIndicator($data['LiftGateForDeliveryIndicator']); - unset($data['LiftGateForDeliveryIndicator']); - } - if (\array_key_exists('SDLShipmentIndicator', $data)) { - $object->setSDLShipmentIndicator($data['SDLShipmentIndicator']); - unset($data['SDLShipmentIndicator']); - } - if (\array_key_exists('EPRAReleaseCode', $data)) { - $object->setEPRAReleaseCode($data['EPRAReleaseCode']); - unset($data['EPRAReleaseCode']); - } - if (\array_key_exists('RestrictedArticles', $data)) { - $object->setRestrictedArticles($this->denormalizer->denormalize($data['RestrictedArticles'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class, 'json', $context)); - unset($data['RestrictedArticles']); - } - if (\array_key_exists('InsideDelivery', $data)) { - $object->setInsideDelivery($data['InsideDelivery']); - unset($data['InsideDelivery']); - } - if (\array_key_exists('ItemDisposal', $data)) { - $object->setItemDisposal($data['ItemDisposal']); - unset($data['ItemDisposal']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + return $type === \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('saturdayDeliveryIndicator') && null !== $object->getSaturdayDeliveryIndicator()) { - $data['SaturdayDeliveryIndicator'] = $object->getSaturdayDeliveryIndicator(); - } - if ($object->isInitialized('saturdayPickupIndicator') && null !== $object->getSaturdayPickupIndicator()) { - $data['SaturdayPickupIndicator'] = $object->getSaturdayPickupIndicator(); - } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('accessPointCOD') && null !== $object->getAccessPointCOD()) { - $data['AccessPointCOD'] = $this->normalizer->normalize($object->getAccessPointCOD(), 'json', $context); - } - if ($object->isInitialized('deliverToAddresseeOnlyIndicator') && null !== $object->getDeliverToAddresseeOnlyIndicator()) { - $data['DeliverToAddresseeOnlyIndicator'] = $object->getDeliverToAddresseeOnlyIndicator(); - } - if ($object->isInitialized('directDeliveryOnlyIndicator') && null !== $object->getDirectDeliveryOnlyIndicator()) { - $data['DirectDeliveryOnlyIndicator'] = $object->getDirectDeliveryOnlyIndicator(); - } - if ($object->isInitialized('notification') && null !== $object->getNotification()) { - $values = []; - foreach ($object->getNotification() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Notification'] = $values; - } - if ($object->isInitialized('labelDelivery') && null !== $object->getLabelDelivery()) { - $data['LabelDelivery'] = $this->normalizer->normalize($object->getLabelDelivery(), 'json', $context); - } - if ($object->isInitialized('internationalForms') && null !== $object->getInternationalForms()) { - $data['InternationalForms'] = $this->normalizer->normalize($object->getInternationalForms(), 'json', $context); - } - if ($object->isInitialized('deliveryConfirmation') && null !== $object->getDeliveryConfirmation()) { - $data['DeliveryConfirmation'] = $this->normalizer->normalize($object->getDeliveryConfirmation(), 'json', $context); - } - if ($object->isInitialized('returnOfDocumentIndicator') && null !== $object->getReturnOfDocumentIndicator()) { - $data['ReturnOfDocumentIndicator'] = $object->getReturnOfDocumentIndicator(); - } - if ($object->isInitialized('importControlIndicator') && null !== $object->getImportControlIndicator()) { - $data['ImportControlIndicator'] = $object->getImportControlIndicator(); - } - if ($object->isInitialized('labelMethod') && null !== $object->getLabelMethod()) { - $data['LabelMethod'] = $this->normalizer->normalize($object->getLabelMethod(), 'json', $context); - } - if ($object->isInitialized('commercialInvoiceRemovalIndicator') && null !== $object->getCommercialInvoiceRemovalIndicator()) { - $data['CommercialInvoiceRemovalIndicator'] = $object->getCommercialInvoiceRemovalIndicator(); - } - if ($object->isInitialized('uPScarbonneutralIndicator') && null !== $object->getUPScarbonneutralIndicator()) { - $data['UPScarbonneutralIndicator'] = $object->getUPScarbonneutralIndicator(); - } - if ($object->isInitialized('preAlertNotification') && null !== $object->getPreAlertNotification()) { - $values_1 = []; - foreach ($object->getPreAlertNotification() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['PreAlertNotification'] = $values_1; - } - if ($object->isInitialized('exchangeForwardIndicator') && null !== $object->getExchangeForwardIndicator()) { - $data['ExchangeForwardIndicator'] = $object->getExchangeForwardIndicator(); - } - if ($object->isInitialized('holdForPickupIndicator') && null !== $object->getHoldForPickupIndicator()) { - $data['HoldForPickupIndicator'] = $object->getHoldForPickupIndicator(); - } - if ($object->isInitialized('dropoffAtUPSFacilityIndicator') && null !== $object->getDropoffAtUPSFacilityIndicator()) { - $data['DropoffAtUPSFacilityIndicator'] = $object->getDropoffAtUPSFacilityIndicator(); - } - if ($object->isInitialized('liftGateForPickUpIndicator') && null !== $object->getLiftGateForPickUpIndicator()) { - $data['LiftGateForPickUpIndicator'] = $object->getLiftGateForPickUpIndicator(); - } - if ($object->isInitialized('liftGateForDeliveryIndicator') && null !== $object->getLiftGateForDeliveryIndicator()) { - $data['LiftGateForDeliveryIndicator'] = $object->getLiftGateForDeliveryIndicator(); - } - if ($object->isInitialized('sDLShipmentIndicator') && null !== $object->getSDLShipmentIndicator()) { - $data['SDLShipmentIndicator'] = $object->getSDLShipmentIndicator(); - } - if ($object->isInitialized('ePRAReleaseCode') && null !== $object->getEPRAReleaseCode()) { - $data['EPRAReleaseCode'] = $object->getEPRAReleaseCode(); - } - if ($object->isInitialized('restrictedArticles') && null !== $object->getRestrictedArticles()) { - $data['RestrictedArticles'] = $this->normalizer->normalize($object->getRestrictedArticles(), 'json', $context); - } - if ($object->isInitialized('insideDelivery') && null !== $object->getInsideDelivery()) { - $data['InsideDelivery'] = $object->getInsideDelivery(); - } - if ($object->isInitialized('itemDisposal') && null !== $object->getItemDisposal()) { - $data['ItemDisposal'] = $object->getItemDisposal(); + if (\array_key_exists('SaturdayDeliveryIndicator', $data)) { + $object->setSaturdayDeliveryIndicator($data['SaturdayDeliveryIndicator']); + unset($data['SaturdayDeliveryIndicator']); + } + if (\array_key_exists('SaturdayPickupIndicator', $data)) { + $object->setSaturdayPickupIndicator($data['SaturdayPickupIndicator']); + unset($data['SaturdayPickupIndicator']); + } + if (\array_key_exists('COD', $data)) { + $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class, 'json', $context)); + unset($data['COD']); + } + if (\array_key_exists('AccessPointCOD', $data)) { + $object->setAccessPointCOD($this->denormalizer->denormalize($data['AccessPointCOD'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class, 'json', $context)); + unset($data['AccessPointCOD']); + } + if (\array_key_exists('DeliverToAddresseeOnlyIndicator', $data)) { + $object->setDeliverToAddresseeOnlyIndicator($data['DeliverToAddresseeOnlyIndicator']); + unset($data['DeliverToAddresseeOnlyIndicator']); + } + if (\array_key_exists('DirectDeliveryOnlyIndicator', $data)) { + $object->setDirectDeliveryOnlyIndicator($data['DirectDeliveryOnlyIndicator']); + unset($data['DirectDeliveryOnlyIndicator']); + } + if (\array_key_exists('Notification', $data)) { + $values = []; + foreach ($data['Notification'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setNotification($values); + unset($data['Notification']); + } + if (\array_key_exists('LabelDelivery', $data)) { + $object->setLabelDelivery($this->denormalizer->denormalize($data['LabelDelivery'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class, 'json', $context)); + unset($data['LabelDelivery']); + } + if (\array_key_exists('InternationalForms', $data)) { + $object->setInternationalForms($this->denormalizer->denormalize($data['InternationalForms'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class, 'json', $context)); + unset($data['InternationalForms']); + } + if (\array_key_exists('DeliveryConfirmation', $data)) { + $object->setDeliveryConfirmation($this->denormalizer->denormalize($data['DeliveryConfirmation'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class, 'json', $context)); + unset($data['DeliveryConfirmation']); + } + if (\array_key_exists('ReturnOfDocumentIndicator', $data)) { + $object->setReturnOfDocumentIndicator($data['ReturnOfDocumentIndicator']); + unset($data['ReturnOfDocumentIndicator']); + } + if (\array_key_exists('ImportControlIndicator', $data)) { + $object->setImportControlIndicator($data['ImportControlIndicator']); + unset($data['ImportControlIndicator']); + } + if (\array_key_exists('LabelMethod', $data)) { + $object->setLabelMethod($this->denormalizer->denormalize($data['LabelMethod'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class, 'json', $context)); + unset($data['LabelMethod']); + } + if (\array_key_exists('CommercialInvoiceRemovalIndicator', $data)) { + $object->setCommercialInvoiceRemovalIndicator($data['CommercialInvoiceRemovalIndicator']); + unset($data['CommercialInvoiceRemovalIndicator']); + } + if (\array_key_exists('UPScarbonneutralIndicator', $data)) { + $object->setUPScarbonneutralIndicator($data['UPScarbonneutralIndicator']); + unset($data['UPScarbonneutralIndicator']); + } + if (\array_key_exists('PreAlertNotification', $data)) { + $values_1 = []; + foreach ($data['PreAlertNotification'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class, 'json', $context); } - return $data; + $object->setPreAlertNotification($values_1); + unset($data['PreAlertNotification']); + } + if (\array_key_exists('ExchangeForwardIndicator', $data)) { + $object->setExchangeForwardIndicator($data['ExchangeForwardIndicator']); + unset($data['ExchangeForwardIndicator']); + } + if (\array_key_exists('HoldForPickupIndicator', $data)) { + $object->setHoldForPickupIndicator($data['HoldForPickupIndicator']); + unset($data['HoldForPickupIndicator']); + } + if (\array_key_exists('DropoffAtUPSFacilityIndicator', $data)) { + $object->setDropoffAtUPSFacilityIndicator($data['DropoffAtUPSFacilityIndicator']); + unset($data['DropoffAtUPSFacilityIndicator']); + } + if (\array_key_exists('LiftGateForPickUpIndicator', $data)) { + $object->setLiftGateForPickUpIndicator($data['LiftGateForPickUpIndicator']); + unset($data['LiftGateForPickUpIndicator']); + } + if (\array_key_exists('LiftGateForDeliveryIndicator', $data)) { + $object->setLiftGateForDeliveryIndicator($data['LiftGateForDeliveryIndicator']); + unset($data['LiftGateForDeliveryIndicator']); + } + if (\array_key_exists('SDLShipmentIndicator', $data)) { + $object->setSDLShipmentIndicator($data['SDLShipmentIndicator']); + unset($data['SDLShipmentIndicator']); + } + if (\array_key_exists('EPRAReleaseCode', $data)) { + $object->setEPRAReleaseCode($data['EPRAReleaseCode']); + unset($data['EPRAReleaseCode']); + } + if (\array_key_exists('RestrictedArticles', $data)) { + $object->setRestrictedArticles($this->denormalizer->denormalize($data['RestrictedArticles'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class, 'json', $context)); + unset($data['RestrictedArticles']); + } + if (\array_key_exists('InsideDelivery', $data)) { + $object->setInsideDelivery($data['InsideDelivery']); + unset($data['InsideDelivery']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class => false]; + if (\array_key_exists('ItemDisposal', $data)) { + $object->setItemDisposal($data['ItemDisposal']); + unset($data['ItemDisposal']); } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } -} else { - class ShipmentShipmentServiceOptionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SaturdayDeliveryIndicator', $data)) { - $object->setSaturdayDeliveryIndicator($data['SaturdayDeliveryIndicator']); - unset($data['SaturdayDeliveryIndicator']); - } - if (\array_key_exists('SaturdayPickupIndicator', $data)) { - $object->setSaturdayPickupIndicator($data['SaturdayPickupIndicator']); - unset($data['SaturdayPickupIndicator']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('AccessPointCOD', $data)) { - $object->setAccessPointCOD($this->denormalizer->denormalize($data['AccessPointCOD'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsAccessPointCOD::class, 'json', $context)); - unset($data['AccessPointCOD']); - } - if (\array_key_exists('DeliverToAddresseeOnlyIndicator', $data)) { - $object->setDeliverToAddresseeOnlyIndicator($data['DeliverToAddresseeOnlyIndicator']); - unset($data['DeliverToAddresseeOnlyIndicator']); - } - if (\array_key_exists('DirectDeliveryOnlyIndicator', $data)) { - $object->setDirectDeliveryOnlyIndicator($data['DirectDeliveryOnlyIndicator']); - unset($data['DirectDeliveryOnlyIndicator']); - } - if (\array_key_exists('Notification', $data)) { - $values = []; - foreach ($data['Notification'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ShipmentServiceOptionsNotification::class, 'json', $context); - } - $object->setNotification($values); - unset($data['Notification']); - } - if (\array_key_exists('LabelDelivery', $data)) { - $object->setLabelDelivery($this->denormalizer->denormalize($data['LabelDelivery'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelDelivery::class, 'json', $context)); - unset($data['LabelDelivery']); - } - if (\array_key_exists('InternationalForms', $data)) { - $object->setInternationalForms($this->denormalizer->denormalize($data['InternationalForms'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsInternationalForms::class, 'json', $context)); - unset($data['InternationalForms']); - } - if (\array_key_exists('DeliveryConfirmation', $data)) { - $object->setDeliveryConfirmation($this->denormalizer->denormalize($data['DeliveryConfirmation'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsDeliveryConfirmation::class, 'json', $context)); - unset($data['DeliveryConfirmation']); - } - if (\array_key_exists('ReturnOfDocumentIndicator', $data)) { - $object->setReturnOfDocumentIndicator($data['ReturnOfDocumentIndicator']); - unset($data['ReturnOfDocumentIndicator']); - } - if (\array_key_exists('ImportControlIndicator', $data)) { - $object->setImportControlIndicator($data['ImportControlIndicator']); - unset($data['ImportControlIndicator']); - } - if (\array_key_exists('LabelMethod', $data)) { - $object->setLabelMethod($this->denormalizer->denormalize($data['LabelMethod'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsLabelMethod::class, 'json', $context)); - unset($data['LabelMethod']); - } - if (\array_key_exists('CommercialInvoiceRemovalIndicator', $data)) { - $object->setCommercialInvoiceRemovalIndicator($data['CommercialInvoiceRemovalIndicator']); - unset($data['CommercialInvoiceRemovalIndicator']); - } - if (\array_key_exists('UPScarbonneutralIndicator', $data)) { - $object->setUPScarbonneutralIndicator($data['UPScarbonneutralIndicator']); - unset($data['UPScarbonneutralIndicator']); - } - if (\array_key_exists('PreAlertNotification', $data)) { - $values_1 = []; - foreach ($data['PreAlertNotification'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ShipmentServiceOptionsPreAlertNotification::class, 'json', $context); - } - $object->setPreAlertNotification($values_1); - unset($data['PreAlertNotification']); - } - if (\array_key_exists('ExchangeForwardIndicator', $data)) { - $object->setExchangeForwardIndicator($data['ExchangeForwardIndicator']); - unset($data['ExchangeForwardIndicator']); - } - if (\array_key_exists('HoldForPickupIndicator', $data)) { - $object->setHoldForPickupIndicator($data['HoldForPickupIndicator']); - unset($data['HoldForPickupIndicator']); - } - if (\array_key_exists('DropoffAtUPSFacilityIndicator', $data)) { - $object->setDropoffAtUPSFacilityIndicator($data['DropoffAtUPSFacilityIndicator']); - unset($data['DropoffAtUPSFacilityIndicator']); - } - if (\array_key_exists('LiftGateForPickUpIndicator', $data)) { - $object->setLiftGateForPickUpIndicator($data['LiftGateForPickUpIndicator']); - unset($data['LiftGateForPickUpIndicator']); - } - if (\array_key_exists('LiftGateForDeliveryIndicator', $data)) { - $object->setLiftGateForDeliveryIndicator($data['LiftGateForDeliveryIndicator']); - unset($data['LiftGateForDeliveryIndicator']); - } - if (\array_key_exists('SDLShipmentIndicator', $data)) { - $object->setSDLShipmentIndicator($data['SDLShipmentIndicator']); - unset($data['SDLShipmentIndicator']); - } - if (\array_key_exists('EPRAReleaseCode', $data)) { - $object->setEPRAReleaseCode($data['EPRAReleaseCode']); - unset($data['EPRAReleaseCode']); - } - if (\array_key_exists('RestrictedArticles', $data)) { - $object->setRestrictedArticles($this->denormalizer->denormalize($data['RestrictedArticles'], \ShipStream\Ups\Api\Model\ShipmentServiceOptionsRestrictedArticles::class, 'json', $context)); - unset($data['RestrictedArticles']); - } - if (\array_key_exists('InsideDelivery', $data)) { - $object->setInsideDelivery($data['InsideDelivery']); - unset($data['InsideDelivery']); - } - if (\array_key_exists('ItemDisposal', $data)) { - $object->setItemDisposal($data['ItemDisposal']); - unset($data['ItemDisposal']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('saturdayDeliveryIndicator') && null !== $data->getSaturdayDeliveryIndicator()) { + $dataArray['SaturdayDeliveryIndicator'] = $data->getSaturdayDeliveryIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('saturdayDeliveryIndicator') && null !== $object->getSaturdayDeliveryIndicator()) { - $data['SaturdayDeliveryIndicator'] = $object->getSaturdayDeliveryIndicator(); - } - if ($object->isInitialized('saturdayPickupIndicator') && null !== $object->getSaturdayPickupIndicator()) { - $data['SaturdayPickupIndicator'] = $object->getSaturdayPickupIndicator(); - } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('accessPointCOD') && null !== $object->getAccessPointCOD()) { - $data['AccessPointCOD'] = $this->normalizer->normalize($object->getAccessPointCOD(), 'json', $context); - } - if ($object->isInitialized('deliverToAddresseeOnlyIndicator') && null !== $object->getDeliverToAddresseeOnlyIndicator()) { - $data['DeliverToAddresseeOnlyIndicator'] = $object->getDeliverToAddresseeOnlyIndicator(); - } - if ($object->isInitialized('directDeliveryOnlyIndicator') && null !== $object->getDirectDeliveryOnlyIndicator()) { - $data['DirectDeliveryOnlyIndicator'] = $object->getDirectDeliveryOnlyIndicator(); - } - if ($object->isInitialized('notification') && null !== $object->getNotification()) { - $values = []; - foreach ($object->getNotification() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Notification'] = $values; - } - if ($object->isInitialized('labelDelivery') && null !== $object->getLabelDelivery()) { - $data['LabelDelivery'] = $this->normalizer->normalize($object->getLabelDelivery(), 'json', $context); - } - if ($object->isInitialized('internationalForms') && null !== $object->getInternationalForms()) { - $data['InternationalForms'] = $this->normalizer->normalize($object->getInternationalForms(), 'json', $context); - } - if ($object->isInitialized('deliveryConfirmation') && null !== $object->getDeliveryConfirmation()) { - $data['DeliveryConfirmation'] = $this->normalizer->normalize($object->getDeliveryConfirmation(), 'json', $context); - } - if ($object->isInitialized('returnOfDocumentIndicator') && null !== $object->getReturnOfDocumentIndicator()) { - $data['ReturnOfDocumentIndicator'] = $object->getReturnOfDocumentIndicator(); - } - if ($object->isInitialized('importControlIndicator') && null !== $object->getImportControlIndicator()) { - $data['ImportControlIndicator'] = $object->getImportControlIndicator(); - } - if ($object->isInitialized('labelMethod') && null !== $object->getLabelMethod()) { - $data['LabelMethod'] = $this->normalizer->normalize($object->getLabelMethod(), 'json', $context); - } - if ($object->isInitialized('commercialInvoiceRemovalIndicator') && null !== $object->getCommercialInvoiceRemovalIndicator()) { - $data['CommercialInvoiceRemovalIndicator'] = $object->getCommercialInvoiceRemovalIndicator(); - } - if ($object->isInitialized('uPScarbonneutralIndicator') && null !== $object->getUPScarbonneutralIndicator()) { - $data['UPScarbonneutralIndicator'] = $object->getUPScarbonneutralIndicator(); - } - if ($object->isInitialized('preAlertNotification') && null !== $object->getPreAlertNotification()) { - $values_1 = []; - foreach ($object->getPreAlertNotification() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['PreAlertNotification'] = $values_1; - } - if ($object->isInitialized('exchangeForwardIndicator') && null !== $object->getExchangeForwardIndicator()) { - $data['ExchangeForwardIndicator'] = $object->getExchangeForwardIndicator(); - } - if ($object->isInitialized('holdForPickupIndicator') && null !== $object->getHoldForPickupIndicator()) { - $data['HoldForPickupIndicator'] = $object->getHoldForPickupIndicator(); - } - if ($object->isInitialized('dropoffAtUPSFacilityIndicator') && null !== $object->getDropoffAtUPSFacilityIndicator()) { - $data['DropoffAtUPSFacilityIndicator'] = $object->getDropoffAtUPSFacilityIndicator(); - } - if ($object->isInitialized('liftGateForPickUpIndicator') && null !== $object->getLiftGateForPickUpIndicator()) { - $data['LiftGateForPickUpIndicator'] = $object->getLiftGateForPickUpIndicator(); - } - if ($object->isInitialized('liftGateForDeliveryIndicator') && null !== $object->getLiftGateForDeliveryIndicator()) { - $data['LiftGateForDeliveryIndicator'] = $object->getLiftGateForDeliveryIndicator(); - } - if ($object->isInitialized('sDLShipmentIndicator') && null !== $object->getSDLShipmentIndicator()) { - $data['SDLShipmentIndicator'] = $object->getSDLShipmentIndicator(); - } - if ($object->isInitialized('ePRAReleaseCode') && null !== $object->getEPRAReleaseCode()) { - $data['EPRAReleaseCode'] = $object->getEPRAReleaseCode(); - } - if ($object->isInitialized('restrictedArticles') && null !== $object->getRestrictedArticles()) { - $data['RestrictedArticles'] = $this->normalizer->normalize($object->getRestrictedArticles(), 'json', $context); - } - if ($object->isInitialized('insideDelivery') && null !== $object->getInsideDelivery()) { - $data['InsideDelivery'] = $object->getInsideDelivery(); - } - if ($object->isInitialized('itemDisposal') && null !== $object->getItemDisposal()) { - $data['ItemDisposal'] = $object->getItemDisposal(); + if ($data->isInitialized('saturdayPickupIndicator') && null !== $data->getSaturdayPickupIndicator()) { + $dataArray['SaturdayPickupIndicator'] = $data->getSaturdayPickupIndicator(); + } + if ($data->isInitialized('cOD') && null !== $data->getCOD()) { + $dataArray['COD'] = $this->normalizer->normalize($data->getCOD(), 'json', $context); + } + if ($data->isInitialized('accessPointCOD') && null !== $data->getAccessPointCOD()) { + $dataArray['AccessPointCOD'] = $this->normalizer->normalize($data->getAccessPointCOD(), 'json', $context); + } + if ($data->isInitialized('deliverToAddresseeOnlyIndicator') && null !== $data->getDeliverToAddresseeOnlyIndicator()) { + $dataArray['DeliverToAddresseeOnlyIndicator'] = $data->getDeliverToAddresseeOnlyIndicator(); + } + if ($data->isInitialized('directDeliveryOnlyIndicator') && null !== $data->getDirectDeliveryOnlyIndicator()) { + $dataArray['DirectDeliveryOnlyIndicator'] = $data->getDirectDeliveryOnlyIndicator(); + } + if ($data->isInitialized('notification') && null !== $data->getNotification()) { + $values = []; + foreach ($data->getNotification() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $dataArray['Notification'] = $values; + } + if ($data->isInitialized('labelDelivery') && null !== $data->getLabelDelivery()) { + $dataArray['LabelDelivery'] = $this->normalizer->normalize($data->getLabelDelivery(), 'json', $context); + } + if ($data->isInitialized('internationalForms') && null !== $data->getInternationalForms()) { + $dataArray['InternationalForms'] = $this->normalizer->normalize($data->getInternationalForms(), 'json', $context); + } + if ($data->isInitialized('deliveryConfirmation') && null !== $data->getDeliveryConfirmation()) { + $dataArray['DeliveryConfirmation'] = $this->normalizer->normalize($data->getDeliveryConfirmation(), 'json', $context); + } + if ($data->isInitialized('returnOfDocumentIndicator') && null !== $data->getReturnOfDocumentIndicator()) { + $dataArray['ReturnOfDocumentIndicator'] = $data->getReturnOfDocumentIndicator(); + } + if ($data->isInitialized('importControlIndicator') && null !== $data->getImportControlIndicator()) { + $dataArray['ImportControlIndicator'] = $data->getImportControlIndicator(); + } + if ($data->isInitialized('labelMethod') && null !== $data->getLabelMethod()) { + $dataArray['LabelMethod'] = $this->normalizer->normalize($data->getLabelMethod(), 'json', $context); + } + if ($data->isInitialized('commercialInvoiceRemovalIndicator') && null !== $data->getCommercialInvoiceRemovalIndicator()) { + $dataArray['CommercialInvoiceRemovalIndicator'] = $data->getCommercialInvoiceRemovalIndicator(); + } + if ($data->isInitialized('uPScarbonneutralIndicator') && null !== $data->getUPScarbonneutralIndicator()) { + $dataArray['UPScarbonneutralIndicator'] = $data->getUPScarbonneutralIndicator(); + } + if ($data->isInitialized('preAlertNotification') && null !== $data->getPreAlertNotification()) { + $values_1 = []; + foreach ($data->getPreAlertNotification() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['PreAlertNotification'] = $values_1; + } + if ($data->isInitialized('exchangeForwardIndicator') && null !== $data->getExchangeForwardIndicator()) { + $dataArray['ExchangeForwardIndicator'] = $data->getExchangeForwardIndicator(); + } + if ($data->isInitialized('holdForPickupIndicator') && null !== $data->getHoldForPickupIndicator()) { + $dataArray['HoldForPickupIndicator'] = $data->getHoldForPickupIndicator(); + } + if ($data->isInitialized('dropoffAtUPSFacilityIndicator') && null !== $data->getDropoffAtUPSFacilityIndicator()) { + $dataArray['DropoffAtUPSFacilityIndicator'] = $data->getDropoffAtUPSFacilityIndicator(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class => false]; + if ($data->isInitialized('liftGateForPickUpIndicator') && null !== $data->getLiftGateForPickUpIndicator()) { + $dataArray['LiftGateForPickUpIndicator'] = $data->getLiftGateForPickUpIndicator(); } + if ($data->isInitialized('liftGateForDeliveryIndicator') && null !== $data->getLiftGateForDeliveryIndicator()) { + $dataArray['LiftGateForDeliveryIndicator'] = $data->getLiftGateForDeliveryIndicator(); + } + if ($data->isInitialized('sDLShipmentIndicator') && null !== $data->getSDLShipmentIndicator()) { + $dataArray['SDLShipmentIndicator'] = $data->getSDLShipmentIndicator(); + } + if ($data->isInitialized('ePRAReleaseCode') && null !== $data->getEPRAReleaseCode()) { + $dataArray['EPRAReleaseCode'] = $data->getEPRAReleaseCode(); + } + if ($data->isInitialized('restrictedArticles') && null !== $data->getRestrictedArticles()) { + $dataArray['RestrictedArticles'] = $this->normalizer->normalize($data->getRestrictedArticles(), 'json', $context); + } + if ($data->isInitialized('insideDelivery') && null !== $data->getInsideDelivery()) { + $dataArray['InsideDelivery'] = $data->getInsideDelivery(); + } + if ($data->isInitialized('itemDisposal') && null !== $data->getItemDisposal()) { + $dataArray['ItemDisposal'] = $data->getItemDisposal(); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentShipmentServiceOptions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentShipmentTotalWeightNormalizer.php b/src/Api/Normalizer/ShipmentShipmentTotalWeightNormalizer.php index 40e8a933..920163ec 100644 --- a/src/Api/Normalizer/ShipmentShipmentTotalWeightNormalizer.php +++ b/src/Api/Normalizer/ShipmentShipmentTotalWeightNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentShipmentTotalWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentShipmentTotalWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class => false]; - } - } -} else { - class ShipmentShipmentTotalWeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class; + if (\array_key_exists('UnitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class, 'json', $context)); + unset($data['UnitOfMeasurement']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class; + if (\array_key_exists('Weight', $data)) { + $object->setWeight($data['Weight']); + unset($data['Weight']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UnitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($this->denormalizer->denormalize($data['UnitOfMeasurement'], \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class, 'json', $context)); - unset($data['UnitOfMeasurement']); - } - if (\array_key_exists('Weight', $data)) { - $object->setWeight($data['Weight']); - unset($data['Weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UnitOfMeasurement'] = $this->normalizer->normalize($object->getUnitOfMeasurement(), 'json', $context); - $data['Weight'] = $object->getWeight(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UnitOfMeasurement'] = $this->normalizer->normalize($data->getUnitOfMeasurement(), 'json', $context); + $dataArray['Weight'] = $data->getWeight(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentShipmentTotalWeight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentShipperNormalizer.php b/src/Api/Normalizer/ShipmentShipperNormalizer.php index f8a6be3f..388e09b8 100644 --- a/src/Api/Normalizer/ShipmentShipperNormalizer.php +++ b/src/Api/Normalizer/ShipmentShipperNormalizer.php @@ -5,230 +5,114 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipper::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('CompanyDisplayableName', $data)) { - $object->setCompanyDisplayableName($data['CompanyDisplayableName']); - unset($data['CompanyDisplayableName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipperPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipperAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\ShipmentShipper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\ShipmentShipper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('companyDisplayableName') && null !== $object->getCompanyDisplayableName()) { - $data['CompanyDisplayableName'] = $object->getCompanyDisplayableName(); - } - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - $data['ShipperNumber'] = $object->getShipperNumber(); - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Name', $data)) { + $object->setName($data['Name']); + unset($data['Name']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('CompanyDisplayableName', $data)) { + $object->setCompanyDisplayableName($data['CompanyDisplayableName']); + unset($data['CompanyDisplayableName']); + } + if (\array_key_exists('TaxIdentificationNumber', $data)) { + $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); + unset($data['TaxIdentificationNumber']); + } + if (\array_key_exists('Phone', $data)) { + $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipperPhone::class, 'json', $context)); + unset($data['Phone']); + } + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); + } + if (\array_key_exists('FaxNumber', $data)) { + $object->setFaxNumber($data['FaxNumber']); + unset($data['FaxNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipper::class => false]; + if (\array_key_exists('EMailAddress', $data)) { + $object->setEMailAddress($data['EMailAddress']); + unset($data['EMailAddress']); } + if (\array_key_exists('Address', $data)) { + $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipperAddress::class, 'json', $context)); + unset($data['Address']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class ShipmentShipperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentShipper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentShipper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentShipper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Name', $data)) { - $object->setName($data['Name']); - unset($data['Name']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('CompanyDisplayableName', $data)) { - $object->setCompanyDisplayableName($data['CompanyDisplayableName']); - unset($data['CompanyDisplayableName']); - } - if (\array_key_exists('TaxIdentificationNumber', $data)) { - $object->setTaxIdentificationNumber($data['TaxIdentificationNumber']); - unset($data['TaxIdentificationNumber']); - } - if (\array_key_exists('Phone', $data)) { - $object->setPhone($this->denormalizer->denormalize($data['Phone'], \ShipStream\Ups\Api\Model\ShipperPhone::class, 'json', $context)); - unset($data['Phone']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('FaxNumber', $data)) { - $object->setFaxNumber($data['FaxNumber']); - unset($data['FaxNumber']); - } - if (\array_key_exists('EMailAddress', $data)) { - $object->setEMailAddress($data['EMailAddress']); - unset($data['EMailAddress']); - } - if (\array_key_exists('Address', $data)) { - $object->setAddress($this->denormalizer->denormalize($data['Address'], \ShipStream\Ups\Api\Model\ShipperAddress::class, 'json', $context)); - unset($data['Address']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Name'] = $data->getName(); + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Name'] = $object->getName(); - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('companyDisplayableName') && null !== $object->getCompanyDisplayableName()) { - $data['CompanyDisplayableName'] = $object->getCompanyDisplayableName(); - } - if ($object->isInitialized('taxIdentificationNumber') && null !== $object->getTaxIdentificationNumber()) { - $data['TaxIdentificationNumber'] = $object->getTaxIdentificationNumber(); - } - if ($object->isInitialized('phone') && null !== $object->getPhone()) { - $data['Phone'] = $this->normalizer->normalize($object->getPhone(), 'json', $context); - } - $data['ShipperNumber'] = $object->getShipperNumber(); - if ($object->isInitialized('faxNumber') && null !== $object->getFaxNumber()) { - $data['FaxNumber'] = $object->getFaxNumber(); - } - if ($object->isInitialized('eMailAddress') && null !== $object->getEMailAddress()) { - $data['EMailAddress'] = $object->getEMailAddress(); - } - $data['Address'] = $this->normalizer->normalize($object->getAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('companyDisplayableName') && null !== $data->getCompanyDisplayableName()) { + $dataArray['CompanyDisplayableName'] = $data->getCompanyDisplayableName(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentShipper::class => false]; + if ($data->isInitialized('taxIdentificationNumber') && null !== $data->getTaxIdentificationNumber()) { + $dataArray['TaxIdentificationNumber'] = $data->getTaxIdentificationNumber(); } + if ($data->isInitialized('phone') && null !== $data->getPhone()) { + $dataArray['Phone'] = $this->normalizer->normalize($data->getPhone(), 'json', $context); + } + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + if ($data->isInitialized('faxNumber') && null !== $data->getFaxNumber()) { + $dataArray['FaxNumber'] = $data->getFaxNumber(); + } + if ($data->isInitialized('eMailAddress') && null !== $data->getEMailAddress()) { + $dataArray['EMailAddress'] = $data->getEMailAddress(); + } + $dataArray['Address'] = $this->normalizer->normalize($data->getAddress(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentShipper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipmentTotalWeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/ShipmentTotalWeightUnitOfMeasurementNormalizer.php index de1d8d0b..7ae972ce 100644 --- a/src/Api/Normalizer/ShipmentTotalWeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/ShipmentTotalWeightUnitOfMeasurementNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentTotalWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipmentTotalWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class => false]; - } - } -} else { - class ShipmentTotalWeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipmentTotalWeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipperAccountNormalizer.php b/src/Api/Normalizer/ShipperAccountNormalizer.php index cb0ad028..8562d53d 100644 --- a/src/Api/Normalizer/ShipperAccountNormalizer.php +++ b/src/Api/Normalizer/ShipperAccountNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipperAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipperAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipperAccount::class; + return $type === \ShipStream\Ups\Api\Model\ShipperAccount::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipperAccount::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipperAccount::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipperAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('AccountCountryCode', $data)) { - $object->setAccountCountryCode($data['AccountCountryCode']); - unset($data['AccountCountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipperAccount(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['AccountNumber'] = $object->getAccountNumber(); - $data['AccountCountryCode'] = $object->getAccountCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipperAccount::class => false]; - } - } -} else { - class ShipperAccountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipperAccount::class; + if (\array_key_exists('AccountNumber', $data)) { + $object->setAccountNumber($data['AccountNumber']); + unset($data['AccountNumber']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipperAccount::class; + if (\array_key_exists('AccountCountryCode', $data)) { + $object->setAccountCountryCode($data['AccountCountryCode']); + unset($data['AccountCountryCode']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipperAccount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AccountNumber', $data)) { - $object->setAccountNumber($data['AccountNumber']); - unset($data['AccountNumber']); - } - if (\array_key_exists('AccountCountryCode', $data)) { - $object->setAccountCountryCode($data['AccountCountryCode']); - unset($data['AccountCountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['AccountNumber'] = $object->getAccountNumber(); - $data['AccountCountryCode'] = $object->getAccountCountryCode(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['AccountNumber'] = $data->getAccountNumber(); + $dataArray['AccountCountryCode'] = $data->getAccountCountryCode(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipperAccount::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipperAccount::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipperAddressNormalizer.php b/src/Api/Normalizer/ShipperAddressNormalizer.php index 0a222d4b..e2945b58 100644 --- a/src/Api/Normalizer/ShipperAddressNormalizer.php +++ b/src/Api/Normalizer/ShipperAddressNormalizer.php @@ -5,190 +5,94 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipperAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipperAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipperAddress::class; + return $type === \ShipStream\Ups\Api\Model\ShipperAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipperAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipperAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipperAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipperAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipperAddress::class => false]; + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class ShipperAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipperAddress::class; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipperAddress::class; + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipperAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipperAddress::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipperAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipperChargeCardNormalizer.php b/src/Api/Normalizer/ShipperChargeCardNormalizer.php index bae6e8a5..b9303c06 100644 --- a/src/Api/Normalizer/ShipperChargeCardNormalizer.php +++ b/src/Api/Normalizer/ShipperChargeCardNormalizer.php @@ -5,180 +5,89 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipperChargeCardNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipperChargeCardNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipperChargeCard::class; + return $type === \ShipStream\Ups\Api\Model\ShipperChargeCard::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipperChargeCard::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipperChargeCard::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipperChargeCard(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CardHolderName', $data)) { - $object->setCardHolderName($data['CardHolderName']); - unset($data['CardHolderName']); - } - if (\array_key_exists('CardType', $data)) { - $object->setCardType($data['CardType']); - unset($data['CardType']); - } - if (\array_key_exists('CardNumber', $data)) { - $object->setCardNumber($data['CardNumber']); - unset($data['CardNumber']); - } - if (\array_key_exists('ExpirationDate', $data)) { - $object->setExpirationDate($data['ExpirationDate']); - unset($data['ExpirationDate']); - } - if (\array_key_exists('SecurityCode', $data)) { - $object->setSecurityCode($data['SecurityCode']); - unset($data['SecurityCode']); - } - if (\array_key_exists('CardAddress', $data)) { - $object->setCardAddress($this->denormalizer->denormalize($data['CardAddress'], \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class, 'json', $context)); - unset($data['CardAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipperChargeCard(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('cardHolderName') && null !== $object->getCardHolderName()) { - $data['CardHolderName'] = $object->getCardHolderName(); - } - $data['CardType'] = $object->getCardType(); - $data['CardNumber'] = $object->getCardNumber(); - $data['ExpirationDate'] = $object->getExpirationDate(); - $data['SecurityCode'] = $object->getSecurityCode(); - $data['CardAddress'] = $this->normalizer->normalize($object->getCardAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CardHolderName', $data)) { + $object->setCardHolderName($data['CardHolderName']); + unset($data['CardHolderName']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipperChargeCard::class => false]; + if (\array_key_exists('CardType', $data)) { + $object->setCardType($data['CardType']); + unset($data['CardType']); } - } -} else { - class ShipperChargeCardNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipperChargeCard::class; + if (\array_key_exists('CardNumber', $data)) { + $object->setCardNumber($data['CardNumber']); + unset($data['CardNumber']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipperChargeCard::class; + if (\array_key_exists('ExpirationDate', $data)) { + $object->setExpirationDate($data['ExpirationDate']); + unset($data['ExpirationDate']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipperChargeCard(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CardHolderName', $data)) { - $object->setCardHolderName($data['CardHolderName']); - unset($data['CardHolderName']); - } - if (\array_key_exists('CardType', $data)) { - $object->setCardType($data['CardType']); - unset($data['CardType']); - } - if (\array_key_exists('CardNumber', $data)) { - $object->setCardNumber($data['CardNumber']); - unset($data['CardNumber']); - } - if (\array_key_exists('ExpirationDate', $data)) { - $object->setExpirationDate($data['ExpirationDate']); - unset($data['ExpirationDate']); - } - if (\array_key_exists('SecurityCode', $data)) { - $object->setSecurityCode($data['SecurityCode']); - unset($data['SecurityCode']); - } - if (\array_key_exists('CardAddress', $data)) { - $object->setCardAddress($this->denormalizer->denormalize($data['CardAddress'], \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class, 'json', $context)); - unset($data['CardAddress']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if (\array_key_exists('SecurityCode', $data)) { + $object->setSecurityCode($data['SecurityCode']); + unset($data['SecurityCode']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('cardHolderName') && null !== $object->getCardHolderName()) { - $data['CardHolderName'] = $object->getCardHolderName(); - } - $data['CardType'] = $object->getCardType(); - $data['CardNumber'] = $object->getCardNumber(); - $data['ExpirationDate'] = $object->getExpirationDate(); - $data['SecurityCode'] = $object->getSecurityCode(); - $data['CardAddress'] = $this->normalizer->normalize($object->getCardAddress(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + if (\array_key_exists('CardAddress', $data)) { + $object->setCardAddress($this->denormalizer->denormalize($data['CardAddress'], \ShipStream\Ups\Api\Model\ChargeCardCardAddress::class, 'json', $context)); + unset($data['CardAddress']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $data; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipperChargeCard::class => false]; + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('cardHolderName') && null !== $data->getCardHolderName()) { + $dataArray['CardHolderName'] = $data->getCardHolderName(); } + $dataArray['CardType'] = $data->getCardType(); + $dataArray['CardNumber'] = $data->getCardNumber(); + $dataArray['ExpirationDate'] = $data->getExpirationDate(); + $dataArray['SecurityCode'] = $data->getSecurityCode(); + $dataArray['CardAddress'] = $this->normalizer->normalize($data->getCardAddress(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipperChargeCard::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShipperPhoneNormalizer.php b/src/Api/Normalizer/ShipperPhoneNormalizer.php index 36923dac..a005e956 100644 --- a/src/Api/Normalizer/ShipperPhoneNormalizer.php +++ b/src/Api/Normalizer/ShipperPhoneNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipperPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShipperPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipperPhone::class; + return $type === \ShipStream\Ups\Api\Model\ShipperPhone::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipperPhone::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipperPhone::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipperPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShipperPhone(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Extension', $data)) { + $object->setExtension($data['Extension']); + unset($data['Extension']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipperPhone::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShipperPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShipperPhone::class; + $dataArray = []; + $dataArray['Number'] = $data->getNumber(); + if ($data->isInitialized('extension') && null !== $data->getExtension()) { + $dataArray['Extension'] = $data->getExtension(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShipperPhone::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShipperPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShipperPhone::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShipperPhone::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShippingAvailabilityUnavailableReasonNormalizer.php b/src/Api/Normalizer/ShippingAvailabilityUnavailableReasonNormalizer.php index 93ea72fe..c96d32d8 100644 --- a/src/Api/Normalizer/ShippingAvailabilityUnavailableReasonNormalizer.php +++ b/src/Api/Normalizer/ShippingAvailabilityUnavailableReasonNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShippingAvailabilityUnavailableReasonNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShippingAvailabilityUnavailableReasonNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class; + return $type === \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class => false]; - } - } -} else { - class ShippingAvailabilityUnavailableReasonNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShippingAvailabilityUnavailableReason::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShippingLabelImageFormatNormalizer.php b/src/Api/Normalizer/ShippingLabelImageFormatNormalizer.php index 216d824b..2cf1e06b 100644 --- a/src/Api/Normalizer/ShippingLabelImageFormatNormalizer.php +++ b/src/Api/Normalizer/ShippingLabelImageFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShippingLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShippingLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShippingLabelImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShippingLabelImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShippingLabelImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShippingLabelImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShippingLabelImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ShippingReceiptImageFormatNormalizer.php b/src/Api/Normalizer/ShippingReceiptImageFormatNormalizer.php index 5958125b..12b5f82f 100644 --- a/src/Api/Normalizer/ShippingReceiptImageFormatNormalizer.php +++ b/src/Api/Normalizer/ShippingReceiptImageFormatNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShippingReceiptImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ShippingReceiptImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class; + return $type === \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class ShippingReceiptImageFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ShippingReceiptImageFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ShippingReceiptImageFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SignatureNormalizer.php b/src/Api/Normalizer/SignatureNormalizer.php index fa420ebe..248c788f 100644 --- a/src/Api/Normalizer/SignatureNormalizer.php +++ b/src/Api/Normalizer/SignatureNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SignatureNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SignatureNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Signature::class; + return $type === \ShipStream\Ups\Api\Model\Signature::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Signature::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Signature::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Signature(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('image', $data)) { - $object->setImage($data['image']); - unset($data['image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\Signature(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('image') && null !== $object->getImage()) { - $data['image'] = $object->getImage(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('image', $data)) { + $object->setImage($data['image']); + unset($data['image']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Signature::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class SignatureNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Signature::class; + $dataArray = []; + if ($data->isInitialized('image') && null !== $data->getImage()) { + $dataArray['image'] = $data->getImage(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Signature::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Signature(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('image', $data)) { - $object->setImage($data['image']); - unset($data['image']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('image') && null !== $object->getImage()) { - $data['image'] = $object->getImage(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Signature::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Signature::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SoldToAddressNormalizer.php b/src/Api/Normalizer/SoldToAddressNormalizer.php index f7520e57..4a722320 100644 --- a/src/Api/Normalizer/SoldToAddressNormalizer.php +++ b/src/Api/Normalizer/SoldToAddressNormalizer.php @@ -5,204 +5,101 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SoldToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SoldToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SoldToAddress::class; + return $type === \ShipStream\Ups\Api\Model\SoldToAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SoldToAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SoldToAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SoldToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\SoldToAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SoldToAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('Town', $data)) { + $object->setTown($data['Town']); + unset($data['Town']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class SoldToAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SoldToAddress::class; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SoldToAddress::class; + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SoldToAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['Town'] = $data->getTown(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SoldToAddress::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SoldToAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SoldToPhoneNormalizer.php b/src/Api/Normalizer/SoldToPhoneNormalizer.php index 1265885e..9232c001 100644 --- a/src/Api/Normalizer/SoldToPhoneNormalizer.php +++ b/src/Api/Normalizer/SoldToPhoneNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SoldToPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SoldToPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SoldToPhone::class; + return $type === \ShipStream\Ups\Api\Model\SoldToPhone::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SoldToPhone::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SoldToPhone::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SoldToPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); - } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SoldToPhone(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Number', $data)) { + $object->setNumber($data['Number']); + unset($data['Number']); + } + if (\array_key_exists('Extension', $data)) { + $object->setExtension($data['Extension']); + unset($data['Extension']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SoldToPhone::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class SoldToPhoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SoldToPhone::class; + $dataArray = []; + $dataArray['Number'] = $data->getNumber(); + if ($data->isInitialized('extension') && null !== $data->getExtension()) { + $dataArray['Extension'] = $data->getExtension(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SoldToPhone::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SoldToPhone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Number', $data)) { - $object->setNumber($data['Number']); - unset($data['Number']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Extension', $data)) { - $object->setExtension($data['Extension']); - unset($data['Extension']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Number'] = $object->getNumber(); - if ($object->isInitialized('extension') && null !== $object->getExtension()) { - $data['Extension'] = $object->getExtension(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SoldToPhone::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SoldToPhone::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/StandardHoursDayOfWeekNormalizer.php b/src/Api/Normalizer/StandardHoursDayOfWeekNormalizer.php index 034acf5d..72839f4b 100644 --- a/src/Api/Normalizer/StandardHoursDayOfWeekNormalizer.php +++ b/src/Api/Normalizer/StandardHoursDayOfWeekNormalizer.php @@ -5,254 +5,126 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class StandardHoursDayOfWeekNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class StandardHoursDayOfWeekNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class; + return $type === \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Day', $data)) { - $object->setDay($data['Day']); - unset($data['Day']); - } - if (\array_key_exists('OpenHours', $data) && $data['OpenHours'] !== null) { - $values = []; - foreach ($data['OpenHours'] as $value) { - $values[] = $value; - } - $object->setOpenHours($values); - unset($data['OpenHours']); - } - elseif (\array_key_exists('OpenHours', $data) && $data['OpenHours'] === null) { - $object->setOpenHours(null); - } - if (\array_key_exists('CloseHours', $data) && $data['CloseHours'] !== null) { - $values_1 = []; - foreach ($data['CloseHours'] as $value_1) { - $values_1[] = $value_1; - } - $object->setCloseHours($values_1); - unset($data['CloseHours']); - } - elseif (\array_key_exists('CloseHours', $data) && $data['CloseHours'] === null) { - $object->setCloseHours(null); - } - if (\array_key_exists('LatestDropOffHours', $data)) { - $object->setLatestDropOffHours($data['LatestDropOffHours']); - unset($data['LatestDropOffHours']); - } - if (\array_key_exists('PrepHours', $data)) { - $object->setPrepHours($data['PrepHours']); - unset($data['PrepHours']); - } - if (\array_key_exists('ClosedIndicator', $data)) { - $object->setClosedIndicator($data['ClosedIndicator']); - unset($data['ClosedIndicator']); - } - if (\array_key_exists('Open24HoursIndicator', $data)) { - $object->setOpen24HoursIndicator($data['Open24HoursIndicator']); - unset($data['Open24HoursIndicator']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Day'] = $object->getDay(); - if ($object->isInitialized('openHours') && null !== $object->getOpenHours()) { - $values = []; - foreach ($object->getOpenHours() as $value) { - $values[] = $value; - } - $data['OpenHours'] = $values; - } - if ($object->isInitialized('closeHours') && null !== $object->getCloseHours()) { - $values_1 = []; - foreach ($object->getCloseHours() as $value_1) { - $values_1[] = $value_1; - } - $data['CloseHours'] = $values_1; - } - if ($object->isInitialized('latestDropOffHours') && null !== $object->getLatestDropOffHours()) { - $data['LatestDropOffHours'] = $object->getLatestDropOffHours(); - } - if ($object->isInitialized('prepHours') && null !== $object->getPrepHours()) { - $data['PrepHours'] = $object->getPrepHours(); - } - if ($object->isInitialized('closedIndicator') && null !== $object->getClosedIndicator()) { - $data['ClosedIndicator'] = $object->getClosedIndicator(); - } - if ($object->isInitialized('open24HoursIndicator') && null !== $object->getOpen24HoursIndicator()) { - $data['Open24HoursIndicator'] = $object->getOpen24HoursIndicator(); + if (\array_key_exists('Day', $data)) { + $object->setDay($data['Day']); + unset($data['Day']); + } + if (\array_key_exists('OpenHours', $data) && $data['OpenHours'] !== null) { + $values = []; + foreach ($data['OpenHours'] as $value) { + $values[] = $value; } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setOpenHours($values); + unset($data['OpenHours']); + } + elseif (\array_key_exists('OpenHours', $data) && $data['OpenHours'] === null) { + $object->setOpenHours(null); + } + if (\array_key_exists('CloseHours', $data) && $data['CloseHours'] !== null) { + $values_1 = []; + foreach ($data['CloseHours'] as $value_1) { + $values_1[] = $value_1; } - return $data; + $object->setCloseHours($values_1); + unset($data['CloseHours']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class => false]; + elseif (\array_key_exists('CloseHours', $data) && $data['CloseHours'] === null) { + $object->setCloseHours(null); } - } -} else { - class StandardHoursDayOfWeekNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class; + if (\array_key_exists('LatestDropOffHours', $data)) { + $object->setLatestDropOffHours($data['LatestDropOffHours']); + unset($data['LatestDropOffHours']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class; + if (\array_key_exists('PrepHours', $data)) { + $object->setPrepHours($data['PrepHours']); + unset($data['PrepHours']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\StandardHoursDayOfWeek(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Day', $data)) { - $object->setDay($data['Day']); - unset($data['Day']); - } - if (\array_key_exists('OpenHours', $data) && $data['OpenHours'] !== null) { - $values = []; - foreach ($data['OpenHours'] as $value) { - $values[] = $value; - } - $object->setOpenHours($values); - unset($data['OpenHours']); - } - elseif (\array_key_exists('OpenHours', $data) && $data['OpenHours'] === null) { - $object->setOpenHours(null); - } - if (\array_key_exists('CloseHours', $data) && $data['CloseHours'] !== null) { - $values_1 = []; - foreach ($data['CloseHours'] as $value_1) { - $values_1[] = $value_1; - } - $object->setCloseHours($values_1); - unset($data['CloseHours']); - } - elseif (\array_key_exists('CloseHours', $data) && $data['CloseHours'] === null) { - $object->setCloseHours(null); - } - if (\array_key_exists('LatestDropOffHours', $data)) { - $object->setLatestDropOffHours($data['LatestDropOffHours']); - unset($data['LatestDropOffHours']); - } - if (\array_key_exists('PrepHours', $data)) { - $object->setPrepHours($data['PrepHours']); - unset($data['PrepHours']); - } - if (\array_key_exists('ClosedIndicator', $data)) { - $object->setClosedIndicator($data['ClosedIndicator']); - unset($data['ClosedIndicator']); - } - if (\array_key_exists('Open24HoursIndicator', $data)) { - $object->setOpen24HoursIndicator($data['Open24HoursIndicator']); - unset($data['Open24HoursIndicator']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + if (\array_key_exists('ClosedIndicator', $data)) { + $object->setClosedIndicator($data['ClosedIndicator']); + unset($data['ClosedIndicator']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Day'] = $object->getDay(); - if ($object->isInitialized('openHours') && null !== $object->getOpenHours()) { - $values = []; - foreach ($object->getOpenHours() as $value) { - $values[] = $value; - } - $data['OpenHours'] = $values; - } - if ($object->isInitialized('closeHours') && null !== $object->getCloseHours()) { - $values_1 = []; - foreach ($object->getCloseHours() as $value_1) { - $values_1[] = $value_1; - } - $data['CloseHours'] = $values_1; - } - if ($object->isInitialized('latestDropOffHours') && null !== $object->getLatestDropOffHours()) { - $data['LatestDropOffHours'] = $object->getLatestDropOffHours(); - } - if ($object->isInitialized('prepHours') && null !== $object->getPrepHours()) { - $data['PrepHours'] = $object->getPrepHours(); - } - if ($object->isInitialized('closedIndicator') && null !== $object->getClosedIndicator()) { - $data['ClosedIndicator'] = $object->getClosedIndicator(); - } - if ($object->isInitialized('open24HoursIndicator') && null !== $object->getOpen24HoursIndicator()) { - $data['Open24HoursIndicator'] = $object->getOpen24HoursIndicator(); + if (\array_key_exists('Open24HoursIndicator', $data)) { + $object->setOpen24HoursIndicator($data['Open24HoursIndicator']); + unset($data['Open24HoursIndicator']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Day'] = $data->getDay(); + if ($data->isInitialized('openHours')) { + $values = []; + foreach ($data->getOpenHours() as $value) { + $values[] = $value; + } + $dataArray['OpenHours'] = $values; + } + if ($data->isInitialized('closeHours')) { + $values_1 = []; + foreach ($data->getCloseHours() as $value_1) { + $values_1[] = $value_1; } - return $data; + $dataArray['CloseHours'] = $values_1; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class => false]; + if ($data->isInitialized('latestDropOffHours') && null !== $data->getLatestDropOffHours()) { + $dataArray['LatestDropOffHours'] = $data->getLatestDropOffHours(); } + if ($data->isInitialized('prepHours') && null !== $data->getPrepHours()) { + $dataArray['PrepHours'] = $data->getPrepHours(); + } + if ($data->isInitialized('closedIndicator') && null !== $data->getClosedIndicator()) { + $dataArray['ClosedIndicator'] = $data->getClosedIndicator(); + } + if ($data->isInitialized('open24HoursIndicator') && null !== $data->getOpen24HoursIndicator()) { + $dataArray['Open24HoursIndicator'] = $data->getOpen24HoursIndicator(); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\StandardHoursDayOfWeek::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/StatusNormalizer.php b/src/Api/Normalizer/StatusNormalizer.php index 689d3de5..3e90dc26 100644 --- a/src/Api/Normalizer/StatusNormalizer.php +++ b/src/Api/Normalizer/StatusNormalizer.php @@ -5,198 +5,98 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class StatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class StatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Status::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Status::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Status(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('code', $data) && $data['code'] !== null) { - $object->setCode($data['code']); - unset($data['code']); - } - elseif (\array_key_exists('code', $data) && $data['code'] === null) { - $object->setCode(null); - } - if (\array_key_exists('description', $data) && $data['description'] !== null) { - $object->setDescription($data['description']); - unset($data['description']); - } - elseif (\array_key_exists('description', $data) && $data['description'] === null) { - $object->setDescription(null); - } - if (\array_key_exists('simplifiedTextDescription', $data)) { - $object->setSimplifiedTextDescription($data['simplifiedTextDescription']); - unset($data['simplifiedTextDescription']); - } - if (\array_key_exists('statusCode', $data)) { - $object->setStatusCode($data['statusCode']); - unset($data['statusCode']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\Status::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Status::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\Status(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('simplifiedTextDescription') && null !== $object->getSimplifiedTextDescription()) { - $data['simplifiedTextDescription'] = $object->getSimplifiedTextDescription(); - } - if ($object->isInitialized('statusCode') && null !== $object->getStatusCode()) { - $data['statusCode'] = $object->getStatusCode(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('code', $data) && $data['code'] !== null) { + $object->setCode($data['code']); + unset($data['code']); + } + elseif (\array_key_exists('code', $data) && $data['code'] === null) { + $object->setCode(null); + } + if (\array_key_exists('description', $data) && $data['description'] !== null) { + $object->setDescription($data['description']); + unset($data['description']); + } + elseif (\array_key_exists('description', $data) && $data['description'] === null) { + $object->setDescription(null); + } + if (\array_key_exists('simplifiedTextDescription', $data)) { + $object->setSimplifiedTextDescription($data['simplifiedTextDescription']); + unset($data['simplifiedTextDescription']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Status::class => false]; + if (\array_key_exists('statusCode', $data)) { + $object->setStatusCode($data['statusCode']); + unset($data['statusCode']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class StatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Status::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Status::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Status(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('code', $data) && $data['code'] !== null) { - $object->setCode($data['code']); - unset($data['code']); - } - elseif (\array_key_exists('code', $data) && $data['code'] === null) { - $object->setCode(null); - } - if (\array_key_exists('description', $data) && $data['description'] !== null) { - $object->setDescription($data['description']); - unset($data['description']); - } - elseif (\array_key_exists('description', $data) && $data['description'] === null) { - $object->setDescription(null); - } - if (\array_key_exists('simplifiedTextDescription', $data)) { - $object->setSimplifiedTextDescription($data['simplifiedTextDescription']); - unset($data['simplifiedTextDescription']); - } - if (\array_key_exists('statusCode', $data)) { - $object->setStatusCode($data['statusCode']); - unset($data['statusCode']); - } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('code')) { + $dataArray['code'] = $data->getCode(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('simplifiedTextDescription') && null !== $object->getSimplifiedTextDescription()) { - $data['simplifiedTextDescription'] = $object->getSimplifiedTextDescription(); - } - if ($object->isInitialized('statusCode') && null !== $object->getStatusCode()) { - $data['statusCode'] = $object->getStatusCode(); - } - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['type'] = $object->getType(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('description')) { + $dataArray['description'] = $data->getDescription(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Status::class => false]; + if ($data->isInitialized('simplifiedTextDescription') && null !== $data->getSimplifiedTextDescription()) { + $dataArray['simplifiedTextDescription'] = $data->getSimplifiedTextDescription(); } + if ($data->isInitialized('statusCode') && null !== $data->getStatusCode()) { + $dataArray['statusCode'] = $data->getStatusCode(); + } + if ($data->isInitialized('type') && null !== $data->getType()) { + $dataArray['type'] = $data->getType(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Status::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SubMilestoneNormalizer.php b/src/Api/Normalizer/SubMilestoneNormalizer.php index 77d476f8..9c5f02b6 100644 --- a/src/Api/Normalizer/SubMilestoneNormalizer.php +++ b/src/Api/Normalizer/SubMilestoneNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubMilestoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SubMilestoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubMilestone::class; + return $type === \ShipStream\Ups\Api\Model\SubMilestone::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubMilestone::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubMilestone::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubMilestone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('category', $data)) { - $object->setCategory($data['category']); - unset($data['category']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SubMilestone(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('category') && null !== $object->getCategory()) { - $data['category'] = $object->getCategory(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('category', $data)) { + $object->setCategory($data['category']); + unset($data['category']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubMilestone::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class SubMilestoneNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubMilestone::class; + $dataArray = []; + if ($data->isInitialized('category') && null !== $data->getCategory()) { + $dataArray['category'] = $data->getCategory(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubMilestone::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubMilestone(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('category', $data)) { - $object->setCategory($data['category']); - unset($data['category']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('category') && null !== $object->getCategory()) { - $data['category'] = $object->getCategory(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubMilestone::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SubMilestone::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SubscriptionEventsDateRangeNormalizer.php b/src/Api/Normalizer/SubscriptionEventsDateRangeNormalizer.php index bd35aa31..d02b6483 100644 --- a/src/Api/Normalizer/SubscriptionEventsDateRangeNormalizer.php +++ b/src/Api/Normalizer/SubscriptionEventsDateRangeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionEventsDateRangeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SubscriptionEventsDateRangeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class; + return $type === \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BeginDate', $data)) { - $object->setBeginDate($data['BeginDate']); - unset($data['BeginDate']); - } - if (\array_key_exists('EndDate', $data)) { - $object->setEndDate($data['EndDate']); - unset($data['EndDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['BeginDate'] = $object->getBeginDate(); - if ($object->isInitialized('endDate') && null !== $object->getEndDate()) { - $data['EndDate'] = $object->getEndDate(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('BeginDate', $data)) { + $object->setBeginDate($data['BeginDate']); + unset($data['BeginDate']); + } + if (\array_key_exists('EndDate', $data)) { + $object->setEndDate($data['EndDate']); + unset($data['EndDate']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class SubscriptionEventsDateRangeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class; + $dataArray = []; + $dataArray['BeginDate'] = $data->getBeginDate(); + if ($data->isInitialized('endDate') && null !== $data->getEndDate()) { + $dataArray['EndDate'] = $data->getEndDate(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionEventsDateRange(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BeginDate', $data)) { - $object->setBeginDate($data['BeginDate']); - unset($data['BeginDate']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('EndDate', $data)) { - $object->setEndDate($data['EndDate']); - unset($data['EndDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['BeginDate'] = $object->getBeginDate(); - if ($object->isInitialized('endDate') && null !== $object->getEndDate()) { - $data['EndDate'] = $object->getEndDate(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SubscriptionEventsDateRange::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SubscriptionEventsSubscriptionFileNormalizer.php b/src/Api/Normalizer/SubscriptionEventsSubscriptionFileNormalizer.php index ba4d38ef..7c862569 100644 --- a/src/Api/Normalizer/SubscriptionEventsSubscriptionFileNormalizer.php +++ b/src/Api/Normalizer/SubscriptionEventsSubscriptionFileNormalizer.php @@ -5,286 +5,142 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionEventsSubscriptionFileNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SubscriptionEventsSubscriptionFileNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class; + return $type === \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FileName', $data)) { - $object->setFileName($data['FileName']); - unset($data['FileName']); - } - if (\array_key_exists('StatusType', $data)) { - $object->setStatusType($this->denormalizer->denormalize($data['StatusType'], \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class, 'json', $context)); - unset($data['StatusType']); - } - if (\array_key_exists('Manifest', $data)) { - $values = []; - foreach ($data['Manifest'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class, 'json', $context); - } - $object->setManifest($values); - unset($data['Manifest']); - } - if (\array_key_exists('Origin', $data)) { - $values_1 = []; - foreach ($data['Origin'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class, 'json', $context); - } - $object->setOrigin($values_1); - unset($data['Origin']); - } - if (\array_key_exists('Exception', $data)) { - $values_2 = []; - foreach ($data['Exception'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\SubscriptionFileException::class, 'json', $context); - } - $object->setException($values_2); - unset($data['Exception']); - } - if (\array_key_exists('Delivery', $data)) { - $values_3 = []; - foreach ($data['Delivery'] as $value_3) { - $values_3[] = $this->denormalizer->denormalize($value_3, \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class, 'json', $context); - } - $object->setDelivery($values_3); - unset($data['Delivery']); - } - if (\array_key_exists('Generic', $data)) { - $values_4 = []; - foreach ($data['Generic'] as $value_4) { - $values_4[] = $this->denormalizer->denormalize($value_4, \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class, 'json', $context); - } - $object->setGeneric($values_4); - unset($data['Generic']); - } - foreach ($data as $key => $value_5) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_5; - } - } + $object = new \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['FileName'] = $object->getFileName(); - $data['StatusType'] = $this->normalizer->normalize($object->getStatusType(), 'json', $context); - if ($object->isInitialized('manifest') && null !== $object->getManifest()) { - $values = []; - foreach ($object->getManifest() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Manifest'] = $values; - } - if ($object->isInitialized('origin') && null !== $object->getOrigin()) { - $values_1 = []; - foreach ($object->getOrigin() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Origin'] = $values_1; + if (\array_key_exists('FileName', $data)) { + $object->setFileName($data['FileName']); + unset($data['FileName']); + } + if (\array_key_exists('StatusType', $data)) { + $object->setStatusType($this->denormalizer->denormalize($data['StatusType'], \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class, 'json', $context)); + unset($data['StatusType']); + } + if (\array_key_exists('Manifest', $data)) { + $values = []; + foreach ($data['Manifest'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class, 'json', $context); } - if ($object->isInitialized('exception') && null !== $object->getException()) { - $values_2 = []; - foreach ($object->getException() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['Exception'] = $values_2; + $object->setManifest($values); + unset($data['Manifest']); + } + if (\array_key_exists('Origin', $data)) { + $values_1 = []; + foreach ($data['Origin'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class, 'json', $context); } - if ($object->isInitialized('delivery') && null !== $object->getDelivery()) { - $values_3 = []; - foreach ($object->getDelivery() as $value_3) { - $values_3[] = $this->normalizer->normalize($value_3, 'json', $context); - } - $data['Delivery'] = $values_3; + $object->setOrigin($values_1); + unset($data['Origin']); + } + if (\array_key_exists('Exception', $data)) { + $values_2 = []; + foreach ($data['Exception'] as $value_2) { + $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\SubscriptionFileException::class, 'json', $context); } - if ($object->isInitialized('generic') && null !== $object->getGeneric()) { - $values_4 = []; - foreach ($object->getGeneric() as $value_4) { - $values_4[] = $this->normalizer->normalize($value_4, 'json', $context); - } - $data['Generic'] = $values_4; + $object->setException($values_2); + unset($data['Exception']); + } + if (\array_key_exists('Delivery', $data)) { + $values_3 = []; + foreach ($data['Delivery'] as $value_3) { + $values_3[] = $this->denormalizer->denormalize($value_3, \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class, 'json', $context); } - foreach ($object as $key => $value_5) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_5; - } + $object->setDelivery($values_3); + unset($data['Delivery']); + } + if (\array_key_exists('Generic', $data)) { + $values_4 = []; + foreach ($data['Generic'] as $value_4) { + $values_4[] = $this->denormalizer->denormalize($value_4, \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class, 'json', $context); } - return $data; + $object->setGeneric($values_4); + unset($data['Generic']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class => false]; + foreach ($data as $key => $value_5) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_5; + } } + return $object; } -} else { - class SubscriptionEventsSubscriptionFileNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class; + $dataArray = []; + $dataArray['FileName'] = $data->getFileName(); + $dataArray['StatusType'] = $this->normalizer->normalize($data->getStatusType(), 'json', $context); + if ($data->isInitialized('manifest') && null !== $data->getManifest()) { + $values = []; + foreach ($data->getManifest() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Manifest'] = $values; } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('FileName', $data)) { - $object->setFileName($data['FileName']); - unset($data['FileName']); - } - if (\array_key_exists('StatusType', $data)) { - $object->setStatusType($this->denormalizer->denormalize($data['StatusType'], \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class, 'json', $context)); - unset($data['StatusType']); - } - if (\array_key_exists('Manifest', $data)) { - $values = []; - foreach ($data['Manifest'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class, 'json', $context); - } - $object->setManifest($values); - unset($data['Manifest']); - } - if (\array_key_exists('Origin', $data)) { - $values_1 = []; - foreach ($data['Origin'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class, 'json', $context); - } - $object->setOrigin($values_1); - unset($data['Origin']); - } - if (\array_key_exists('Exception', $data)) { - $values_2 = []; - foreach ($data['Exception'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, \ShipStream\Ups\Api\Model\SubscriptionFileException::class, 'json', $context); - } - $object->setException($values_2); - unset($data['Exception']); - } - if (\array_key_exists('Delivery', $data)) { - $values_3 = []; - foreach ($data['Delivery'] as $value_3) { - $values_3[] = $this->denormalizer->denormalize($value_3, \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class, 'json', $context); - } - $object->setDelivery($values_3); - unset($data['Delivery']); - } - if (\array_key_exists('Generic', $data)) { - $values_4 = []; - foreach ($data['Generic'] as $value_4) { - $values_4[] = $this->denormalizer->denormalize($value_4, \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class, 'json', $context); - } - $object->setGeneric($values_4); - unset($data['Generic']); + if ($data->isInitialized('origin') && null !== $data->getOrigin()) { + $values_1 = []; + foreach ($data->getOrigin() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - foreach ($data as $key => $value_5) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_5; - } - } - return $object; + $dataArray['Origin'] = $values_1; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['FileName'] = $object->getFileName(); - $data['StatusType'] = $this->normalizer->normalize($object->getStatusType(), 'json', $context); - if ($object->isInitialized('manifest') && null !== $object->getManifest()) { - $values = []; - foreach ($object->getManifest() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Manifest'] = $values; - } - if ($object->isInitialized('origin') && null !== $object->getOrigin()) { - $values_1 = []; - foreach ($object->getOrigin() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Origin'] = $values_1; - } - if ($object->isInitialized('exception') && null !== $object->getException()) { - $values_2 = []; - foreach ($object->getException() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); - } - $data['Exception'] = $values_2; - } - if ($object->isInitialized('delivery') && null !== $object->getDelivery()) { - $values_3 = []; - foreach ($object->getDelivery() as $value_3) { - $values_3[] = $this->normalizer->normalize($value_3, 'json', $context); - } - $data['Delivery'] = $values_3; + if ($data->isInitialized('exception') && null !== $data->getException()) { + $values_2 = []; + foreach ($data->getException() as $value_2) { + $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); } - if ($object->isInitialized('generic') && null !== $object->getGeneric()) { - $values_4 = []; - foreach ($object->getGeneric() as $value_4) { - $values_4[] = $this->normalizer->normalize($value_4, 'json', $context); - } - $data['Generic'] = $values_4; + $dataArray['Exception'] = $values_2; + } + if ($data->isInitialized('delivery') && null !== $data->getDelivery()) { + $values_3 = []; + foreach ($data->getDelivery() as $value_3) { + $values_3[] = $this->normalizer->normalize($value_3, 'json', $context); } - foreach ($object as $key => $value_5) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_5; - } + $dataArray['Delivery'] = $values_3; + } + if ($data->isInitialized('generic') && null !== $data->getGeneric()) { + $values_4 = []; + foreach ($data->getGeneric() as $value_4) { + $values_4[] = $this->normalizer->normalize($value_4, 'json', $context); } - return $data; + $dataArray['Generic'] = $values_4; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class => false]; + foreach ($data as $key => $value_5) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_5; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionFile::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SubscriptionEventsSubscriptionStatusNormalizer.php b/src/Api/Normalizer/SubscriptionEventsSubscriptionStatusNormalizer.php index 07dd32b4..093d3928 100644 --- a/src/Api/Normalizer/SubscriptionEventsSubscriptionStatusNormalizer.php +++ b/src/Api/Normalizer/SubscriptionEventsSubscriptionStatusNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionEventsSubscriptionStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SubscriptionEventsSubscriptionStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class; + return $type === \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class SubscriptionEventsSubscriptionStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SubscriptionEventsSubscriptionStatus::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SubscriptionFileDeliveryNormalizer.php b/src/Api/Normalizer/SubscriptionFileDeliveryNormalizer.php index 0f383154..442a4fc2 100644 --- a/src/Api/Normalizer/SubscriptionFileDeliveryNormalizer.php +++ b/src/Api/Normalizer/SubscriptionFileDeliveryNormalizer.php @@ -5,314 +5,156 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionFileDeliveryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SubscriptionFileDeliveryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class; + return $type === \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionFileDelivery(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageReferenceNumber', $data)) { - $values = []; - foreach ($data['PackageReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class, 'json', $context); - } - $object->setPackageReferenceNumber($values); - unset($data['PackageReferenceNumber']); - } - if (\array_key_exists('ShipmentReferenceNumber', $data)) { - $values_1 = []; - foreach ($data['ShipmentReferenceNumber'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class, 'json', $context); - } - $object->setShipmentReferenceNumber($values_1); - unset($data['ShipmentReferenceNumber']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - if (\array_key_exists('DriverRelease', $data)) { - $object->setDriverRelease($data['DriverRelease']); - unset($data['DriverRelease']); - } - if (\array_key_exists('ActivityLocation', $data)) { - $object->setActivityLocation($this->denormalizer->denormalize($data['ActivityLocation'], \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class, 'json', $context)); - unset($data['ActivityLocation']); - } - if (\array_key_exists('DeliveryLocation', $data)) { - $object->setDeliveryLocation($this->denormalizer->denormalize($data['DeliveryLocation'], \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class, 'json', $context)); - unset($data['DeliveryLocation']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\DeliveryCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('BillToAccount', $data)) { - $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class, 'json', $context)); - unset($data['BillToAccount']); - } - if (\array_key_exists('LastPickupDate', $data)) { - $object->setLastPickupDate($data['LastPickupDate']); - unset($data['LastPickupDate']); - } - if (\array_key_exists('AccessPointLocationID', $data)) { - $object->setAccessPointLocationID($data['AccessPointLocationID']); - unset($data['AccessPointLocationID']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\SubscriptionFileDelivery(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('packageReferenceNumber') && null !== $object->getPackageReferenceNumber()) { - $values = []; - foreach ($object->getPackageReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PackageReferenceNumber'] = $values; - } - if ($object->isInitialized('shipmentReferenceNumber') && null !== $object->getShipmentReferenceNumber()) { - $values_1 = []; - foreach ($object->getShipmentReferenceNumber() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ShipmentReferenceNumber'] = $values_1; - } - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['TrackingNumber'] = $object->getTrackingNumber(); - $data['Date'] = $object->getDate(); - $data['Time'] = $object->getTime(); - if ($object->isInitialized('driverRelease') && null !== $object->getDriverRelease()) { - $data['DriverRelease'] = $object->getDriverRelease(); - } - if ($object->isInitialized('activityLocation') && null !== $object->getActivityLocation()) { - $data['ActivityLocation'] = $this->normalizer->normalize($object->getActivityLocation(), 'json', $context); - } - if ($object->isInitialized('deliveryLocation') && null !== $object->getDeliveryLocation()) { - $data['DeliveryLocation'] = $this->normalizer->normalize($object->getDeliveryLocation(), 'json', $context); + if (\array_key_exists('PackageReferenceNumber', $data)) { + $values = []; + foreach ($data['PackageReferenceNumber'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class, 'json', $context); } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('billToAccount') && null !== $object->getBillToAccount()) { - $data['BillToAccount'] = $this->normalizer->normalize($object->getBillToAccount(), 'json', $context); - } - if ($object->isInitialized('lastPickupDate') && null !== $object->getLastPickupDate()) { - $data['LastPickupDate'] = $object->getLastPickupDate(); - } - if ($object->isInitialized('accessPointLocationID') && null !== $object->getAccessPointLocationID()) { - $data['AccessPointLocationID'] = $object->getAccessPointLocationID(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setPackageReferenceNumber($values); + unset($data['PackageReferenceNumber']); + } + if (\array_key_exists('ShipmentReferenceNumber', $data)) { + $values_1 = []; + foreach ($data['ShipmentReferenceNumber'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class, 'json', $context); } - return $data; + $object->setShipmentReferenceNumber($values_1); + unset($data['ShipmentReferenceNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class => false]; + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); } - } -} else { - class SubscriptionFileDeliveryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class; + if (\array_key_exists('TrackingNumber', $data)) { + $object->setTrackingNumber($data['TrackingNumber']); + unset($data['TrackingNumber']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class; + if (\array_key_exists('Date', $data)) { + $object->setDate($data['Date']); + unset($data['Date']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionFileDelivery(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageReferenceNumber', $data)) { - $values = []; - foreach ($data['PackageReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\DeliveryPackageReferenceNumber::class, 'json', $context); - } - $object->setPackageReferenceNumber($values); - unset($data['PackageReferenceNumber']); - } - if (\array_key_exists('ShipmentReferenceNumber', $data)) { - $values_1 = []; - foreach ($data['ShipmentReferenceNumber'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\DeliveryShipmentReferenceNumber::class, 'json', $context); - } - $object->setShipmentReferenceNumber($values_1); - unset($data['ShipmentReferenceNumber']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - if (\array_key_exists('DriverRelease', $data)) { - $object->setDriverRelease($data['DriverRelease']); - unset($data['DriverRelease']); - } - if (\array_key_exists('ActivityLocation', $data)) { - $object->setActivityLocation($this->denormalizer->denormalize($data['ActivityLocation'], \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class, 'json', $context)); - unset($data['ActivityLocation']); - } - if (\array_key_exists('DeliveryLocation', $data)) { - $object->setDeliveryLocation($this->denormalizer->denormalize($data['DeliveryLocation'], \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class, 'json', $context)); - unset($data['DeliveryLocation']); - } - if (\array_key_exists('COD', $data)) { - $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\DeliveryCOD::class, 'json', $context)); - unset($data['COD']); - } - if (\array_key_exists('BillToAccount', $data)) { - $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class, 'json', $context)); - unset($data['BillToAccount']); - } - if (\array_key_exists('LastPickupDate', $data)) { - $object->setLastPickupDate($data['LastPickupDate']); - unset($data['LastPickupDate']); - } - if (\array_key_exists('AccessPointLocationID', $data)) { - $object->setAccessPointLocationID($data['AccessPointLocationID']); - unset($data['AccessPointLocationID']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + if (\array_key_exists('Time', $data)) { + $object->setTime($data['Time']); + unset($data['Time']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('packageReferenceNumber') && null !== $object->getPackageReferenceNumber()) { - $values = []; - foreach ($object->getPackageReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PackageReferenceNumber'] = $values; - } - if ($object->isInitialized('shipmentReferenceNumber') && null !== $object->getShipmentReferenceNumber()) { - $values_1 = []; - foreach ($object->getShipmentReferenceNumber() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ShipmentReferenceNumber'] = $values_1; - } - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['TrackingNumber'] = $object->getTrackingNumber(); - $data['Date'] = $object->getDate(); - $data['Time'] = $object->getTime(); - if ($object->isInitialized('driverRelease') && null !== $object->getDriverRelease()) { - $data['DriverRelease'] = $object->getDriverRelease(); - } - if ($object->isInitialized('activityLocation') && null !== $object->getActivityLocation()) { - $data['ActivityLocation'] = $this->normalizer->normalize($object->getActivityLocation(), 'json', $context); - } - if ($object->isInitialized('deliveryLocation') && null !== $object->getDeliveryLocation()) { - $data['DeliveryLocation'] = $this->normalizer->normalize($object->getDeliveryLocation(), 'json', $context); - } - if ($object->isInitialized('cOD') && null !== $object->getCOD()) { - $data['COD'] = $this->normalizer->normalize($object->getCOD(), 'json', $context); - } - if ($object->isInitialized('billToAccount') && null !== $object->getBillToAccount()) { - $data['BillToAccount'] = $this->normalizer->normalize($object->getBillToAccount(), 'json', $context); - } - if ($object->isInitialized('lastPickupDate') && null !== $object->getLastPickupDate()) { - $data['LastPickupDate'] = $object->getLastPickupDate(); + if (\array_key_exists('DriverRelease', $data)) { + $object->setDriverRelease($data['DriverRelease']); + unset($data['DriverRelease']); + } + if (\array_key_exists('ActivityLocation', $data)) { + $object->setActivityLocation($this->denormalizer->denormalize($data['ActivityLocation'], \ShipStream\Ups\Api\Model\DeliveryActivityLocation::class, 'json', $context)); + unset($data['ActivityLocation']); + } + if (\array_key_exists('DeliveryLocation', $data)) { + $object->setDeliveryLocation($this->denormalizer->denormalize($data['DeliveryLocation'], \ShipStream\Ups\Api\Model\DeliveryDeliveryLocation::class, 'json', $context)); + unset($data['DeliveryLocation']); + } + if (\array_key_exists('COD', $data)) { + $object->setCOD($this->denormalizer->denormalize($data['COD'], \ShipStream\Ups\Api\Model\DeliveryCOD::class, 'json', $context)); + unset($data['COD']); + } + if (\array_key_exists('BillToAccount', $data)) { + $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\DeliveryBillToAccount::class, 'json', $context)); + unset($data['BillToAccount']); + } + if (\array_key_exists('LastPickupDate', $data)) { + $object->setLastPickupDate($data['LastPickupDate']); + unset($data['LastPickupDate']); + } + if (\array_key_exists('AccessPointLocationID', $data)) { + $object->setAccessPointLocationID($data['AccessPointLocationID']); + unset($data['AccessPointLocationID']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; } - if ($object->isInitialized('accessPointLocationID') && null !== $object->getAccessPointLocationID()) { - $data['AccessPointLocationID'] = $object->getAccessPointLocationID(); + } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('packageReferenceNumber') && null !== $data->getPackageReferenceNumber()) { + $values = []; + foreach ($data->getPackageReferenceNumber() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $dataArray['PackageReferenceNumber'] = $values; + } + if ($data->isInitialized('shipmentReferenceNumber') && null !== $data->getShipmentReferenceNumber()) { + $values_1 = []; + foreach ($data->getShipmentReferenceNumber() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['ShipmentReferenceNumber'] = $values_1; + } + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + $dataArray['TrackingNumber'] = $data->getTrackingNumber(); + $dataArray['Date'] = $data->getDate(); + $dataArray['Time'] = $data->getTime(); + if ($data->isInitialized('driverRelease') && null !== $data->getDriverRelease()) { + $dataArray['DriverRelease'] = $data->getDriverRelease(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class => false]; + if ($data->isInitialized('activityLocation') && null !== $data->getActivityLocation()) { + $dataArray['ActivityLocation'] = $this->normalizer->normalize($data->getActivityLocation(), 'json', $context); } + if ($data->isInitialized('deliveryLocation') && null !== $data->getDeliveryLocation()) { + $dataArray['DeliveryLocation'] = $this->normalizer->normalize($data->getDeliveryLocation(), 'json', $context); + } + if ($data->isInitialized('cOD') && null !== $data->getCOD()) { + $dataArray['COD'] = $this->normalizer->normalize($data->getCOD(), 'json', $context); + } + if ($data->isInitialized('billToAccount') && null !== $data->getBillToAccount()) { + $dataArray['BillToAccount'] = $this->normalizer->normalize($data->getBillToAccount(), 'json', $context); + } + if ($data->isInitialized('lastPickupDate') && null !== $data->getLastPickupDate()) { + $dataArray['LastPickupDate'] = $data->getLastPickupDate(); + } + if ($data->isInitialized('accessPointLocationID') && null !== $data->getAccessPointLocationID()) { + $dataArray['AccessPointLocationID'] = $data->getAccessPointLocationID(); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SubscriptionFileDelivery::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SubscriptionFileExceptionNormalizer.php b/src/Api/Normalizer/SubscriptionFileExceptionNormalizer.php index caee47d0..c7759ca2 100644 --- a/src/Api/Normalizer/SubscriptionFileExceptionNormalizer.php +++ b/src/Api/Normalizer/SubscriptionFileExceptionNormalizer.php @@ -5,370 +5,184 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionFileExceptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SubscriptionFileExceptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionFileException::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileException::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionFileException(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageReferenceNumber', $data)) { - $values = []; - foreach ($data['PackageReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class, 'json', $context); - } - $object->setPackageReferenceNumber($values); - unset($data['PackageReferenceNumber']); - } - if (\array_key_exists('ShipmentReferenceNumber', $data)) { - $values_1 = []; - foreach ($data['ShipmentReferenceNumber'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class, 'json', $context); - } - $object->setShipmentReferenceNumber($values_1); - unset($data['ShipmentReferenceNumber']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - if (\array_key_exists('UpdatedAddress', $data)) { - $object->setUpdatedAddress($this->denormalizer->denormalize($data['UpdatedAddress'], \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class, 'json', $context)); - unset($data['UpdatedAddress']); - } - if (\array_key_exists('StatusCode', $data)) { - $object->setStatusCode($data['StatusCode']); - unset($data['StatusCode']); - } - if (\array_key_exists('StatusDescription', $data)) { - $object->setStatusDescription($data['StatusDescription']); - unset($data['StatusDescription']); - } - if (\array_key_exists('ReasonCode', $data)) { - $object->setReasonCode($data['ReasonCode']); - unset($data['ReasonCode']); - } - if (\array_key_exists('ReasonDescription', $data)) { - $object->setReasonDescription($data['ReasonDescription']); - unset($data['ReasonDescription']); - } - if (\array_key_exists('Resolution', $data)) { - $object->setResolution($this->denormalizer->denormalize($data['Resolution'], \ShipStream\Ups\Api\Model\ExceptionResolution::class, 'json', $context)); - unset($data['Resolution']); - } - if (\array_key_exists('RescheduledDeliveryDate', $data)) { - $object->setRescheduledDeliveryDate($data['RescheduledDeliveryDate']); - unset($data['RescheduledDeliveryDate']); - } - if (\array_key_exists('RescheduledDeliveryTime', $data)) { - $object->setRescheduledDeliveryTime($data['RescheduledDeliveryTime']); - unset($data['RescheduledDeliveryTime']); - } - if (\array_key_exists('ActivityLocation', $data)) { - $object->setActivityLocation($this->denormalizer->denormalize($data['ActivityLocation'], \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class, 'json', $context)); - unset($data['ActivityLocation']); - } - if (\array_key_exists('BillToAccount', $data)) { - $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class, 'json', $context)); - unset($data['BillToAccount']); - } - if (\array_key_exists('AccessPointLocationID', $data)) { - $object->setAccessPointLocationID($data['AccessPointLocationID']); - unset($data['AccessPointLocationID']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + return $type === \ShipStream\Ups\Api\Model\SubscriptionFileException::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileException::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\SubscriptionFileException(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('packageReferenceNumber') && null !== $object->getPackageReferenceNumber()) { - $values = []; - foreach ($object->getPackageReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PackageReferenceNumber'] = $values; - } - if ($object->isInitialized('shipmentReferenceNumber') && null !== $object->getShipmentReferenceNumber()) { - $values_1 = []; - foreach ($object->getShipmentReferenceNumber() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ShipmentReferenceNumber'] = $values_1; - } - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['TrackingNumber'] = $object->getTrackingNumber(); - $data['Date'] = $object->getDate(); - $data['Time'] = $object->getTime(); - if ($object->isInitialized('updatedAddress') && null !== $object->getUpdatedAddress()) { - $data['UpdatedAddress'] = $this->normalizer->normalize($object->getUpdatedAddress(), 'json', $context); - } - if ($object->isInitialized('statusCode') && null !== $object->getStatusCode()) { - $data['StatusCode'] = $object->getStatusCode(); - } - if ($object->isInitialized('statusDescription') && null !== $object->getStatusDescription()) { - $data['StatusDescription'] = $object->getStatusDescription(); - } - if ($object->isInitialized('reasonCode') && null !== $object->getReasonCode()) { - $data['ReasonCode'] = $object->getReasonCode(); - } - if ($object->isInitialized('reasonDescription') && null !== $object->getReasonDescription()) { - $data['ReasonDescription'] = $object->getReasonDescription(); - } - if ($object->isInitialized('resolution') && null !== $object->getResolution()) { - $data['Resolution'] = $this->normalizer->normalize($object->getResolution(), 'json', $context); - } - if ($object->isInitialized('rescheduledDeliveryDate') && null !== $object->getRescheduledDeliveryDate()) { - $data['RescheduledDeliveryDate'] = $object->getRescheduledDeliveryDate(); - } - if ($object->isInitialized('rescheduledDeliveryTime') && null !== $object->getRescheduledDeliveryTime()) { - $data['RescheduledDeliveryTime'] = $object->getRescheduledDeliveryTime(); - } - if ($object->isInitialized('activityLocation') && null !== $object->getActivityLocation()) { - $data['ActivityLocation'] = $this->normalizer->normalize($object->getActivityLocation(), 'json', $context); - } - if ($object->isInitialized('billToAccount') && null !== $object->getBillToAccount()) { - $data['BillToAccount'] = $this->normalizer->normalize($object->getBillToAccount(), 'json', $context); - } - if ($object->isInitialized('accessPointLocationID') && null !== $object->getAccessPointLocationID()) { - $data['AccessPointLocationID'] = $object->getAccessPointLocationID(); + if (\array_key_exists('PackageReferenceNumber', $data)) { + $values = []; + foreach ($data['PackageReferenceNumber'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setPackageReferenceNumber($values); + unset($data['PackageReferenceNumber']); + } + if (\array_key_exists('ShipmentReferenceNumber', $data)) { + $values_1 = []; + foreach ($data['ShipmentReferenceNumber'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class, 'json', $context); } - return $data; + $object->setShipmentReferenceNumber($values_1); + unset($data['ShipmentReferenceNumber']); + } + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); + } + if (\array_key_exists('TrackingNumber', $data)) { + $object->setTrackingNumber($data['TrackingNumber']); + unset($data['TrackingNumber']); + } + if (\array_key_exists('Date', $data)) { + $object->setDate($data['Date']); + unset($data['Date']); + } + if (\array_key_exists('Time', $data)) { + $object->setTime($data['Time']); + unset($data['Time']); + } + if (\array_key_exists('UpdatedAddress', $data)) { + $object->setUpdatedAddress($this->denormalizer->denormalize($data['UpdatedAddress'], \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class, 'json', $context)); + unset($data['UpdatedAddress']); + } + if (\array_key_exists('StatusCode', $data)) { + $object->setStatusCode($data['StatusCode']); + unset($data['StatusCode']); + } + if (\array_key_exists('StatusDescription', $data)) { + $object->setStatusDescription($data['StatusDescription']); + unset($data['StatusDescription']); + } + if (\array_key_exists('ReasonCode', $data)) { + $object->setReasonCode($data['ReasonCode']); + unset($data['ReasonCode']); + } + if (\array_key_exists('ReasonDescription', $data)) { + $object->setReasonDescription($data['ReasonDescription']); + unset($data['ReasonDescription']); + } + if (\array_key_exists('Resolution', $data)) { + $object->setResolution($this->denormalizer->denormalize($data['Resolution'], \ShipStream\Ups\Api\Model\ExceptionResolution::class, 'json', $context)); + unset($data['Resolution']); + } + if (\array_key_exists('RescheduledDeliveryDate', $data)) { + $object->setRescheduledDeliveryDate($data['RescheduledDeliveryDate']); + unset($data['RescheduledDeliveryDate']); + } + if (\array_key_exists('RescheduledDeliveryTime', $data)) { + $object->setRescheduledDeliveryTime($data['RescheduledDeliveryTime']); + unset($data['RescheduledDeliveryTime']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionFileException::class => false]; + if (\array_key_exists('ActivityLocation', $data)) { + $object->setActivityLocation($this->denormalizer->denormalize($data['ActivityLocation'], \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class, 'json', $context)); + unset($data['ActivityLocation']); } + if (\array_key_exists('BillToAccount', $data)) { + $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class, 'json', $context)); + unset($data['BillToAccount']); + } + if (\array_key_exists('AccessPointLocationID', $data)) { + $object->setAccessPointLocationID($data['AccessPointLocationID']); + unset($data['AccessPointLocationID']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } -} else { - class SubscriptionFileExceptionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionFileException::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileException::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionFileException(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageReferenceNumber', $data)) { - $values = []; - foreach ($data['PackageReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ExceptionPackageReferenceNumber::class, 'json', $context); - } - $object->setPackageReferenceNumber($values); - unset($data['PackageReferenceNumber']); - } - if (\array_key_exists('ShipmentReferenceNumber', $data)) { - $values_1 = []; - foreach ($data['ShipmentReferenceNumber'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ExceptionShipmentReferenceNumber::class, 'json', $context); - } - $object->setShipmentReferenceNumber($values_1); - unset($data['ShipmentReferenceNumber']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - if (\array_key_exists('UpdatedAddress', $data)) { - $object->setUpdatedAddress($this->denormalizer->denormalize($data['UpdatedAddress'], \ShipStream\Ups\Api\Model\ExceptionUpdatedAddress::class, 'json', $context)); - unset($data['UpdatedAddress']); + $dataArray = []; + if ($data->isInitialized('packageReferenceNumber') && null !== $data->getPackageReferenceNumber()) { + $values = []; + foreach ($data->getPackageReferenceNumber() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - if (\array_key_exists('StatusCode', $data)) { - $object->setStatusCode($data['StatusCode']); - unset($data['StatusCode']); - } - if (\array_key_exists('StatusDescription', $data)) { - $object->setStatusDescription($data['StatusDescription']); - unset($data['StatusDescription']); - } - if (\array_key_exists('ReasonCode', $data)) { - $object->setReasonCode($data['ReasonCode']); - unset($data['ReasonCode']); - } - if (\array_key_exists('ReasonDescription', $data)) { - $object->setReasonDescription($data['ReasonDescription']); - unset($data['ReasonDescription']); - } - if (\array_key_exists('Resolution', $data)) { - $object->setResolution($this->denormalizer->denormalize($data['Resolution'], \ShipStream\Ups\Api\Model\ExceptionResolution::class, 'json', $context)); - unset($data['Resolution']); - } - if (\array_key_exists('RescheduledDeliveryDate', $data)) { - $object->setRescheduledDeliveryDate($data['RescheduledDeliveryDate']); - unset($data['RescheduledDeliveryDate']); - } - if (\array_key_exists('RescheduledDeliveryTime', $data)) { - $object->setRescheduledDeliveryTime($data['RescheduledDeliveryTime']); - unset($data['RescheduledDeliveryTime']); - } - if (\array_key_exists('ActivityLocation', $data)) { - $object->setActivityLocation($this->denormalizer->denormalize($data['ActivityLocation'], \ShipStream\Ups\Api\Model\ExceptionActivityLocation::class, 'json', $context)); - unset($data['ActivityLocation']); - } - if (\array_key_exists('BillToAccount', $data)) { - $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\ExceptionBillToAccount::class, 'json', $context)); - unset($data['BillToAccount']); - } - if (\array_key_exists('AccessPointLocationID', $data)) { - $object->setAccessPointLocationID($data['AccessPointLocationID']); - unset($data['AccessPointLocationID']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray['PackageReferenceNumber'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('packageReferenceNumber') && null !== $object->getPackageReferenceNumber()) { - $values = []; - foreach ($object->getPackageReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PackageReferenceNumber'] = $values; - } - if ($object->isInitialized('shipmentReferenceNumber') && null !== $object->getShipmentReferenceNumber()) { - $values_1 = []; - foreach ($object->getShipmentReferenceNumber() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ShipmentReferenceNumber'] = $values_1; + if ($data->isInitialized('shipmentReferenceNumber') && null !== $data->getShipmentReferenceNumber()) { + $values_1 = []; + foreach ($data->getShipmentReferenceNumber() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['TrackingNumber'] = $object->getTrackingNumber(); - $data['Date'] = $object->getDate(); - $data['Time'] = $object->getTime(); - if ($object->isInitialized('updatedAddress') && null !== $object->getUpdatedAddress()) { - $data['UpdatedAddress'] = $this->normalizer->normalize($object->getUpdatedAddress(), 'json', $context); - } - if ($object->isInitialized('statusCode') && null !== $object->getStatusCode()) { - $data['StatusCode'] = $object->getStatusCode(); - } - if ($object->isInitialized('statusDescription') && null !== $object->getStatusDescription()) { - $data['StatusDescription'] = $object->getStatusDescription(); - } - if ($object->isInitialized('reasonCode') && null !== $object->getReasonCode()) { - $data['ReasonCode'] = $object->getReasonCode(); - } - if ($object->isInitialized('reasonDescription') && null !== $object->getReasonDescription()) { - $data['ReasonDescription'] = $object->getReasonDescription(); - } - if ($object->isInitialized('resolution') && null !== $object->getResolution()) { - $data['Resolution'] = $this->normalizer->normalize($object->getResolution(), 'json', $context); - } - if ($object->isInitialized('rescheduledDeliveryDate') && null !== $object->getRescheduledDeliveryDate()) { - $data['RescheduledDeliveryDate'] = $object->getRescheduledDeliveryDate(); - } - if ($object->isInitialized('rescheduledDeliveryTime') && null !== $object->getRescheduledDeliveryTime()) { - $data['RescheduledDeliveryTime'] = $object->getRescheduledDeliveryTime(); - } - if ($object->isInitialized('activityLocation') && null !== $object->getActivityLocation()) { - $data['ActivityLocation'] = $this->normalizer->normalize($object->getActivityLocation(), 'json', $context); - } - if ($object->isInitialized('billToAccount') && null !== $object->getBillToAccount()) { - $data['BillToAccount'] = $this->normalizer->normalize($object->getBillToAccount(), 'json', $context); - } - if ($object->isInitialized('accessPointLocationID') && null !== $object->getAccessPointLocationID()) { - $data['AccessPointLocationID'] = $object->getAccessPointLocationID(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; + $dataArray['ShipmentReferenceNumber'] = $values_1; + } + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + $dataArray['TrackingNumber'] = $data->getTrackingNumber(); + $dataArray['Date'] = $data->getDate(); + $dataArray['Time'] = $data->getTime(); + if ($data->isInitialized('updatedAddress') && null !== $data->getUpdatedAddress()) { + $dataArray['UpdatedAddress'] = $this->normalizer->normalize($data->getUpdatedAddress(), 'json', $context); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionFileException::class => false]; + if ($data->isInitialized('statusCode') && null !== $data->getStatusCode()) { + $dataArray['StatusCode'] = $data->getStatusCode(); } + if ($data->isInitialized('statusDescription') && null !== $data->getStatusDescription()) { + $dataArray['StatusDescription'] = $data->getStatusDescription(); + } + if ($data->isInitialized('reasonCode') && null !== $data->getReasonCode()) { + $dataArray['ReasonCode'] = $data->getReasonCode(); + } + if ($data->isInitialized('reasonDescription') && null !== $data->getReasonDescription()) { + $dataArray['ReasonDescription'] = $data->getReasonDescription(); + } + if ($data->isInitialized('resolution') && null !== $data->getResolution()) { + $dataArray['Resolution'] = $this->normalizer->normalize($data->getResolution(), 'json', $context); + } + if ($data->isInitialized('rescheduledDeliveryDate') && null !== $data->getRescheduledDeliveryDate()) { + $dataArray['RescheduledDeliveryDate'] = $data->getRescheduledDeliveryDate(); + } + if ($data->isInitialized('rescheduledDeliveryTime') && null !== $data->getRescheduledDeliveryTime()) { + $dataArray['RescheduledDeliveryTime'] = $data->getRescheduledDeliveryTime(); + } + if ($data->isInitialized('activityLocation') && null !== $data->getActivityLocation()) { + $dataArray['ActivityLocation'] = $this->normalizer->normalize($data->getActivityLocation(), 'json', $context); + } + if ($data->isInitialized('billToAccount') && null !== $data->getBillToAccount()) { + $dataArray['BillToAccount'] = $this->normalizer->normalize($data->getBillToAccount(), 'json', $context); + } + if ($data->isInitialized('accessPointLocationID') && null !== $data->getAccessPointLocationID()) { + $dataArray['AccessPointLocationID'] = $data->getAccessPointLocationID(); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SubscriptionFileException::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SubscriptionFileGenericNormalizer.php b/src/Api/Normalizer/SubscriptionFileGenericNormalizer.php index d6b7c08f..c51d4e30 100644 --- a/src/Api/Normalizer/SubscriptionFileGenericNormalizer.php +++ b/src/Api/Normalizer/SubscriptionFileGenericNormalizer.php @@ -5,294 +5,146 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionFileGenericNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SubscriptionFileGenericNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class; + return $type === \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionFileGeneric(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ActivityType', $data)) { - $object->setActivityType($data['ActivityType']); - unset($data['ActivityType']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('ShipmentReferenceNumber', $data)) { - $values = []; - foreach ($data['ShipmentReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class, 'json', $context); - } - $object->setShipmentReferenceNumber($values); - unset($data['ShipmentReferenceNumber']); - } - if (\array_key_exists('PackageReferenceNumber', $data)) { - $values_1 = []; - foreach ($data['PackageReferenceNumber'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class, 'json', $context); - } - $object->setPackageReferenceNumber($values_1); - unset($data['PackageReferenceNumber']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\GenericService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('Activity', $data)) { - $object->setActivity($this->denormalizer->denormalize($data['Activity'], \ShipStream\Ups\Api\Model\GenericActivity::class, 'json', $context)); - unset($data['Activity']); - } - if (\array_key_exists('BillToAccount', $data)) { - $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\GenericBillToAccount::class, 'json', $context)); - unset($data['BillToAccount']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\GenericShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('RescheduledDeliveryDate', $data)) { - $object->setRescheduledDeliveryDate($data['RescheduledDeliveryDate']); - unset($data['RescheduledDeliveryDate']); - } - if (\array_key_exists('FailureNotification', $data)) { - $object->setFailureNotification($this->denormalizer->denormalize($data['FailureNotification'], \ShipStream\Ups\Api\Model\GenericFailureNotification::class, 'json', $context)); - unset($data['FailureNotification']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\SubscriptionFileGeneric(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ActivityType'] = $object->getActivityType(); - $data['TrackingNumber'] = $object->getTrackingNumber(); - if ($object->isInitialized('shipperNumber') && null !== $object->getShipperNumber()) { - $data['ShipperNumber'] = $object->getShipperNumber(); - } - if ($object->isInitialized('shipmentReferenceNumber') && null !== $object->getShipmentReferenceNumber()) { - $values = []; - foreach ($object->getShipmentReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ShipmentReferenceNumber'] = $values; - } - if ($object->isInitialized('packageReferenceNumber') && null !== $object->getPackageReferenceNumber()) { - $values_1 = []; - foreach ($object->getPackageReferenceNumber() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['PackageReferenceNumber'] = $values_1; - } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - } - if ($object->isInitialized('activity') && null !== $object->getActivity()) { - $data['Activity'] = $this->normalizer->normalize($object->getActivity(), 'json', $context); - } - if ($object->isInitialized('billToAccount') && null !== $object->getBillToAccount()) { - $data['BillToAccount'] = $this->normalizer->normalize($object->getBillToAccount(), 'json', $context); - } - if ($object->isInitialized('shipTo') && null !== $object->getShipTo()) { - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - } - if ($object->isInitialized('rescheduledDeliveryDate') && null !== $object->getRescheduledDeliveryDate()) { - $data['RescheduledDeliveryDate'] = $object->getRescheduledDeliveryDate(); - } - if ($object->isInitialized('failureNotification') && null !== $object->getFailureNotification()) { - $data['FailureNotification'] = $this->normalizer->normalize($object->getFailureNotification(), 'json', $context); + if (\array_key_exists('ActivityType', $data)) { + $object->setActivityType($data['ActivityType']); + unset($data['ActivityType']); + } + if (\array_key_exists('TrackingNumber', $data)) { + $object->setTrackingNumber($data['TrackingNumber']); + unset($data['TrackingNumber']); + } + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); + } + if (\array_key_exists('ShipmentReferenceNumber', $data)) { + $values = []; + foreach ($data['ShipmentReferenceNumber'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setShipmentReferenceNumber($values); + unset($data['ShipmentReferenceNumber']); + } + if (\array_key_exists('PackageReferenceNumber', $data)) { + $values_1 = []; + foreach ($data['PackageReferenceNumber'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class, 'json', $context); } - return $data; + $object->setPackageReferenceNumber($values_1); + unset($data['PackageReferenceNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class => false]; + if (\array_key_exists('Service', $data)) { + $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\GenericService::class, 'json', $context)); + unset($data['Service']); } - } -} else { - class SubscriptionFileGenericNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class; + if (\array_key_exists('Activity', $data)) { + $object->setActivity($this->denormalizer->denormalize($data['Activity'], \ShipStream\Ups\Api\Model\GenericActivity::class, 'json', $context)); + unset($data['Activity']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class; + if (\array_key_exists('BillToAccount', $data)) { + $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\GenericBillToAccount::class, 'json', $context)); + unset($data['BillToAccount']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionFileGeneric(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ActivityType', $data)) { - $object->setActivityType($data['ActivityType']); - unset($data['ActivityType']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('ShipmentReferenceNumber', $data)) { - $values = []; - foreach ($data['ShipmentReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\GenericShipmentReferenceNumber::class, 'json', $context); - } - $object->setShipmentReferenceNumber($values); - unset($data['ShipmentReferenceNumber']); - } - if (\array_key_exists('PackageReferenceNumber', $data)) { - $values_1 = []; - foreach ($data['PackageReferenceNumber'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\GenericPackageReferenceNumber::class, 'json', $context); - } - $object->setPackageReferenceNumber($values_1); - unset($data['PackageReferenceNumber']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\GenericService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('Activity', $data)) { - $object->setActivity($this->denormalizer->denormalize($data['Activity'], \ShipStream\Ups\Api\Model\GenericActivity::class, 'json', $context)); - unset($data['Activity']); - } - if (\array_key_exists('BillToAccount', $data)) { - $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\GenericBillToAccount::class, 'json', $context)); - unset($data['BillToAccount']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\GenericShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('RescheduledDeliveryDate', $data)) { - $object->setRescheduledDeliveryDate($data['RescheduledDeliveryDate']); - unset($data['RescheduledDeliveryDate']); - } - if (\array_key_exists('FailureNotification', $data)) { - $object->setFailureNotification($this->denormalizer->denormalize($data['FailureNotification'], \ShipStream\Ups\Api\Model\GenericFailureNotification::class, 'json', $context)); - unset($data['FailureNotification']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + if (\array_key_exists('ShipTo', $data)) { + $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\GenericShipTo::class, 'json', $context)); + unset($data['ShipTo']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ActivityType'] = $object->getActivityType(); - $data['TrackingNumber'] = $object->getTrackingNumber(); - if ($object->isInitialized('shipperNumber') && null !== $object->getShipperNumber()) { - $data['ShipperNumber'] = $object->getShipperNumber(); - } - if ($object->isInitialized('shipmentReferenceNumber') && null !== $object->getShipmentReferenceNumber()) { - $values = []; - foreach ($object->getShipmentReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ShipmentReferenceNumber'] = $values; - } - if ($object->isInitialized('packageReferenceNumber') && null !== $object->getPackageReferenceNumber()) { - $values_1 = []; - foreach ($object->getPackageReferenceNumber() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['PackageReferenceNumber'] = $values_1; - } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - } - if ($object->isInitialized('activity') && null !== $object->getActivity()) { - $data['Activity'] = $this->normalizer->normalize($object->getActivity(), 'json', $context); - } - if ($object->isInitialized('billToAccount') && null !== $object->getBillToAccount()) { - $data['BillToAccount'] = $this->normalizer->normalize($object->getBillToAccount(), 'json', $context); - } - if ($object->isInitialized('shipTo') && null !== $object->getShipTo()) { - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - } - if ($object->isInitialized('rescheduledDeliveryDate') && null !== $object->getRescheduledDeliveryDate()) { - $data['RescheduledDeliveryDate'] = $object->getRescheduledDeliveryDate(); + if (\array_key_exists('RescheduledDeliveryDate', $data)) { + $object->setRescheduledDeliveryDate($data['RescheduledDeliveryDate']); + unset($data['RescheduledDeliveryDate']); + } + if (\array_key_exists('FailureNotification', $data)) { + $object->setFailureNotification($this->denormalizer->denormalize($data['FailureNotification'], \ShipStream\Ups\Api\Model\GenericFailureNotification::class, 'json', $context)); + unset($data['FailureNotification']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; } - if ($object->isInitialized('failureNotification') && null !== $object->getFailureNotification()) { - $data['FailureNotification'] = $this->normalizer->normalize($object->getFailureNotification(), 'json', $context); + } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['ActivityType'] = $data->getActivityType(); + $dataArray['TrackingNumber'] = $data->getTrackingNumber(); + if ($data->isInitialized('shipperNumber') && null !== $data->getShipperNumber()) { + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + } + if ($data->isInitialized('shipmentReferenceNumber') && null !== $data->getShipmentReferenceNumber()) { + $values = []; + foreach ($data->getShipmentReferenceNumber() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $dataArray['ShipmentReferenceNumber'] = $values; + } + if ($data->isInitialized('packageReferenceNumber') && null !== $data->getPackageReferenceNumber()) { + $values_1 = []; + foreach ($data->getPackageReferenceNumber() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['PackageReferenceNumber'] = $values_1; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class => false]; + if ($data->isInitialized('service') && null !== $data->getService()) { + $dataArray['Service'] = $this->normalizer->normalize($data->getService(), 'json', $context); } + if ($data->isInitialized('activity') && null !== $data->getActivity()) { + $dataArray['Activity'] = $this->normalizer->normalize($data->getActivity(), 'json', $context); + } + if ($data->isInitialized('billToAccount') && null !== $data->getBillToAccount()) { + $dataArray['BillToAccount'] = $this->normalizer->normalize($data->getBillToAccount(), 'json', $context); + } + if ($data->isInitialized('shipTo') && null !== $data->getShipTo()) { + $dataArray['ShipTo'] = $this->normalizer->normalize($data->getShipTo(), 'json', $context); + } + if ($data->isInitialized('rescheduledDeliveryDate') && null !== $data->getRescheduledDeliveryDate()) { + $dataArray['RescheduledDeliveryDate'] = $data->getRescheduledDeliveryDate(); + } + if ($data->isInitialized('failureNotification') && null !== $data->getFailureNotification()) { + $dataArray['FailureNotification'] = $this->normalizer->normalize($data->getFailureNotification(), 'json', $context); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SubscriptionFileGeneric::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SubscriptionFileManifestNormalizer.php b/src/Api/Normalizer/SubscriptionFileManifestNormalizer.php index 8ee5d506..87c9f9e9 100644 --- a/src/Api/Normalizer/SubscriptionFileManifestNormalizer.php +++ b/src/Api/Normalizer/SubscriptionFileManifestNormalizer.php @@ -5,832 +5,415 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionFileManifestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SubscriptionFileManifestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionFileManifest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Shipper', $data)) { - $object->setShipper($this->denormalizer->denormalize($data['Shipper'], \ShipStream\Ups\Api\Model\ManifestShipper::class, 'json', $context)); - unset($data['Shipper']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\ManifestShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $values = []; - foreach ($data['ReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class, 'json', $context); - } - $object->setReferenceNumber($values); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ManifestService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - if (\array_key_exists('ScheduledDeliveryDate', $data)) { - $object->setScheduledDeliveryDate($data['ScheduledDeliveryDate']); - unset($data['ScheduledDeliveryDate']); - } - if (\array_key_exists('ScheduledDeliveryTime', $data)) { - $object->setScheduledDeliveryTime($data['ScheduledDeliveryTime']); - unset($data['ScheduledDeliveryTime']); - } - if (\array_key_exists('DocumentsOnly', $data)) { - $object->setDocumentsOnly($data['DocumentsOnly']); - unset($data['DocumentsOnly']); - } - if (\array_key_exists('Package', $data)) { - $values_1 = []; - foreach ($data['Package'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ManifestPackage::class, 'json', $context); - } - $object->setPackage($values_1); - unset($data['Package']); - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('ManufactureCountry', $data)) { - $object->setManufactureCountry($data['ManufactureCountry']); - unset($data['ManufactureCountry']); - } - if (\array_key_exists('HarmonizedCode', $data)) { - $object->setHarmonizedCode($data['HarmonizedCode']); - unset($data['HarmonizedCode']); - } - if (\array_key_exists('CustomsValue', $data)) { - $object->setCustomsValue($this->denormalizer->denormalize($data['CustomsValue'], \ShipStream\Ups\Api\Model\ManifestCustomsValue::class, 'json', $context)); - unset($data['CustomsValue']); - } - if (\array_key_exists('SpecialInstructions', $data)) { - $object->setSpecialInstructions($data['SpecialInstructions']); - unset($data['SpecialInstructions']); - } - if (\array_key_exists('ShipmentChargeType', $data)) { - $object->setShipmentChargeType($data['ShipmentChargeType']); - unset($data['ShipmentChargeType']); - } - if (\array_key_exists('BillToAccount', $data)) { - $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\ManifestBillToAccount::class, 'json', $context)); - unset($data['BillToAccount']); - } - if (\array_key_exists('ConsigneeBillIndicator', $data)) { - $object->setConsigneeBillIndicator($data['ConsigneeBillIndicator']); - unset($data['ConsigneeBillIndicator']); - } - if (\array_key_exists('CollectBillIndicator', $data)) { - $object->setCollectBillIndicator($data['CollectBillIndicator']); - unset($data['CollectBillIndicator']); - } - if (\array_key_exists('LocationAssured', $data)) { - $object->setLocationAssured($data['LocationAssured']); - unset($data['LocationAssured']); - } - if (\array_key_exists('ImportControl', $data)) { - $object->setImportControl($data['ImportControl']); - unset($data['ImportControl']); - } - if (\array_key_exists('LabelDeliveryMethod', $data)) { - $object->setLabelDeliveryMethod($data['LabelDeliveryMethod']); - unset($data['LabelDeliveryMethod']); - } - if (\array_key_exists('CommercialInvoiceRemoval', $data)) { - $object->setCommercialInvoiceRemoval($data['CommercialInvoiceRemoval']); - unset($data['CommercialInvoiceRemoval']); - } - if (\array_key_exists('PostalServiceTrackingID', $data)) { - $object->setPostalServiceTrackingID($data['PostalServiceTrackingID']); - unset($data['PostalServiceTrackingID']); - } - if (\array_key_exists('ReturnsFlexibleAccess', $data)) { - $object->setReturnsFlexibleAccess($data['ReturnsFlexibleAccess']); - unset($data['ReturnsFlexibleAccess']); - } - if (\array_key_exists('UPScarbonneutral', $data)) { - $object->setUPScarbonneutral($data['UPScarbonneutral']); - unset($data['UPScarbonneutral']); - } - if (\array_key_exists('Product', $data)) { - $object->setProduct($data['Product']); - unset($data['Product']); - } - if (\array_key_exists('UPSReturnsExchange', $data)) { - $object->setUPSReturnsExchange($data['UPSReturnsExchange']); - unset($data['UPSReturnsExchange']); - } - if (\array_key_exists('LiftGateOnDelivery', $data)) { - $object->setLiftGateOnDelivery($data['LiftGateOnDelivery']); - unset($data['LiftGateOnDelivery']); - } - if (\array_key_exists('LiftGateOnPickUp', $data)) { - $object->setLiftGateOnPickUp($data['LiftGateOnPickUp']); - unset($data['LiftGateOnPickUp']); - } - if (\array_key_exists('PickupPreference', $data)) { - $object->setPickupPreference($data['PickupPreference']); - unset($data['PickupPreference']); - } - if (\array_key_exists('DeliveryPreference', $data)) { - $object->setDeliveryPreference($data['DeliveryPreference']); - unset($data['DeliveryPreference']); - } - if (\array_key_exists('HoldForPickupAtUPSAccessPoint', $data)) { - $object->setHoldForPickupAtUPSAccessPoint($data['HoldForPickupAtUPSAccessPoint']); - unset($data['HoldForPickupAtUPSAccessPoint']); - } - if (\array_key_exists('UAPAddress', $data)) { - $object->setUAPAddress($this->denormalizer->denormalize($data['UAPAddress'], \ShipStream\Ups\Api\Model\ManifestUAPAddress::class, 'json', $context)); - unset($data['UAPAddress']); - } - if (\array_key_exists('DeliverToAddresseeOnlyIndicator', $data)) { - $object->setDeliverToAddresseeOnlyIndicator($data['DeliverToAddresseeOnlyIndicator']); - unset($data['DeliverToAddresseeOnlyIndicator']); - } - if (\array_key_exists('UPSAccessPointCODIndicator', $data)) { - $object->setUPSAccessPointCODIndicator($data['UPSAccessPointCODIndicator']); - unset($data['UPSAccessPointCODIndicator']); - } - if (\array_key_exists('ClinicalTrialIndicator', $data)) { - $object->setClinicalTrialIndicator($data['ClinicalTrialIndicator']); - unset($data['ClinicalTrialIndicator']); - } - if (\array_key_exists('ClinicalTrialIndicationNumber', $data)) { - $object->setClinicalTrialIndicationNumber($data['ClinicalTrialIndicationNumber']); - unset($data['ClinicalTrialIndicationNumber']); - } - if (\array_key_exists('CategoryAHazardousIndicator', $data)) { - $object->setCategoryAHazardousIndicator($data['CategoryAHazardousIndicator']); - unset($data['CategoryAHazardousIndicator']); - } - if (\array_key_exists('DirectDeliveryIndicator', $data)) { - $object->setDirectDeliveryIndicator($data['DirectDeliveryIndicator']); - unset($data['DirectDeliveryIndicator']); - } - if (\array_key_exists('PackageReleaseCodeIndicator', $data)) { - $object->setPackageReleaseCodeIndicator($data['PackageReleaseCodeIndicator']); - unset($data['PackageReleaseCodeIndicator']); - } - if (\array_key_exists('ProactiveResponseIndicator', $data)) { - $object->setProactiveResponseIndicator($data['ProactiveResponseIndicator']); - unset($data['ProactiveResponseIndicator']); - } - if (\array_key_exists('WhiteGloveDeliveryIndicator', $data)) { - $object->setWhiteGloveDeliveryIndicator($data['WhiteGloveDeliveryIndicator']); - unset($data['WhiteGloveDeliveryIndicator']); - } - if (\array_key_exists('RoomOfChoiceIndicator', $data)) { - $object->setRoomOfChoiceIndicator($data['RoomOfChoiceIndicator']); - unset($data['RoomOfChoiceIndicator']); - } - if (\array_key_exists('InstallationDeliveryIndicator', $data)) { - $object->setInstallationDeliveryIndicator($data['InstallationDeliveryIndicator']); - unset($data['InstallationDeliveryIndicator']); - } - if (\array_key_exists('ItemDisposalIndicator', $data)) { - $object->setItemDisposalIndicator($data['ItemDisposalIndicator']); - unset($data['ItemDisposalIndicator']); - } - if (\array_key_exists('LeadShipmentTrackingNumber', $data)) { - $object->setLeadShipmentTrackingNumber($data['LeadShipmentTrackingNumber']); - unset($data['LeadShipmentTrackingNumber']); - } - if (\array_key_exists('SaturdayNonPremiumCommercialDeliveryIndicator', $data)) { - $object->setSaturdayNonPremiumCommercialDeliveryIndicator($data['SaturdayNonPremiumCommercialDeliveryIndicator']); - unset($data['SaturdayNonPremiumCommercialDeliveryIndicator']); - } - if (\array_key_exists('SundayNonPremiumCommercialDeliveryIndicator', $data)) { - $object->setSundayNonPremiumCommercialDeliveryIndicator($data['SundayNonPremiumCommercialDeliveryIndicator']); - unset($data['SundayNonPremiumCommercialDeliveryIndicator']); - } - if (\array_key_exists('UPSPremierAccessorialIndicator', $data)) { - $object->setUPSPremierAccessorialIndicator($data['UPSPremierAccessorialIndicator']); - unset($data['UPSPremierAccessorialIndicator']); - } - if (\array_key_exists('UPSPremierCategoryCode', $data)) { - $object->setUPSPremierCategoryCode($data['UPSPremierCategoryCode']); - unset($data['UPSPremierCategoryCode']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + return $type === \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\SubscriptionFileManifest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Shipper'] = $this->normalizer->normalize($object->getShipper(), 'json', $context); - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $values = []; - foreach ($object->getReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ReferenceNumber'] = $values; - } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - } - if ($object->isInitialized('pickupDate') && null !== $object->getPickupDate()) { - $data['PickupDate'] = $object->getPickupDate(); - } - if ($object->isInitialized('scheduledDeliveryDate') && null !== $object->getScheduledDeliveryDate()) { - $data['ScheduledDeliveryDate'] = $object->getScheduledDeliveryDate(); - } - if ($object->isInitialized('scheduledDeliveryTime') && null !== $object->getScheduledDeliveryTime()) { - $data['ScheduledDeliveryTime'] = $object->getScheduledDeliveryTime(); - } - if ($object->isInitialized('documentsOnly') && null !== $object->getDocumentsOnly()) { - $data['DocumentsOnly'] = $object->getDocumentsOnly(); - } - if ($object->isInitialized('package') && null !== $object->getPackage()) { - $values_1 = []; - foreach ($object->getPackage() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Package'] = $values_1; - } - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('manufactureCountry') && null !== $object->getManufactureCountry()) { - $data['ManufactureCountry'] = $object->getManufactureCountry(); - } - if ($object->isInitialized('harmonizedCode') && null !== $object->getHarmonizedCode()) { - $data['HarmonizedCode'] = $object->getHarmonizedCode(); - } - if ($object->isInitialized('customsValue') && null !== $object->getCustomsValue()) { - $data['CustomsValue'] = $this->normalizer->normalize($object->getCustomsValue(), 'json', $context); - } - if ($object->isInitialized('specialInstructions') && null !== $object->getSpecialInstructions()) { - $data['SpecialInstructions'] = $object->getSpecialInstructions(); - } - if ($object->isInitialized('shipmentChargeType') && null !== $object->getShipmentChargeType()) { - $data['ShipmentChargeType'] = $object->getShipmentChargeType(); - } - if ($object->isInitialized('billToAccount') && null !== $object->getBillToAccount()) { - $data['BillToAccount'] = $this->normalizer->normalize($object->getBillToAccount(), 'json', $context); - } - $data['ConsigneeBillIndicator'] = $object->getConsigneeBillIndicator(); - $data['CollectBillIndicator'] = $object->getCollectBillIndicator(); - if ($object->isInitialized('locationAssured') && null !== $object->getLocationAssured()) { - $data['LocationAssured'] = $object->getLocationAssured(); - } - if ($object->isInitialized('importControl') && null !== $object->getImportControl()) { - $data['ImportControl'] = $object->getImportControl(); - } - if ($object->isInitialized('labelDeliveryMethod') && null !== $object->getLabelDeliveryMethod()) { - $data['LabelDeliveryMethod'] = $object->getLabelDeliveryMethod(); - } - if ($object->isInitialized('commercialInvoiceRemoval') && null !== $object->getCommercialInvoiceRemoval()) { - $data['CommercialInvoiceRemoval'] = $object->getCommercialInvoiceRemoval(); - } - if ($object->isInitialized('postalServiceTrackingID') && null !== $object->getPostalServiceTrackingID()) { - $data['PostalServiceTrackingID'] = $object->getPostalServiceTrackingID(); - } - if ($object->isInitialized('returnsFlexibleAccess') && null !== $object->getReturnsFlexibleAccess()) { - $data['ReturnsFlexibleAccess'] = $object->getReturnsFlexibleAccess(); - } - if ($object->isInitialized('uPScarbonneutral') && null !== $object->getUPScarbonneutral()) { - $data['UPScarbonneutral'] = $object->getUPScarbonneutral(); - } - if ($object->isInitialized('product') && null !== $object->getProduct()) { - $data['Product'] = $object->getProduct(); - } - if ($object->isInitialized('uPSReturnsExchange') && null !== $object->getUPSReturnsExchange()) { - $data['UPSReturnsExchange'] = $object->getUPSReturnsExchange(); - } - if ($object->isInitialized('liftGateOnDelivery') && null !== $object->getLiftGateOnDelivery()) { - $data['LiftGateOnDelivery'] = $object->getLiftGateOnDelivery(); - } - if ($object->isInitialized('liftGateOnPickUp') && null !== $object->getLiftGateOnPickUp()) { - $data['LiftGateOnPickUp'] = $object->getLiftGateOnPickUp(); - } - if ($object->isInitialized('pickupPreference') && null !== $object->getPickupPreference()) { - $data['PickupPreference'] = $object->getPickupPreference(); - } - if ($object->isInitialized('deliveryPreference') && null !== $object->getDeliveryPreference()) { - $data['DeliveryPreference'] = $object->getDeliveryPreference(); - } - if ($object->isInitialized('holdForPickupAtUPSAccessPoint') && null !== $object->getHoldForPickupAtUPSAccessPoint()) { - $data['HoldForPickupAtUPSAccessPoint'] = $object->getHoldForPickupAtUPSAccessPoint(); - } - if ($object->isInitialized('uAPAddress') && null !== $object->getUAPAddress()) { - $data['UAPAddress'] = $this->normalizer->normalize($object->getUAPAddress(), 'json', $context); - } - if ($object->isInitialized('deliverToAddresseeOnlyIndicator') && null !== $object->getDeliverToAddresseeOnlyIndicator()) { - $data['DeliverToAddresseeOnlyIndicator'] = $object->getDeliverToAddresseeOnlyIndicator(); - } - if ($object->isInitialized('uPSAccessPointCODIndicator') && null !== $object->getUPSAccessPointCODIndicator()) { - $data['UPSAccessPointCODIndicator'] = $object->getUPSAccessPointCODIndicator(); - } - if ($object->isInitialized('clinicalTrialIndicator') && null !== $object->getClinicalTrialIndicator()) { - $data['ClinicalTrialIndicator'] = $object->getClinicalTrialIndicator(); - } - if ($object->isInitialized('clinicalTrialIndicationNumber') && null !== $object->getClinicalTrialIndicationNumber()) { - $data['ClinicalTrialIndicationNumber'] = $object->getClinicalTrialIndicationNumber(); - } - if ($object->isInitialized('categoryAHazardousIndicator') && null !== $object->getCategoryAHazardousIndicator()) { - $data['CategoryAHazardousIndicator'] = $object->getCategoryAHazardousIndicator(); - } - if ($object->isInitialized('directDeliveryIndicator') && null !== $object->getDirectDeliveryIndicator()) { - $data['DirectDeliveryIndicator'] = $object->getDirectDeliveryIndicator(); - } - if ($object->isInitialized('packageReleaseCodeIndicator') && null !== $object->getPackageReleaseCodeIndicator()) { - $data['PackageReleaseCodeIndicator'] = $object->getPackageReleaseCodeIndicator(); - } - if ($object->isInitialized('proactiveResponseIndicator') && null !== $object->getProactiveResponseIndicator()) { - $data['ProactiveResponseIndicator'] = $object->getProactiveResponseIndicator(); - } - if ($object->isInitialized('whiteGloveDeliveryIndicator') && null !== $object->getWhiteGloveDeliveryIndicator()) { - $data['WhiteGloveDeliveryIndicator'] = $object->getWhiteGloveDeliveryIndicator(); - } - if ($object->isInitialized('roomOfChoiceIndicator') && null !== $object->getRoomOfChoiceIndicator()) { - $data['RoomOfChoiceIndicator'] = $object->getRoomOfChoiceIndicator(); - } - if ($object->isInitialized('installationDeliveryIndicator') && null !== $object->getInstallationDeliveryIndicator()) { - $data['InstallationDeliveryIndicator'] = $object->getInstallationDeliveryIndicator(); - } - if ($object->isInitialized('itemDisposalIndicator') && null !== $object->getItemDisposalIndicator()) { - $data['ItemDisposalIndicator'] = $object->getItemDisposalIndicator(); - } - if ($object->isInitialized('leadShipmentTrackingNumber') && null !== $object->getLeadShipmentTrackingNumber()) { - $data['LeadShipmentTrackingNumber'] = $object->getLeadShipmentTrackingNumber(); - } - if ($object->isInitialized('saturdayNonPremiumCommercialDeliveryIndicator') && null !== $object->getSaturdayNonPremiumCommercialDeliveryIndicator()) { - $data['SaturdayNonPremiumCommercialDeliveryIndicator'] = $object->getSaturdayNonPremiumCommercialDeliveryIndicator(); - } - if ($object->isInitialized('sundayNonPremiumCommercialDeliveryIndicator') && null !== $object->getSundayNonPremiumCommercialDeliveryIndicator()) { - $data['SundayNonPremiumCommercialDeliveryIndicator'] = $object->getSundayNonPremiumCommercialDeliveryIndicator(); - } - if ($object->isInitialized('uPSPremierAccessorialIndicator') && null !== $object->getUPSPremierAccessorialIndicator()) { - $data['UPSPremierAccessorialIndicator'] = $object->getUPSPremierAccessorialIndicator(); - } - if ($object->isInitialized('uPSPremierCategoryCode') && null !== $object->getUPSPremierCategoryCode()) { - $data['UPSPremierCategoryCode'] = $object->getUPSPremierCategoryCode(); + if (\array_key_exists('Shipper', $data)) { + $object->setShipper($this->denormalizer->denormalize($data['Shipper'], \ShipStream\Ups\Api\Model\ManifestShipper::class, 'json', $context)); + unset($data['Shipper']); + } + if (\array_key_exists('ShipTo', $data)) { + $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\ManifestShipTo::class, 'json', $context)); + unset($data['ShipTo']); + } + if (\array_key_exists('ReferenceNumber', $data)) { + $values = []; + foreach ($data['ReferenceNumber'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setReferenceNumber($values); + unset($data['ReferenceNumber']); + } + if (\array_key_exists('Service', $data)) { + $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ManifestService::class, 'json', $context)); + unset($data['Service']); + } + if (\array_key_exists('PickupDate', $data)) { + $object->setPickupDate($data['PickupDate']); + unset($data['PickupDate']); + } + if (\array_key_exists('ScheduledDeliveryDate', $data)) { + $object->setScheduledDeliveryDate($data['ScheduledDeliveryDate']); + unset($data['ScheduledDeliveryDate']); + } + if (\array_key_exists('ScheduledDeliveryTime', $data)) { + $object->setScheduledDeliveryTime($data['ScheduledDeliveryTime']); + unset($data['ScheduledDeliveryTime']); + } + if (\array_key_exists('DocumentsOnly', $data)) { + $object->setDocumentsOnly($data['DocumentsOnly']); + unset($data['DocumentsOnly']); + } + if (\array_key_exists('Package', $data)) { + $values_1 = []; + foreach ($data['Package'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ManifestPackage::class, 'json', $context); } - return $data; + $object->setPackage($values_1); + unset($data['Package']); + } + if (\array_key_exists('ShipmentServiceOptions', $data)) { + $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class, 'json', $context)); + unset($data['ShipmentServiceOptions']); + } + if (\array_key_exists('ManufactureCountry', $data)) { + $object->setManufactureCountry($data['ManufactureCountry']); + unset($data['ManufactureCountry']); + } + if (\array_key_exists('HarmonizedCode', $data)) { + $object->setHarmonizedCode($data['HarmonizedCode']); + unset($data['HarmonizedCode']); + } + if (\array_key_exists('CustomsValue', $data)) { + $object->setCustomsValue($this->denormalizer->denormalize($data['CustomsValue'], \ShipStream\Ups\Api\Model\ManifestCustomsValue::class, 'json', $context)); + unset($data['CustomsValue']); + } + if (\array_key_exists('SpecialInstructions', $data)) { + $object->setSpecialInstructions($data['SpecialInstructions']); + unset($data['SpecialInstructions']); + } + if (\array_key_exists('ShipmentChargeType', $data)) { + $object->setShipmentChargeType($data['ShipmentChargeType']); + unset($data['ShipmentChargeType']); + } + if (\array_key_exists('BillToAccount', $data)) { + $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\ManifestBillToAccount::class, 'json', $context)); + unset($data['BillToAccount']); + } + if (\array_key_exists('ConsigneeBillIndicator', $data)) { + $object->setConsigneeBillIndicator($data['ConsigneeBillIndicator']); + unset($data['ConsigneeBillIndicator']); + } + if (\array_key_exists('CollectBillIndicator', $data)) { + $object->setCollectBillIndicator($data['CollectBillIndicator']); + unset($data['CollectBillIndicator']); + } + if (\array_key_exists('LocationAssured', $data)) { + $object->setLocationAssured($data['LocationAssured']); + unset($data['LocationAssured']); + } + if (\array_key_exists('ImportControl', $data)) { + $object->setImportControl($data['ImportControl']); + unset($data['ImportControl']); + } + if (\array_key_exists('LabelDeliveryMethod', $data)) { + $object->setLabelDeliveryMethod($data['LabelDeliveryMethod']); + unset($data['LabelDeliveryMethod']); + } + if (\array_key_exists('CommercialInvoiceRemoval', $data)) { + $object->setCommercialInvoiceRemoval($data['CommercialInvoiceRemoval']); + unset($data['CommercialInvoiceRemoval']); + } + if (\array_key_exists('PostalServiceTrackingID', $data)) { + $object->setPostalServiceTrackingID($data['PostalServiceTrackingID']); + unset($data['PostalServiceTrackingID']); + } + if (\array_key_exists('ReturnsFlexibleAccess', $data)) { + $object->setReturnsFlexibleAccess($data['ReturnsFlexibleAccess']); + unset($data['ReturnsFlexibleAccess']); + } + if (\array_key_exists('UPScarbonneutral', $data)) { + $object->setUPScarbonneutral($data['UPScarbonneutral']); + unset($data['UPScarbonneutral']); + } + if (\array_key_exists('Product', $data)) { + $object->setProduct($data['Product']); + unset($data['Product']); + } + if (\array_key_exists('UPSReturnsExchange', $data)) { + $object->setUPSReturnsExchange($data['UPSReturnsExchange']); + unset($data['UPSReturnsExchange']); + } + if (\array_key_exists('LiftGateOnDelivery', $data)) { + $object->setLiftGateOnDelivery($data['LiftGateOnDelivery']); + unset($data['LiftGateOnDelivery']); + } + if (\array_key_exists('LiftGateOnPickUp', $data)) { + $object->setLiftGateOnPickUp($data['LiftGateOnPickUp']); + unset($data['LiftGateOnPickUp']); + } + if (\array_key_exists('PickupPreference', $data)) { + $object->setPickupPreference($data['PickupPreference']); + unset($data['PickupPreference']); + } + if (\array_key_exists('DeliveryPreference', $data)) { + $object->setDeliveryPreference($data['DeliveryPreference']); + unset($data['DeliveryPreference']); + } + if (\array_key_exists('HoldForPickupAtUPSAccessPoint', $data)) { + $object->setHoldForPickupAtUPSAccessPoint($data['HoldForPickupAtUPSAccessPoint']); + unset($data['HoldForPickupAtUPSAccessPoint']); + } + if (\array_key_exists('UAPAddress', $data)) { + $object->setUAPAddress($this->denormalizer->denormalize($data['UAPAddress'], \ShipStream\Ups\Api\Model\ManifestUAPAddress::class, 'json', $context)); + unset($data['UAPAddress']); + } + if (\array_key_exists('DeliverToAddresseeOnlyIndicator', $data)) { + $object->setDeliverToAddresseeOnlyIndicator($data['DeliverToAddresseeOnlyIndicator']); + unset($data['DeliverToAddresseeOnlyIndicator']); + } + if (\array_key_exists('UPSAccessPointCODIndicator', $data)) { + $object->setUPSAccessPointCODIndicator($data['UPSAccessPointCODIndicator']); + unset($data['UPSAccessPointCODIndicator']); + } + if (\array_key_exists('ClinicalTrialIndicator', $data)) { + $object->setClinicalTrialIndicator($data['ClinicalTrialIndicator']); + unset($data['ClinicalTrialIndicator']); + } + if (\array_key_exists('ClinicalTrialIndicationNumber', $data)) { + $object->setClinicalTrialIndicationNumber($data['ClinicalTrialIndicationNumber']); + unset($data['ClinicalTrialIndicationNumber']); + } + if (\array_key_exists('CategoryAHazardousIndicator', $data)) { + $object->setCategoryAHazardousIndicator($data['CategoryAHazardousIndicator']); + unset($data['CategoryAHazardousIndicator']); + } + if (\array_key_exists('DirectDeliveryIndicator', $data)) { + $object->setDirectDeliveryIndicator($data['DirectDeliveryIndicator']); + unset($data['DirectDeliveryIndicator']); + } + if (\array_key_exists('PackageReleaseCodeIndicator', $data)) { + $object->setPackageReleaseCodeIndicator($data['PackageReleaseCodeIndicator']); + unset($data['PackageReleaseCodeIndicator']); + } + if (\array_key_exists('ProactiveResponseIndicator', $data)) { + $object->setProactiveResponseIndicator($data['ProactiveResponseIndicator']); + unset($data['ProactiveResponseIndicator']); + } + if (\array_key_exists('WhiteGloveDeliveryIndicator', $data)) { + $object->setWhiteGloveDeliveryIndicator($data['WhiteGloveDeliveryIndicator']); + unset($data['WhiteGloveDeliveryIndicator']); + } + if (\array_key_exists('RoomOfChoiceIndicator', $data)) { + $object->setRoomOfChoiceIndicator($data['RoomOfChoiceIndicator']); + unset($data['RoomOfChoiceIndicator']); + } + if (\array_key_exists('InstallationDeliveryIndicator', $data)) { + $object->setInstallationDeliveryIndicator($data['InstallationDeliveryIndicator']); + unset($data['InstallationDeliveryIndicator']); + } + if (\array_key_exists('ItemDisposalIndicator', $data)) { + $object->setItemDisposalIndicator($data['ItemDisposalIndicator']); + unset($data['ItemDisposalIndicator']); + } + if (\array_key_exists('LeadShipmentTrackingNumber', $data)) { + $object->setLeadShipmentTrackingNumber($data['LeadShipmentTrackingNumber']); + unset($data['LeadShipmentTrackingNumber']); + } + if (\array_key_exists('SaturdayNonPremiumCommercialDeliveryIndicator', $data)) { + $object->setSaturdayNonPremiumCommercialDeliveryIndicator($data['SaturdayNonPremiumCommercialDeliveryIndicator']); + unset($data['SaturdayNonPremiumCommercialDeliveryIndicator']); + } + if (\array_key_exists('SundayNonPremiumCommercialDeliveryIndicator', $data)) { + $object->setSundayNonPremiumCommercialDeliveryIndicator($data['SundayNonPremiumCommercialDeliveryIndicator']); + unset($data['SundayNonPremiumCommercialDeliveryIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionFileManifest::class => false]; + if (\array_key_exists('UPSPremierAccessorialIndicator', $data)) { + $object->setUPSPremierAccessorialIndicator($data['UPSPremierAccessorialIndicator']); + unset($data['UPSPremierAccessorialIndicator']); } + if (\array_key_exists('UPSPremierCategoryCode', $data)) { + $object->setUPSPremierCategoryCode($data['UPSPremierCategoryCode']); + unset($data['UPSPremierCategoryCode']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } -} else { - class SubscriptionFileManifestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileManifest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionFileManifest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Shipper', $data)) { - $object->setShipper($this->denormalizer->denormalize($data['Shipper'], \ShipStream\Ups\Api\Model\ManifestShipper::class, 'json', $context)); - unset($data['Shipper']); - } - if (\array_key_exists('ShipTo', $data)) { - $object->setShipTo($this->denormalizer->denormalize($data['ShipTo'], \ShipStream\Ups\Api\Model\ManifestShipTo::class, 'json', $context)); - unset($data['ShipTo']); - } - if (\array_key_exists('ReferenceNumber', $data)) { - $values = []; - foreach ($data['ReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ManifestReferenceNumber::class, 'json', $context); - } - $object->setReferenceNumber($values); - unset($data['ReferenceNumber']); - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ManifestService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('PickupDate', $data)) { - $object->setPickupDate($data['PickupDate']); - unset($data['PickupDate']); - } - if (\array_key_exists('ScheduledDeliveryDate', $data)) { - $object->setScheduledDeliveryDate($data['ScheduledDeliveryDate']); - unset($data['ScheduledDeliveryDate']); - } - if (\array_key_exists('ScheduledDeliveryTime', $data)) { - $object->setScheduledDeliveryTime($data['ScheduledDeliveryTime']); - unset($data['ScheduledDeliveryTime']); - } - if (\array_key_exists('DocumentsOnly', $data)) { - $object->setDocumentsOnly($data['DocumentsOnly']); - unset($data['DocumentsOnly']); - } - if (\array_key_exists('Package', $data)) { - $values_1 = []; - foreach ($data['Package'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\ManifestPackage::class, 'json', $context); - } - $object->setPackage($values_1); - unset($data['Package']); - } - if (\array_key_exists('ShipmentServiceOptions', $data)) { - $object->setShipmentServiceOptions($this->denormalizer->denormalize($data['ShipmentServiceOptions'], \ShipStream\Ups\Api\Model\ManifestShipmentServiceOptions::class, 'json', $context)); - unset($data['ShipmentServiceOptions']); - } - if (\array_key_exists('ManufactureCountry', $data)) { - $object->setManufactureCountry($data['ManufactureCountry']); - unset($data['ManufactureCountry']); - } - if (\array_key_exists('HarmonizedCode', $data)) { - $object->setHarmonizedCode($data['HarmonizedCode']); - unset($data['HarmonizedCode']); - } - if (\array_key_exists('CustomsValue', $data)) { - $object->setCustomsValue($this->denormalizer->denormalize($data['CustomsValue'], \ShipStream\Ups\Api\Model\ManifestCustomsValue::class, 'json', $context)); - unset($data['CustomsValue']); - } - if (\array_key_exists('SpecialInstructions', $data)) { - $object->setSpecialInstructions($data['SpecialInstructions']); - unset($data['SpecialInstructions']); - } - if (\array_key_exists('ShipmentChargeType', $data)) { - $object->setShipmentChargeType($data['ShipmentChargeType']); - unset($data['ShipmentChargeType']); - } - if (\array_key_exists('BillToAccount', $data)) { - $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\ManifestBillToAccount::class, 'json', $context)); - unset($data['BillToAccount']); - } - if (\array_key_exists('ConsigneeBillIndicator', $data)) { - $object->setConsigneeBillIndicator($data['ConsigneeBillIndicator']); - unset($data['ConsigneeBillIndicator']); - } - if (\array_key_exists('CollectBillIndicator', $data)) { - $object->setCollectBillIndicator($data['CollectBillIndicator']); - unset($data['CollectBillIndicator']); - } - if (\array_key_exists('LocationAssured', $data)) { - $object->setLocationAssured($data['LocationAssured']); - unset($data['LocationAssured']); - } - if (\array_key_exists('ImportControl', $data)) { - $object->setImportControl($data['ImportControl']); - unset($data['ImportControl']); - } - if (\array_key_exists('LabelDeliveryMethod', $data)) { - $object->setLabelDeliveryMethod($data['LabelDeliveryMethod']); - unset($data['LabelDeliveryMethod']); - } - if (\array_key_exists('CommercialInvoiceRemoval', $data)) { - $object->setCommercialInvoiceRemoval($data['CommercialInvoiceRemoval']); - unset($data['CommercialInvoiceRemoval']); - } - if (\array_key_exists('PostalServiceTrackingID', $data)) { - $object->setPostalServiceTrackingID($data['PostalServiceTrackingID']); - unset($data['PostalServiceTrackingID']); - } - if (\array_key_exists('ReturnsFlexibleAccess', $data)) { - $object->setReturnsFlexibleAccess($data['ReturnsFlexibleAccess']); - unset($data['ReturnsFlexibleAccess']); - } - if (\array_key_exists('UPScarbonneutral', $data)) { - $object->setUPScarbonneutral($data['UPScarbonneutral']); - unset($data['UPScarbonneutral']); - } - if (\array_key_exists('Product', $data)) { - $object->setProduct($data['Product']); - unset($data['Product']); - } - if (\array_key_exists('UPSReturnsExchange', $data)) { - $object->setUPSReturnsExchange($data['UPSReturnsExchange']); - unset($data['UPSReturnsExchange']); - } - if (\array_key_exists('LiftGateOnDelivery', $data)) { - $object->setLiftGateOnDelivery($data['LiftGateOnDelivery']); - unset($data['LiftGateOnDelivery']); - } - if (\array_key_exists('LiftGateOnPickUp', $data)) { - $object->setLiftGateOnPickUp($data['LiftGateOnPickUp']); - unset($data['LiftGateOnPickUp']); - } - if (\array_key_exists('PickupPreference', $data)) { - $object->setPickupPreference($data['PickupPreference']); - unset($data['PickupPreference']); - } - if (\array_key_exists('DeliveryPreference', $data)) { - $object->setDeliveryPreference($data['DeliveryPreference']); - unset($data['DeliveryPreference']); - } - if (\array_key_exists('HoldForPickupAtUPSAccessPoint', $data)) { - $object->setHoldForPickupAtUPSAccessPoint($data['HoldForPickupAtUPSAccessPoint']); - unset($data['HoldForPickupAtUPSAccessPoint']); - } - if (\array_key_exists('UAPAddress', $data)) { - $object->setUAPAddress($this->denormalizer->denormalize($data['UAPAddress'], \ShipStream\Ups\Api\Model\ManifestUAPAddress::class, 'json', $context)); - unset($data['UAPAddress']); - } - if (\array_key_exists('DeliverToAddresseeOnlyIndicator', $data)) { - $object->setDeliverToAddresseeOnlyIndicator($data['DeliverToAddresseeOnlyIndicator']); - unset($data['DeliverToAddresseeOnlyIndicator']); - } - if (\array_key_exists('UPSAccessPointCODIndicator', $data)) { - $object->setUPSAccessPointCODIndicator($data['UPSAccessPointCODIndicator']); - unset($data['UPSAccessPointCODIndicator']); - } - if (\array_key_exists('ClinicalTrialIndicator', $data)) { - $object->setClinicalTrialIndicator($data['ClinicalTrialIndicator']); - unset($data['ClinicalTrialIndicator']); - } - if (\array_key_exists('ClinicalTrialIndicationNumber', $data)) { - $object->setClinicalTrialIndicationNumber($data['ClinicalTrialIndicationNumber']); - unset($data['ClinicalTrialIndicationNumber']); - } - if (\array_key_exists('CategoryAHazardousIndicator', $data)) { - $object->setCategoryAHazardousIndicator($data['CategoryAHazardousIndicator']); - unset($data['CategoryAHazardousIndicator']); - } - if (\array_key_exists('DirectDeliveryIndicator', $data)) { - $object->setDirectDeliveryIndicator($data['DirectDeliveryIndicator']); - unset($data['DirectDeliveryIndicator']); - } - if (\array_key_exists('PackageReleaseCodeIndicator', $data)) { - $object->setPackageReleaseCodeIndicator($data['PackageReleaseCodeIndicator']); - unset($data['PackageReleaseCodeIndicator']); - } - if (\array_key_exists('ProactiveResponseIndicator', $data)) { - $object->setProactiveResponseIndicator($data['ProactiveResponseIndicator']); - unset($data['ProactiveResponseIndicator']); - } - if (\array_key_exists('WhiteGloveDeliveryIndicator', $data)) { - $object->setWhiteGloveDeliveryIndicator($data['WhiteGloveDeliveryIndicator']); - unset($data['WhiteGloveDeliveryIndicator']); - } - if (\array_key_exists('RoomOfChoiceIndicator', $data)) { - $object->setRoomOfChoiceIndicator($data['RoomOfChoiceIndicator']); - unset($data['RoomOfChoiceIndicator']); - } - if (\array_key_exists('InstallationDeliveryIndicator', $data)) { - $object->setInstallationDeliveryIndicator($data['InstallationDeliveryIndicator']); - unset($data['InstallationDeliveryIndicator']); - } - if (\array_key_exists('ItemDisposalIndicator', $data)) { - $object->setItemDisposalIndicator($data['ItemDisposalIndicator']); - unset($data['ItemDisposalIndicator']); - } - if (\array_key_exists('LeadShipmentTrackingNumber', $data)) { - $object->setLeadShipmentTrackingNumber($data['LeadShipmentTrackingNumber']); - unset($data['LeadShipmentTrackingNumber']); - } - if (\array_key_exists('SaturdayNonPremiumCommercialDeliveryIndicator', $data)) { - $object->setSaturdayNonPremiumCommercialDeliveryIndicator($data['SaturdayNonPremiumCommercialDeliveryIndicator']); - unset($data['SaturdayNonPremiumCommercialDeliveryIndicator']); - } - if (\array_key_exists('SundayNonPremiumCommercialDeliveryIndicator', $data)) { - $object->setSundayNonPremiumCommercialDeliveryIndicator($data['SundayNonPremiumCommercialDeliveryIndicator']); - unset($data['SundayNonPremiumCommercialDeliveryIndicator']); - } - if (\array_key_exists('UPSPremierAccessorialIndicator', $data)) { - $object->setUPSPremierAccessorialIndicator($data['UPSPremierAccessorialIndicator']); - unset($data['UPSPremierAccessorialIndicator']); - } - if (\array_key_exists('UPSPremierCategoryCode', $data)) { - $object->setUPSPremierCategoryCode($data['UPSPremierCategoryCode']); - unset($data['UPSPremierCategoryCode']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray = []; + $dataArray['Shipper'] = $this->normalizer->normalize($data->getShipper(), 'json', $context); + $dataArray['ShipTo'] = $this->normalizer->normalize($data->getShipTo(), 'json', $context); + if ($data->isInitialized('referenceNumber') && null !== $data->getReferenceNumber()) { + $values = []; + foreach ($data->getReferenceNumber() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['ReferenceNumber'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Shipper'] = $this->normalizer->normalize($object->getShipper(), 'json', $context); - $data['ShipTo'] = $this->normalizer->normalize($object->getShipTo(), 'json', $context); - if ($object->isInitialized('referenceNumber') && null !== $object->getReferenceNumber()) { - $values = []; - foreach ($object->getReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['ReferenceNumber'] = $values; - } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - } - if ($object->isInitialized('pickupDate') && null !== $object->getPickupDate()) { - $data['PickupDate'] = $object->getPickupDate(); - } - if ($object->isInitialized('scheduledDeliveryDate') && null !== $object->getScheduledDeliveryDate()) { - $data['ScheduledDeliveryDate'] = $object->getScheduledDeliveryDate(); - } - if ($object->isInitialized('scheduledDeliveryTime') && null !== $object->getScheduledDeliveryTime()) { - $data['ScheduledDeliveryTime'] = $object->getScheduledDeliveryTime(); - } - if ($object->isInitialized('documentsOnly') && null !== $object->getDocumentsOnly()) { - $data['DocumentsOnly'] = $object->getDocumentsOnly(); - } - if ($object->isInitialized('package') && null !== $object->getPackage()) { - $values_1 = []; - foreach ($object->getPackage() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['Package'] = $values_1; - } - if ($object->isInitialized('shipmentServiceOptions') && null !== $object->getShipmentServiceOptions()) { - $data['ShipmentServiceOptions'] = $this->normalizer->normalize($object->getShipmentServiceOptions(), 'json', $context); - } - if ($object->isInitialized('manufactureCountry') && null !== $object->getManufactureCountry()) { - $data['ManufactureCountry'] = $object->getManufactureCountry(); - } - if ($object->isInitialized('harmonizedCode') && null !== $object->getHarmonizedCode()) { - $data['HarmonizedCode'] = $object->getHarmonizedCode(); - } - if ($object->isInitialized('customsValue') && null !== $object->getCustomsValue()) { - $data['CustomsValue'] = $this->normalizer->normalize($object->getCustomsValue(), 'json', $context); - } - if ($object->isInitialized('specialInstructions') && null !== $object->getSpecialInstructions()) { - $data['SpecialInstructions'] = $object->getSpecialInstructions(); - } - if ($object->isInitialized('shipmentChargeType') && null !== $object->getShipmentChargeType()) { - $data['ShipmentChargeType'] = $object->getShipmentChargeType(); - } - if ($object->isInitialized('billToAccount') && null !== $object->getBillToAccount()) { - $data['BillToAccount'] = $this->normalizer->normalize($object->getBillToAccount(), 'json', $context); - } - $data['ConsigneeBillIndicator'] = $object->getConsigneeBillIndicator(); - $data['CollectBillIndicator'] = $object->getCollectBillIndicator(); - if ($object->isInitialized('locationAssured') && null !== $object->getLocationAssured()) { - $data['LocationAssured'] = $object->getLocationAssured(); - } - if ($object->isInitialized('importControl') && null !== $object->getImportControl()) { - $data['ImportControl'] = $object->getImportControl(); - } - if ($object->isInitialized('labelDeliveryMethod') && null !== $object->getLabelDeliveryMethod()) { - $data['LabelDeliveryMethod'] = $object->getLabelDeliveryMethod(); - } - if ($object->isInitialized('commercialInvoiceRemoval') && null !== $object->getCommercialInvoiceRemoval()) { - $data['CommercialInvoiceRemoval'] = $object->getCommercialInvoiceRemoval(); - } - if ($object->isInitialized('postalServiceTrackingID') && null !== $object->getPostalServiceTrackingID()) { - $data['PostalServiceTrackingID'] = $object->getPostalServiceTrackingID(); - } - if ($object->isInitialized('returnsFlexibleAccess') && null !== $object->getReturnsFlexibleAccess()) { - $data['ReturnsFlexibleAccess'] = $object->getReturnsFlexibleAccess(); - } - if ($object->isInitialized('uPScarbonneutral') && null !== $object->getUPScarbonneutral()) { - $data['UPScarbonneutral'] = $object->getUPScarbonneutral(); - } - if ($object->isInitialized('product') && null !== $object->getProduct()) { - $data['Product'] = $object->getProduct(); - } - if ($object->isInitialized('uPSReturnsExchange') && null !== $object->getUPSReturnsExchange()) { - $data['UPSReturnsExchange'] = $object->getUPSReturnsExchange(); - } - if ($object->isInitialized('liftGateOnDelivery') && null !== $object->getLiftGateOnDelivery()) { - $data['LiftGateOnDelivery'] = $object->getLiftGateOnDelivery(); - } - if ($object->isInitialized('liftGateOnPickUp') && null !== $object->getLiftGateOnPickUp()) { - $data['LiftGateOnPickUp'] = $object->getLiftGateOnPickUp(); - } - if ($object->isInitialized('pickupPreference') && null !== $object->getPickupPreference()) { - $data['PickupPreference'] = $object->getPickupPreference(); - } - if ($object->isInitialized('deliveryPreference') && null !== $object->getDeliveryPreference()) { - $data['DeliveryPreference'] = $object->getDeliveryPreference(); - } - if ($object->isInitialized('holdForPickupAtUPSAccessPoint') && null !== $object->getHoldForPickupAtUPSAccessPoint()) { - $data['HoldForPickupAtUPSAccessPoint'] = $object->getHoldForPickupAtUPSAccessPoint(); - } - if ($object->isInitialized('uAPAddress') && null !== $object->getUAPAddress()) { - $data['UAPAddress'] = $this->normalizer->normalize($object->getUAPAddress(), 'json', $context); - } - if ($object->isInitialized('deliverToAddresseeOnlyIndicator') && null !== $object->getDeliverToAddresseeOnlyIndicator()) { - $data['DeliverToAddresseeOnlyIndicator'] = $object->getDeliverToAddresseeOnlyIndicator(); - } - if ($object->isInitialized('uPSAccessPointCODIndicator') && null !== $object->getUPSAccessPointCODIndicator()) { - $data['UPSAccessPointCODIndicator'] = $object->getUPSAccessPointCODIndicator(); - } - if ($object->isInitialized('clinicalTrialIndicator') && null !== $object->getClinicalTrialIndicator()) { - $data['ClinicalTrialIndicator'] = $object->getClinicalTrialIndicator(); - } - if ($object->isInitialized('clinicalTrialIndicationNumber') && null !== $object->getClinicalTrialIndicationNumber()) { - $data['ClinicalTrialIndicationNumber'] = $object->getClinicalTrialIndicationNumber(); - } - if ($object->isInitialized('categoryAHazardousIndicator') && null !== $object->getCategoryAHazardousIndicator()) { - $data['CategoryAHazardousIndicator'] = $object->getCategoryAHazardousIndicator(); - } - if ($object->isInitialized('directDeliveryIndicator') && null !== $object->getDirectDeliveryIndicator()) { - $data['DirectDeliveryIndicator'] = $object->getDirectDeliveryIndicator(); - } - if ($object->isInitialized('packageReleaseCodeIndicator') && null !== $object->getPackageReleaseCodeIndicator()) { - $data['PackageReleaseCodeIndicator'] = $object->getPackageReleaseCodeIndicator(); - } - if ($object->isInitialized('proactiveResponseIndicator') && null !== $object->getProactiveResponseIndicator()) { - $data['ProactiveResponseIndicator'] = $object->getProactiveResponseIndicator(); - } - if ($object->isInitialized('whiteGloveDeliveryIndicator') && null !== $object->getWhiteGloveDeliveryIndicator()) { - $data['WhiteGloveDeliveryIndicator'] = $object->getWhiteGloveDeliveryIndicator(); - } - if ($object->isInitialized('roomOfChoiceIndicator') && null !== $object->getRoomOfChoiceIndicator()) { - $data['RoomOfChoiceIndicator'] = $object->getRoomOfChoiceIndicator(); - } - if ($object->isInitialized('installationDeliveryIndicator') && null !== $object->getInstallationDeliveryIndicator()) { - $data['InstallationDeliveryIndicator'] = $object->getInstallationDeliveryIndicator(); - } - if ($object->isInitialized('itemDisposalIndicator') && null !== $object->getItemDisposalIndicator()) { - $data['ItemDisposalIndicator'] = $object->getItemDisposalIndicator(); - } - if ($object->isInitialized('leadShipmentTrackingNumber') && null !== $object->getLeadShipmentTrackingNumber()) { - $data['LeadShipmentTrackingNumber'] = $object->getLeadShipmentTrackingNumber(); - } - if ($object->isInitialized('saturdayNonPremiumCommercialDeliveryIndicator') && null !== $object->getSaturdayNonPremiumCommercialDeliveryIndicator()) { - $data['SaturdayNonPremiumCommercialDeliveryIndicator'] = $object->getSaturdayNonPremiumCommercialDeliveryIndicator(); - } - if ($object->isInitialized('sundayNonPremiumCommercialDeliveryIndicator') && null !== $object->getSundayNonPremiumCommercialDeliveryIndicator()) { - $data['SundayNonPremiumCommercialDeliveryIndicator'] = $object->getSundayNonPremiumCommercialDeliveryIndicator(); - } - if ($object->isInitialized('uPSPremierAccessorialIndicator') && null !== $object->getUPSPremierAccessorialIndicator()) { - $data['UPSPremierAccessorialIndicator'] = $object->getUPSPremierAccessorialIndicator(); - } - if ($object->isInitialized('uPSPremierCategoryCode') && null !== $object->getUPSPremierCategoryCode()) { - $data['UPSPremierCategoryCode'] = $object->getUPSPremierCategoryCode(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + if ($data->isInitialized('service') && null !== $data->getService()) { + $dataArray['Service'] = $this->normalizer->normalize($data->getService(), 'json', $context); + } + if ($data->isInitialized('pickupDate') && null !== $data->getPickupDate()) { + $dataArray['PickupDate'] = $data->getPickupDate(); + } + if ($data->isInitialized('scheduledDeliveryDate') && null !== $data->getScheduledDeliveryDate()) { + $dataArray['ScheduledDeliveryDate'] = $data->getScheduledDeliveryDate(); + } + if ($data->isInitialized('scheduledDeliveryTime') && null !== $data->getScheduledDeliveryTime()) { + $dataArray['ScheduledDeliveryTime'] = $data->getScheduledDeliveryTime(); + } + if ($data->isInitialized('documentsOnly') && null !== $data->getDocumentsOnly()) { + $dataArray['DocumentsOnly'] = $data->getDocumentsOnly(); + } + if ($data->isInitialized('package') && null !== $data->getPackage()) { + $values_1 = []; + foreach ($data->getPackage() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['Package'] = $values_1; + } + if ($data->isInitialized('shipmentServiceOptions') && null !== $data->getShipmentServiceOptions()) { + $dataArray['ShipmentServiceOptions'] = $this->normalizer->normalize($data->getShipmentServiceOptions(), 'json', $context); + } + if ($data->isInitialized('manufactureCountry') && null !== $data->getManufactureCountry()) { + $dataArray['ManufactureCountry'] = $data->getManufactureCountry(); + } + if ($data->isInitialized('harmonizedCode') && null !== $data->getHarmonizedCode()) { + $dataArray['HarmonizedCode'] = $data->getHarmonizedCode(); + } + if ($data->isInitialized('customsValue') && null !== $data->getCustomsValue()) { + $dataArray['CustomsValue'] = $this->normalizer->normalize($data->getCustomsValue(), 'json', $context); + } + if ($data->isInitialized('specialInstructions') && null !== $data->getSpecialInstructions()) { + $dataArray['SpecialInstructions'] = $data->getSpecialInstructions(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionFileManifest::class => false]; + if ($data->isInitialized('shipmentChargeType') && null !== $data->getShipmentChargeType()) { + $dataArray['ShipmentChargeType'] = $data->getShipmentChargeType(); } + if ($data->isInitialized('billToAccount') && null !== $data->getBillToAccount()) { + $dataArray['BillToAccount'] = $this->normalizer->normalize($data->getBillToAccount(), 'json', $context); + } + $dataArray['ConsigneeBillIndicator'] = $data->getConsigneeBillIndicator(); + $dataArray['CollectBillIndicator'] = $data->getCollectBillIndicator(); + if ($data->isInitialized('locationAssured') && null !== $data->getLocationAssured()) { + $dataArray['LocationAssured'] = $data->getLocationAssured(); + } + if ($data->isInitialized('importControl') && null !== $data->getImportControl()) { + $dataArray['ImportControl'] = $data->getImportControl(); + } + if ($data->isInitialized('labelDeliveryMethod') && null !== $data->getLabelDeliveryMethod()) { + $dataArray['LabelDeliveryMethod'] = $data->getLabelDeliveryMethod(); + } + if ($data->isInitialized('commercialInvoiceRemoval') && null !== $data->getCommercialInvoiceRemoval()) { + $dataArray['CommercialInvoiceRemoval'] = $data->getCommercialInvoiceRemoval(); + } + if ($data->isInitialized('postalServiceTrackingID') && null !== $data->getPostalServiceTrackingID()) { + $dataArray['PostalServiceTrackingID'] = $data->getPostalServiceTrackingID(); + } + if ($data->isInitialized('returnsFlexibleAccess') && null !== $data->getReturnsFlexibleAccess()) { + $dataArray['ReturnsFlexibleAccess'] = $data->getReturnsFlexibleAccess(); + } + if ($data->isInitialized('uPScarbonneutral') && null !== $data->getUPScarbonneutral()) { + $dataArray['UPScarbonneutral'] = $data->getUPScarbonneutral(); + } + if ($data->isInitialized('product') && null !== $data->getProduct()) { + $dataArray['Product'] = $data->getProduct(); + } + if ($data->isInitialized('uPSReturnsExchange') && null !== $data->getUPSReturnsExchange()) { + $dataArray['UPSReturnsExchange'] = $data->getUPSReturnsExchange(); + } + if ($data->isInitialized('liftGateOnDelivery') && null !== $data->getLiftGateOnDelivery()) { + $dataArray['LiftGateOnDelivery'] = $data->getLiftGateOnDelivery(); + } + if ($data->isInitialized('liftGateOnPickUp') && null !== $data->getLiftGateOnPickUp()) { + $dataArray['LiftGateOnPickUp'] = $data->getLiftGateOnPickUp(); + } + if ($data->isInitialized('pickupPreference') && null !== $data->getPickupPreference()) { + $dataArray['PickupPreference'] = $data->getPickupPreference(); + } + if ($data->isInitialized('deliveryPreference') && null !== $data->getDeliveryPreference()) { + $dataArray['DeliveryPreference'] = $data->getDeliveryPreference(); + } + if ($data->isInitialized('holdForPickupAtUPSAccessPoint') && null !== $data->getHoldForPickupAtUPSAccessPoint()) { + $dataArray['HoldForPickupAtUPSAccessPoint'] = $data->getHoldForPickupAtUPSAccessPoint(); + } + if ($data->isInitialized('uAPAddress') && null !== $data->getUAPAddress()) { + $dataArray['UAPAddress'] = $this->normalizer->normalize($data->getUAPAddress(), 'json', $context); + } + if ($data->isInitialized('deliverToAddresseeOnlyIndicator') && null !== $data->getDeliverToAddresseeOnlyIndicator()) { + $dataArray['DeliverToAddresseeOnlyIndicator'] = $data->getDeliverToAddresseeOnlyIndicator(); + } + if ($data->isInitialized('uPSAccessPointCODIndicator') && null !== $data->getUPSAccessPointCODIndicator()) { + $dataArray['UPSAccessPointCODIndicator'] = $data->getUPSAccessPointCODIndicator(); + } + if ($data->isInitialized('clinicalTrialIndicator') && null !== $data->getClinicalTrialIndicator()) { + $dataArray['ClinicalTrialIndicator'] = $data->getClinicalTrialIndicator(); + } + if ($data->isInitialized('clinicalTrialIndicationNumber') && null !== $data->getClinicalTrialIndicationNumber()) { + $dataArray['ClinicalTrialIndicationNumber'] = $data->getClinicalTrialIndicationNumber(); + } + if ($data->isInitialized('categoryAHazardousIndicator') && null !== $data->getCategoryAHazardousIndicator()) { + $dataArray['CategoryAHazardousIndicator'] = $data->getCategoryAHazardousIndicator(); + } + if ($data->isInitialized('directDeliveryIndicator') && null !== $data->getDirectDeliveryIndicator()) { + $dataArray['DirectDeliveryIndicator'] = $data->getDirectDeliveryIndicator(); + } + if ($data->isInitialized('packageReleaseCodeIndicator') && null !== $data->getPackageReleaseCodeIndicator()) { + $dataArray['PackageReleaseCodeIndicator'] = $data->getPackageReleaseCodeIndicator(); + } + if ($data->isInitialized('proactiveResponseIndicator') && null !== $data->getProactiveResponseIndicator()) { + $dataArray['ProactiveResponseIndicator'] = $data->getProactiveResponseIndicator(); + } + if ($data->isInitialized('whiteGloveDeliveryIndicator') && null !== $data->getWhiteGloveDeliveryIndicator()) { + $dataArray['WhiteGloveDeliveryIndicator'] = $data->getWhiteGloveDeliveryIndicator(); + } + if ($data->isInitialized('roomOfChoiceIndicator') && null !== $data->getRoomOfChoiceIndicator()) { + $dataArray['RoomOfChoiceIndicator'] = $data->getRoomOfChoiceIndicator(); + } + if ($data->isInitialized('installationDeliveryIndicator') && null !== $data->getInstallationDeliveryIndicator()) { + $dataArray['InstallationDeliveryIndicator'] = $data->getInstallationDeliveryIndicator(); + } + if ($data->isInitialized('itemDisposalIndicator') && null !== $data->getItemDisposalIndicator()) { + $dataArray['ItemDisposalIndicator'] = $data->getItemDisposalIndicator(); + } + if ($data->isInitialized('leadShipmentTrackingNumber') && null !== $data->getLeadShipmentTrackingNumber()) { + $dataArray['LeadShipmentTrackingNumber'] = $data->getLeadShipmentTrackingNumber(); + } + if ($data->isInitialized('saturdayNonPremiumCommercialDeliveryIndicator') && null !== $data->getSaturdayNonPremiumCommercialDeliveryIndicator()) { + $dataArray['SaturdayNonPremiumCommercialDeliveryIndicator'] = $data->getSaturdayNonPremiumCommercialDeliveryIndicator(); + } + if ($data->isInitialized('sundayNonPremiumCommercialDeliveryIndicator') && null !== $data->getSundayNonPremiumCommercialDeliveryIndicator()) { + $dataArray['SundayNonPremiumCommercialDeliveryIndicator'] = $data->getSundayNonPremiumCommercialDeliveryIndicator(); + } + if ($data->isInitialized('uPSPremierAccessorialIndicator') && null !== $data->getUPSPremierAccessorialIndicator()) { + $dataArray['UPSPremierAccessorialIndicator'] = $data->getUPSPremierAccessorialIndicator(); + } + if ($data->isInitialized('uPSPremierCategoryCode') && null !== $data->getUPSPremierCategoryCode()) { + $dataArray['UPSPremierCategoryCode'] = $data->getUPSPremierCategoryCode(); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SubscriptionFileManifest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SubscriptionFileOriginNormalizer.php b/src/Api/Normalizer/SubscriptionFileOriginNormalizer.php index b4accf89..2f6c650f 100644 --- a/src/Api/Normalizer/SubscriptionFileOriginNormalizer.php +++ b/src/Api/Normalizer/SubscriptionFileOriginNormalizer.php @@ -5,272 +5,135 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionFileOriginNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SubscriptionFileOriginNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class; + return $type === \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionFileOrigin(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageReferenceNumber', $data)) { - $values = []; - foreach ($data['PackageReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class, 'json', $context); - } - $object->setPackageReferenceNumber($values); - unset($data['PackageReferenceNumber']); - } - if (\array_key_exists('ShipmentReferenceNumber', $data)) { - $values_1 = []; - foreach ($data['ShipmentReferenceNumber'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class, 'json', $context); - } - $object->setShipmentReferenceNumber($values_1); - unset($data['ShipmentReferenceNumber']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - if (\array_key_exists('ActivityLocation', $data)) { - $object->setActivityLocation($this->denormalizer->denormalize($data['ActivityLocation'], \ShipStream\Ups\Api\Model\OriginActivityLocation::class, 'json', $context)); - unset($data['ActivityLocation']); - } - if (\array_key_exists('BillToAccount', $data)) { - $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\OriginBillToAccount::class, 'json', $context)); - unset($data['BillToAccount']); - } - if (\array_key_exists('ScheduledDeliveryDate', $data)) { - $object->setScheduledDeliveryDate($data['ScheduledDeliveryDate']); - unset($data['ScheduledDeliveryDate']); - } - if (\array_key_exists('ScheduledDeliveryTime', $data)) { - $object->setScheduledDeliveryTime($data['ScheduledDeliveryTime']); - unset($data['ScheduledDeliveryTime']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\SubscriptionFileOrigin(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('packageReferenceNumber') && null !== $object->getPackageReferenceNumber()) { - $values = []; - foreach ($object->getPackageReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PackageReferenceNumber'] = $values; - } - if ($object->isInitialized('shipmentReferenceNumber') && null !== $object->getShipmentReferenceNumber()) { - $values_1 = []; - foreach ($object->getShipmentReferenceNumber() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ShipmentReferenceNumber'] = $values_1; - } - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['TrackingNumber'] = $object->getTrackingNumber(); - $data['Date'] = $object->getDate(); - $data['Time'] = $object->getTime(); - if ($object->isInitialized('activityLocation') && null !== $object->getActivityLocation()) { - $data['ActivityLocation'] = $this->normalizer->normalize($object->getActivityLocation(), 'json', $context); - } - if ($object->isInitialized('billToAccount') && null !== $object->getBillToAccount()) { - $data['BillToAccount'] = $this->normalizer->normalize($object->getBillToAccount(), 'json', $context); - } - if ($object->isInitialized('scheduledDeliveryDate') && null !== $object->getScheduledDeliveryDate()) { - $data['ScheduledDeliveryDate'] = $object->getScheduledDeliveryDate(); - } - if ($object->isInitialized('scheduledDeliveryTime') && null !== $object->getScheduledDeliveryTime()) { - $data['ScheduledDeliveryTime'] = $object->getScheduledDeliveryTime(); + if (\array_key_exists('PackageReferenceNumber', $data)) { + $values = []; + foreach ($data['PackageReferenceNumber'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setPackageReferenceNumber($values); + unset($data['PackageReferenceNumber']); + } + if (\array_key_exists('ShipmentReferenceNumber', $data)) { + $values_1 = []; + foreach ($data['ShipmentReferenceNumber'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class, 'json', $context); } - return $data; + $object->setShipmentReferenceNumber($values_1); + unset($data['ShipmentReferenceNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class => false]; + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); } - } -} else { - class SubscriptionFileOriginNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class; + if (\array_key_exists('TrackingNumber', $data)) { + $object->setTrackingNumber($data['TrackingNumber']); + unset($data['TrackingNumber']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class; + if (\array_key_exists('Date', $data)) { + $object->setDate($data['Date']); + unset($data['Date']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionFileOrigin(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('PackageReferenceNumber', $data)) { - $values = []; - foreach ($data['PackageReferenceNumber'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\OriginPackageReferenceNumber::class, 'json', $context); - } - $object->setPackageReferenceNumber($values); - unset($data['PackageReferenceNumber']); - } - if (\array_key_exists('ShipmentReferenceNumber', $data)) { - $values_1 = []; - foreach ($data['ShipmentReferenceNumber'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\OriginShipmentReferenceNumber::class, 'json', $context); - } - $object->setShipmentReferenceNumber($values_1); - unset($data['ShipmentReferenceNumber']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('Date', $data)) { - $object->setDate($data['Date']); - unset($data['Date']); - } - if (\array_key_exists('Time', $data)) { - $object->setTime($data['Time']); - unset($data['Time']); - } - if (\array_key_exists('ActivityLocation', $data)) { - $object->setActivityLocation($this->denormalizer->denormalize($data['ActivityLocation'], \ShipStream\Ups\Api\Model\OriginActivityLocation::class, 'json', $context)); - unset($data['ActivityLocation']); - } - if (\array_key_exists('BillToAccount', $data)) { - $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\OriginBillToAccount::class, 'json', $context)); - unset($data['BillToAccount']); - } - if (\array_key_exists('ScheduledDeliveryDate', $data)) { - $object->setScheduledDeliveryDate($data['ScheduledDeliveryDate']); - unset($data['ScheduledDeliveryDate']); - } - if (\array_key_exists('ScheduledDeliveryTime', $data)) { - $object->setScheduledDeliveryTime($data['ScheduledDeliveryTime']); - unset($data['ScheduledDeliveryTime']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + if (\array_key_exists('Time', $data)) { + $object->setTime($data['Time']); + unset($data['Time']); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('packageReferenceNumber') && null !== $object->getPackageReferenceNumber()) { - $values = []; - foreach ($object->getPackageReferenceNumber() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PackageReferenceNumber'] = $values; - } - if ($object->isInitialized('shipmentReferenceNumber') && null !== $object->getShipmentReferenceNumber()) { - $values_1 = []; - foreach ($object->getShipmentReferenceNumber() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['ShipmentReferenceNumber'] = $values_1; - } - $data['ShipperNumber'] = $object->getShipperNumber(); - $data['TrackingNumber'] = $object->getTrackingNumber(); - $data['Date'] = $object->getDate(); - $data['Time'] = $object->getTime(); - if ($object->isInitialized('activityLocation') && null !== $object->getActivityLocation()) { - $data['ActivityLocation'] = $this->normalizer->normalize($object->getActivityLocation(), 'json', $context); - } - if ($object->isInitialized('billToAccount') && null !== $object->getBillToAccount()) { - $data['BillToAccount'] = $this->normalizer->normalize($object->getBillToAccount(), 'json', $context); - } - if ($object->isInitialized('scheduledDeliveryDate') && null !== $object->getScheduledDeliveryDate()) { - $data['ScheduledDeliveryDate'] = $object->getScheduledDeliveryDate(); + if (\array_key_exists('ActivityLocation', $data)) { + $object->setActivityLocation($this->denormalizer->denormalize($data['ActivityLocation'], \ShipStream\Ups\Api\Model\OriginActivityLocation::class, 'json', $context)); + unset($data['ActivityLocation']); + } + if (\array_key_exists('BillToAccount', $data)) { + $object->setBillToAccount($this->denormalizer->denormalize($data['BillToAccount'], \ShipStream\Ups\Api\Model\OriginBillToAccount::class, 'json', $context)); + unset($data['BillToAccount']); + } + if (\array_key_exists('ScheduledDeliveryDate', $data)) { + $object->setScheduledDeliveryDate($data['ScheduledDeliveryDate']); + unset($data['ScheduledDeliveryDate']); + } + if (\array_key_exists('ScheduledDeliveryTime', $data)) { + $object->setScheduledDeliveryTime($data['ScheduledDeliveryTime']); + unset($data['ScheduledDeliveryTime']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; } - if ($object->isInitialized('scheduledDeliveryTime') && null !== $object->getScheduledDeliveryTime()) { - $data['ScheduledDeliveryTime'] = $object->getScheduledDeliveryTime(); + } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('packageReferenceNumber') && null !== $data->getPackageReferenceNumber()) { + $values = []; + foreach ($data->getPackageReferenceNumber() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $dataArray['PackageReferenceNumber'] = $values; + } + if ($data->isInitialized('shipmentReferenceNumber') && null !== $data->getShipmentReferenceNumber()) { + $values_1 = []; + foreach ($data->getShipmentReferenceNumber() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['ShipmentReferenceNumber'] = $values_1; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class => false]; + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + $dataArray['TrackingNumber'] = $data->getTrackingNumber(); + $dataArray['Date'] = $data->getDate(); + $dataArray['Time'] = $data->getTime(); + if ($data->isInitialized('activityLocation') && null !== $data->getActivityLocation()) { + $dataArray['ActivityLocation'] = $this->normalizer->normalize($data->getActivityLocation(), 'json', $context); } + if ($data->isInitialized('billToAccount') && null !== $data->getBillToAccount()) { + $dataArray['BillToAccount'] = $this->normalizer->normalize($data->getBillToAccount(), 'json', $context); + } + if ($data->isInitialized('scheduledDeliveryDate') && null !== $data->getScheduledDeliveryDate()) { + $dataArray['ScheduledDeliveryDate'] = $data->getScheduledDeliveryDate(); + } + if ($data->isInitialized('scheduledDeliveryTime') && null !== $data->getScheduledDeliveryTime()) { + $dataArray['ScheduledDeliveryTime'] = $data->getScheduledDeliveryTime(); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SubscriptionFileOrigin::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SubscriptionFileStatusTypeNormalizer.php b/src/Api/Normalizer/SubscriptionFileStatusTypeNormalizer.php index 7bb04cbe..2ad4c023 100644 --- a/src/Api/Normalizer/SubscriptionFileStatusTypeNormalizer.php +++ b/src/Api/Normalizer/SubscriptionFileStatusTypeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionFileStatusTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SubscriptionFileStatusTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class; + return $type === \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionFileStatusType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SubscriptionFileStatusType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class => false]; - } - } -} else { - class SubscriptionFileStatusTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionFileStatusType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SubscriptionFileStatusType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SubscriptionRequestDateTimeRangeNormalizer.php b/src/Api/Normalizer/SubscriptionRequestDateTimeRangeNormalizer.php index 2ec9c284..19fbfd68 100644 --- a/src/Api/Normalizer/SubscriptionRequestDateTimeRangeNormalizer.php +++ b/src/Api/Normalizer/SubscriptionRequestDateTimeRangeNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionRequestDateTimeRangeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SubscriptionRequestDateTimeRangeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class; + return $type === \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BeginDateTime', $data)) { - $object->setBeginDateTime($data['BeginDateTime']); - unset($data['BeginDateTime']); - } - if (\array_key_exists('EndDateTime', $data)) { - $object->setEndDateTime($data['EndDateTime']); - unset($data['EndDateTime']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('beginDateTime') && null !== $object->getBeginDateTime()) { - $data['BeginDateTime'] = $object->getBeginDateTime(); - } - if ($object->isInitialized('endDateTime') && null !== $object->getEndDateTime()) { - $data['EndDateTime'] = $object->getEndDateTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('BeginDateTime', $data)) { + $object->setBeginDateTime($data['BeginDateTime']); + unset($data['BeginDateTime']); + } + if (\array_key_exists('EndDateTime', $data)) { + $object->setEndDateTime($data['EndDateTime']); + unset($data['EndDateTime']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class SubscriptionRequestDateTimeRangeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class; + $dataArray = []; + if ($data->isInitialized('beginDateTime') && null !== $data->getBeginDateTime()) { + $dataArray['BeginDateTime'] = $data->getBeginDateTime(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BeginDateTime', $data)) { - $object->setBeginDateTime($data['BeginDateTime']); - unset($data['BeginDateTime']); - } - if (\array_key_exists('EndDateTime', $data)) { - $object->setEndDateTime($data['EndDateTime']); - unset($data['EndDateTime']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('endDateTime') && null !== $data->getEndDateTime()) { + $dataArray['EndDateTime'] = $data->getEndDateTime(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('beginDateTime') && null !== $object->getBeginDateTime()) { - $data['BeginDateTime'] = $object->getBeginDateTime(); - } - if ($object->isInitialized('endDateTime') && null !== $object->getEndDateTime()) { - $data['EndDateTime'] = $object->getEndDateTime(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SubscriptionRequestDateTimeRange::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/SummaryResultStatusNormalizer.php b/src/Api/Normalizer/SummaryResultStatusNormalizer.php index 86bad325..d6c81cdb 100644 --- a/src/Api/Normalizer/SummaryResultStatusNormalizer.php +++ b/src/Api/Normalizer/SummaryResultStatusNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SummaryResultStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class SummaryResultStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SummaryResultStatus::class; + return $type === \ShipStream\Ups\Api\Model\SummaryResultStatus::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SummaryResultStatus::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SummaryResultStatus::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SummaryResultStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\SummaryResultStatus(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SummaryResultStatus::class => false]; - } - } -} else { - class SummaryResultStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\SummaryResultStatus::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\SummaryResultStatus::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\SummaryResultStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\SummaryResultStatus::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\SummaryResultStatus::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/TimeInTransitRequestNormalizer.php b/src/Api/Normalizer/TimeInTransitRequestNormalizer.php index b93ab1b7..b96097b1 100644 --- a/src/Api/Normalizer/TimeInTransitRequestNormalizer.php +++ b/src/Api/Normalizer/TimeInTransitRequestNormalizer.php @@ -5,460 +5,235 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class TimeInTransitRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class TimeInTransitRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TimeInTransitRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TimeInTransitRequest::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TimeInTransitRequest(); - if (\array_key_exists('weight', $data) && \is_int($data['weight'])) { - $data['weight'] = (double) $data['weight']; - } - if (\array_key_exists('shipmentContentsValue', $data) && \is_int($data['shipmentContentsValue'])) { - $data['shipmentContentsValue'] = (double) $data['shipmentContentsValue']; - } - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('originCountryCode', $data)) { - $object->setOriginCountryCode($data['originCountryCode']); - unset($data['originCountryCode']); - } - if (\array_key_exists('originStateProvince', $data)) { - $object->setOriginStateProvince($data['originStateProvince']); - unset($data['originStateProvince']); - } - if (\array_key_exists('originCityName', $data)) { - $object->setOriginCityName($data['originCityName']); - unset($data['originCityName']); - } - if (\array_key_exists('originTownName', $data)) { - $object->setOriginTownName($data['originTownName']); - unset($data['originTownName']); - } - if (\array_key_exists('originPostalCode', $data)) { - $object->setOriginPostalCode($data['originPostalCode']); - unset($data['originPostalCode']); - } - if (\array_key_exists('destinationCountryCode', $data)) { - $object->setDestinationCountryCode($data['destinationCountryCode']); - unset($data['destinationCountryCode']); - } - if (\array_key_exists('destinationStateProvince', $data)) { - $object->setDestinationStateProvince($data['destinationStateProvince']); - unset($data['destinationStateProvince']); - } - if (\array_key_exists('destinationCityName', $data)) { - $object->setDestinationCityName($data['destinationCityName']); - unset($data['destinationCityName']); - } - if (\array_key_exists('destinationTownName', $data)) { - $object->setDestinationTownName($data['destinationTownName']); - unset($data['destinationTownName']); - } - if (\array_key_exists('destinationPostalCode', $data)) { - $object->setDestinationPostalCode($data['destinationPostalCode']); - unset($data['destinationPostalCode']); - } - if (\array_key_exists('residentialIndicator', $data)) { - $object->setResidentialIndicator($data['residentialIndicator']); - unset($data['residentialIndicator']); - } - if (\array_key_exists('shipDate', $data)) { - $object->setShipDate($data['shipDate']); - unset($data['shipDate']); - } - if (\array_key_exists('shipTime', $data)) { - $object->setShipTime($data['shipTime']); - unset($data['shipTime']); - } - if (\array_key_exists('weight', $data)) { - $object->setWeight($data['weight']); - unset($data['weight']); - } - if (\array_key_exists('weightUnitOfMeasure', $data)) { - $object->setWeightUnitOfMeasure($data['weightUnitOfMeasure']); - unset($data['weightUnitOfMeasure']); - } - if (\array_key_exists('shipmentContentsValue', $data)) { - $object->setShipmentContentsValue($data['shipmentContentsValue']); - unset($data['shipmentContentsValue']); - } - if (\array_key_exists('shipmentContentsCurrencyCode', $data)) { - $object->setShipmentContentsCurrencyCode($data['shipmentContentsCurrencyCode']); - unset($data['shipmentContentsCurrencyCode']); - } - if (\array_key_exists('billType', $data)) { - $object->setBillType($data['billType']); - unset($data['billType']); - } - if (\array_key_exists('avvFlag', $data)) { - $object->setAvvFlag($data['avvFlag']); - unset($data['avvFlag']); - } - if (\array_key_exists('numberOfPackages', $data)) { - $object->setNumberOfPackages($data['numberOfPackages']); - unset($data['numberOfPackages']); - } - if (\array_key_exists('dropOffAtFacilityIndicator', $data)) { - $object->setDropOffAtFacilityIndicator($data['dropOffAtFacilityIndicator']); - unset($data['dropOffAtFacilityIndicator']); - } - if (\array_key_exists('holdForPickupIndicator', $data)) { - $object->setHoldForPickupIndicator($data['holdForPickupIndicator']); - unset($data['holdForPickupIndicator']); - } - if (\array_key_exists('returnUnfilterdServices', $data)) { - $object->setReturnUnfilterdServices($data['returnUnfilterdServices']); - unset($data['returnUnfilterdServices']); - } - if (\array_key_exists('maxList', $data)) { - $object->setMaxList($data['maxList']); - unset($data['maxList']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\TimeInTransitRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TimeInTransitRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\TimeInTransitRequest(); + if (\array_key_exists('weight', $data) && \is_int($data['weight'])) { + $data['weight'] = (double) $data['weight']; + } + if (\array_key_exists('shipmentContentsValue', $data) && \is_int($data['shipmentContentsValue'])) { + $data['shipmentContentsValue'] = (double) $data['shipmentContentsValue']; + } + if (\array_key_exists('avvFlag', $data) && \is_int($data['avvFlag'])) { + $data['avvFlag'] = (bool) $data['avvFlag']; + } + if (\array_key_exists('returnUnfilterdServices', $data) && \is_int($data['returnUnfilterdServices'])) { + $data['returnUnfilterdServices'] = (bool) $data['returnUnfilterdServices']; + } + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['originCountryCode'] = $object->getOriginCountryCode(); - if ($object->isInitialized('originStateProvince') && null !== $object->getOriginStateProvince()) { - $data['originStateProvince'] = $object->getOriginStateProvince(); - } - if ($object->isInitialized('originCityName') && null !== $object->getOriginCityName()) { - $data['originCityName'] = $object->getOriginCityName(); - } - if ($object->isInitialized('originTownName') && null !== $object->getOriginTownName()) { - $data['originTownName'] = $object->getOriginTownName(); - } - if ($object->isInitialized('originPostalCode') && null !== $object->getOriginPostalCode()) { - $data['originPostalCode'] = $object->getOriginPostalCode(); - } - if ($object->isInitialized('destinationCountryCode') && null !== $object->getDestinationCountryCode()) { - $data['destinationCountryCode'] = $object->getDestinationCountryCode(); - } - if ($object->isInitialized('destinationStateProvince') && null !== $object->getDestinationStateProvince()) { - $data['destinationStateProvince'] = $object->getDestinationStateProvince(); - } - if ($object->isInitialized('destinationCityName') && null !== $object->getDestinationCityName()) { - $data['destinationCityName'] = $object->getDestinationCityName(); - } - if ($object->isInitialized('destinationTownName') && null !== $object->getDestinationTownName()) { - $data['destinationTownName'] = $object->getDestinationTownName(); - } - if ($object->isInitialized('destinationPostalCode') && null !== $object->getDestinationPostalCode()) { - $data['destinationPostalCode'] = $object->getDestinationPostalCode(); - } - if ($object->isInitialized('residentialIndicator') && null !== $object->getResidentialIndicator()) { - $data['residentialIndicator'] = $object->getResidentialIndicator(); - } - if ($object->isInitialized('shipDate') && null !== $object->getShipDate()) { - $data['shipDate'] = $object->getShipDate(); - } - if ($object->isInitialized('shipTime') && null !== $object->getShipTime()) { - $data['shipTime'] = $object->getShipTime(); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['weight'] = $object->getWeight(); - } - if ($object->isInitialized('weightUnitOfMeasure') && null !== $object->getWeightUnitOfMeasure()) { - $data['weightUnitOfMeasure'] = $object->getWeightUnitOfMeasure(); - } - if ($object->isInitialized('shipmentContentsValue') && null !== $object->getShipmentContentsValue()) { - $data['shipmentContentsValue'] = $object->getShipmentContentsValue(); - } - if ($object->isInitialized('shipmentContentsCurrencyCode') && null !== $object->getShipmentContentsCurrencyCode()) { - $data['shipmentContentsCurrencyCode'] = $object->getShipmentContentsCurrencyCode(); - } - if ($object->isInitialized('billType') && null !== $object->getBillType()) { - $data['billType'] = $object->getBillType(); - } - if ($object->isInitialized('avvFlag') && null !== $object->getAvvFlag()) { - $data['avvFlag'] = $object->getAvvFlag(); - } - if ($object->isInitialized('numberOfPackages') && null !== $object->getNumberOfPackages()) { - $data['numberOfPackages'] = $object->getNumberOfPackages(); - } - if ($object->isInitialized('dropOffAtFacilityIndicator') && null !== $object->getDropOffAtFacilityIndicator()) { - $data['dropOffAtFacilityIndicator'] = $object->getDropOffAtFacilityIndicator(); - } - if ($object->isInitialized('holdForPickupIndicator') && null !== $object->getHoldForPickupIndicator()) { - $data['holdForPickupIndicator'] = $object->getHoldForPickupIndicator(); - } - if ($object->isInitialized('returnUnfilterdServices') && null !== $object->getReturnUnfilterdServices()) { - $data['returnUnfilterdServices'] = $object->getReturnUnfilterdServices(); - } - if ($object->isInitialized('maxList') && null !== $object->getMaxList()) { - $data['maxList'] = $object->getMaxList(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('originCountryCode', $data)) { + $object->setOriginCountryCode($data['originCountryCode']); + unset($data['originCountryCode']); + } + if (\array_key_exists('originStateProvince', $data)) { + $object->setOriginStateProvince($data['originStateProvince']); + unset($data['originStateProvince']); + } + if (\array_key_exists('originCityName', $data)) { + $object->setOriginCityName($data['originCityName']); + unset($data['originCityName']); + } + if (\array_key_exists('originTownName', $data)) { + $object->setOriginTownName($data['originTownName']); + unset($data['originTownName']); + } + if (\array_key_exists('originPostalCode', $data)) { + $object->setOriginPostalCode($data['originPostalCode']); + unset($data['originPostalCode']); + } + if (\array_key_exists('destinationCountryCode', $data)) { + $object->setDestinationCountryCode($data['destinationCountryCode']); + unset($data['destinationCountryCode']); + } + if (\array_key_exists('destinationStateProvince', $data)) { + $object->setDestinationStateProvince($data['destinationStateProvince']); + unset($data['destinationStateProvince']); + } + if (\array_key_exists('destinationCityName', $data)) { + $object->setDestinationCityName($data['destinationCityName']); + unset($data['destinationCityName']); + } + if (\array_key_exists('destinationTownName', $data)) { + $object->setDestinationTownName($data['destinationTownName']); + unset($data['destinationTownName']); + } + if (\array_key_exists('destinationPostalCode', $data)) { + $object->setDestinationPostalCode($data['destinationPostalCode']); + unset($data['destinationPostalCode']); + } + if (\array_key_exists('residentialIndicator', $data)) { + $object->setResidentialIndicator($data['residentialIndicator']); + unset($data['residentialIndicator']); + } + if (\array_key_exists('shipDate', $data)) { + $object->setShipDate($data['shipDate']); + unset($data['shipDate']); + } + if (\array_key_exists('shipTime', $data)) { + $object->setShipTime($data['shipTime']); + unset($data['shipTime']); + } + if (\array_key_exists('weight', $data)) { + $object->setWeight($data['weight']); + unset($data['weight']); + } + if (\array_key_exists('weightUnitOfMeasure', $data)) { + $object->setWeightUnitOfMeasure($data['weightUnitOfMeasure']); + unset($data['weightUnitOfMeasure']); + } + if (\array_key_exists('shipmentContentsValue', $data)) { + $object->setShipmentContentsValue($data['shipmentContentsValue']); + unset($data['shipmentContentsValue']); + } + if (\array_key_exists('shipmentContentsCurrencyCode', $data)) { + $object->setShipmentContentsCurrencyCode($data['shipmentContentsCurrencyCode']); + unset($data['shipmentContentsCurrencyCode']); + } + if (\array_key_exists('billType', $data)) { + $object->setBillType($data['billType']); + unset($data['billType']); + } + if (\array_key_exists('avvFlag', $data)) { + $object->setAvvFlag($data['avvFlag']); + unset($data['avvFlag']); + } + if (\array_key_exists('numberOfPackages', $data)) { + $object->setNumberOfPackages($data['numberOfPackages']); + unset($data['numberOfPackages']); + } + if (\array_key_exists('dropOffAtFacilityIndicator', $data)) { + $object->setDropOffAtFacilityIndicator($data['dropOffAtFacilityIndicator']); + unset($data['dropOffAtFacilityIndicator']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TimeInTransitRequest::class => false]; + if (\array_key_exists('holdForPickupIndicator', $data)) { + $object->setHoldForPickupIndicator($data['holdForPickupIndicator']); + unset($data['holdForPickupIndicator']); } + if (\array_key_exists('returnUnfilterdServices', $data)) { + $object->setReturnUnfilterdServices($data['returnUnfilterdServices']); + unset($data['returnUnfilterdServices']); + } + if (\array_key_exists('maxList', $data)) { + $object->setMaxList($data['maxList']); + unset($data['maxList']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class TimeInTransitRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TimeInTransitRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TimeInTransitRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TimeInTransitRequest(); - if (\array_key_exists('weight', $data) && \is_int($data['weight'])) { - $data['weight'] = (double) $data['weight']; - } - if (\array_key_exists('shipmentContentsValue', $data) && \is_int($data['shipmentContentsValue'])) { - $data['shipmentContentsValue'] = (double) $data['shipmentContentsValue']; - } - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('originCountryCode', $data)) { - $object->setOriginCountryCode($data['originCountryCode']); - unset($data['originCountryCode']); - } - if (\array_key_exists('originStateProvince', $data)) { - $object->setOriginStateProvince($data['originStateProvince']); - unset($data['originStateProvince']); - } - if (\array_key_exists('originCityName', $data)) { - $object->setOriginCityName($data['originCityName']); - unset($data['originCityName']); - } - if (\array_key_exists('originTownName', $data)) { - $object->setOriginTownName($data['originTownName']); - unset($data['originTownName']); - } - if (\array_key_exists('originPostalCode', $data)) { - $object->setOriginPostalCode($data['originPostalCode']); - unset($data['originPostalCode']); - } - if (\array_key_exists('destinationCountryCode', $data)) { - $object->setDestinationCountryCode($data['destinationCountryCode']); - unset($data['destinationCountryCode']); - } - if (\array_key_exists('destinationStateProvince', $data)) { - $object->setDestinationStateProvince($data['destinationStateProvince']); - unset($data['destinationStateProvince']); - } - if (\array_key_exists('destinationCityName', $data)) { - $object->setDestinationCityName($data['destinationCityName']); - unset($data['destinationCityName']); - } - if (\array_key_exists('destinationTownName', $data)) { - $object->setDestinationTownName($data['destinationTownName']); - unset($data['destinationTownName']); - } - if (\array_key_exists('destinationPostalCode', $data)) { - $object->setDestinationPostalCode($data['destinationPostalCode']); - unset($data['destinationPostalCode']); - } - if (\array_key_exists('residentialIndicator', $data)) { - $object->setResidentialIndicator($data['residentialIndicator']); - unset($data['residentialIndicator']); - } - if (\array_key_exists('shipDate', $data)) { - $object->setShipDate($data['shipDate']); - unset($data['shipDate']); - } - if (\array_key_exists('shipTime', $data)) { - $object->setShipTime($data['shipTime']); - unset($data['shipTime']); - } - if (\array_key_exists('weight', $data)) { - $object->setWeight($data['weight']); - unset($data['weight']); - } - if (\array_key_exists('weightUnitOfMeasure', $data)) { - $object->setWeightUnitOfMeasure($data['weightUnitOfMeasure']); - unset($data['weightUnitOfMeasure']); - } - if (\array_key_exists('shipmentContentsValue', $data)) { - $object->setShipmentContentsValue($data['shipmentContentsValue']); - unset($data['shipmentContentsValue']); - } - if (\array_key_exists('shipmentContentsCurrencyCode', $data)) { - $object->setShipmentContentsCurrencyCode($data['shipmentContentsCurrencyCode']); - unset($data['shipmentContentsCurrencyCode']); - } - if (\array_key_exists('billType', $data)) { - $object->setBillType($data['billType']); - unset($data['billType']); - } - if (\array_key_exists('avvFlag', $data)) { - $object->setAvvFlag($data['avvFlag']); - unset($data['avvFlag']); - } - if (\array_key_exists('numberOfPackages', $data)) { - $object->setNumberOfPackages($data['numberOfPackages']); - unset($data['numberOfPackages']); - } - if (\array_key_exists('dropOffAtFacilityIndicator', $data)) { - $object->setDropOffAtFacilityIndicator($data['dropOffAtFacilityIndicator']); - unset($data['dropOffAtFacilityIndicator']); - } - if (\array_key_exists('holdForPickupIndicator', $data)) { - $object->setHoldForPickupIndicator($data['holdForPickupIndicator']); - unset($data['holdForPickupIndicator']); - } - if (\array_key_exists('returnUnfilterdServices', $data)) { - $object->setReturnUnfilterdServices($data['returnUnfilterdServices']); - unset($data['returnUnfilterdServices']); - } - if (\array_key_exists('maxList', $data)) { - $object->setMaxList($data['maxList']); - unset($data['maxList']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['originCountryCode'] = $data->getOriginCountryCode(); + if ($data->isInitialized('originStateProvince') && null !== $data->getOriginStateProvince()) { + $dataArray['originStateProvince'] = $data->getOriginStateProvince(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['originCountryCode'] = $object->getOriginCountryCode(); - if ($object->isInitialized('originStateProvince') && null !== $object->getOriginStateProvince()) { - $data['originStateProvince'] = $object->getOriginStateProvince(); - } - if ($object->isInitialized('originCityName') && null !== $object->getOriginCityName()) { - $data['originCityName'] = $object->getOriginCityName(); - } - if ($object->isInitialized('originTownName') && null !== $object->getOriginTownName()) { - $data['originTownName'] = $object->getOriginTownName(); - } - if ($object->isInitialized('originPostalCode') && null !== $object->getOriginPostalCode()) { - $data['originPostalCode'] = $object->getOriginPostalCode(); - } - if ($object->isInitialized('destinationCountryCode') && null !== $object->getDestinationCountryCode()) { - $data['destinationCountryCode'] = $object->getDestinationCountryCode(); - } - if ($object->isInitialized('destinationStateProvince') && null !== $object->getDestinationStateProvince()) { - $data['destinationStateProvince'] = $object->getDestinationStateProvince(); - } - if ($object->isInitialized('destinationCityName') && null !== $object->getDestinationCityName()) { - $data['destinationCityName'] = $object->getDestinationCityName(); - } - if ($object->isInitialized('destinationTownName') && null !== $object->getDestinationTownName()) { - $data['destinationTownName'] = $object->getDestinationTownName(); - } - if ($object->isInitialized('destinationPostalCode') && null !== $object->getDestinationPostalCode()) { - $data['destinationPostalCode'] = $object->getDestinationPostalCode(); - } - if ($object->isInitialized('residentialIndicator') && null !== $object->getResidentialIndicator()) { - $data['residentialIndicator'] = $object->getResidentialIndicator(); - } - if ($object->isInitialized('shipDate') && null !== $object->getShipDate()) { - $data['shipDate'] = $object->getShipDate(); - } - if ($object->isInitialized('shipTime') && null !== $object->getShipTime()) { - $data['shipTime'] = $object->getShipTime(); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['weight'] = $object->getWeight(); - } - if ($object->isInitialized('weightUnitOfMeasure') && null !== $object->getWeightUnitOfMeasure()) { - $data['weightUnitOfMeasure'] = $object->getWeightUnitOfMeasure(); - } - if ($object->isInitialized('shipmentContentsValue') && null !== $object->getShipmentContentsValue()) { - $data['shipmentContentsValue'] = $object->getShipmentContentsValue(); - } - if ($object->isInitialized('shipmentContentsCurrencyCode') && null !== $object->getShipmentContentsCurrencyCode()) { - $data['shipmentContentsCurrencyCode'] = $object->getShipmentContentsCurrencyCode(); - } - if ($object->isInitialized('billType') && null !== $object->getBillType()) { - $data['billType'] = $object->getBillType(); - } - if ($object->isInitialized('avvFlag') && null !== $object->getAvvFlag()) { - $data['avvFlag'] = $object->getAvvFlag(); - } - if ($object->isInitialized('numberOfPackages') && null !== $object->getNumberOfPackages()) { - $data['numberOfPackages'] = $object->getNumberOfPackages(); - } - if ($object->isInitialized('dropOffAtFacilityIndicator') && null !== $object->getDropOffAtFacilityIndicator()) { - $data['dropOffAtFacilityIndicator'] = $object->getDropOffAtFacilityIndicator(); - } - if ($object->isInitialized('holdForPickupIndicator') && null !== $object->getHoldForPickupIndicator()) { - $data['holdForPickupIndicator'] = $object->getHoldForPickupIndicator(); - } - if ($object->isInitialized('returnUnfilterdServices') && null !== $object->getReturnUnfilterdServices()) { - $data['returnUnfilterdServices'] = $object->getReturnUnfilterdServices(); - } - if ($object->isInitialized('maxList') && null !== $object->getMaxList()) { - $data['maxList'] = $object->getMaxList(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('originCityName') && null !== $data->getOriginCityName()) { + $dataArray['originCityName'] = $data->getOriginCityName(); + } + if ($data->isInitialized('originTownName') && null !== $data->getOriginTownName()) { + $dataArray['originTownName'] = $data->getOriginTownName(); + } + if ($data->isInitialized('originPostalCode') && null !== $data->getOriginPostalCode()) { + $dataArray['originPostalCode'] = $data->getOriginPostalCode(); + } + if ($data->isInitialized('destinationCountryCode') && null !== $data->getDestinationCountryCode()) { + $dataArray['destinationCountryCode'] = $data->getDestinationCountryCode(); + } + if ($data->isInitialized('destinationStateProvince') && null !== $data->getDestinationStateProvince()) { + $dataArray['destinationStateProvince'] = $data->getDestinationStateProvince(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TimeInTransitRequest::class => false]; + if ($data->isInitialized('destinationCityName') && null !== $data->getDestinationCityName()) { + $dataArray['destinationCityName'] = $data->getDestinationCityName(); } + if ($data->isInitialized('destinationTownName') && null !== $data->getDestinationTownName()) { + $dataArray['destinationTownName'] = $data->getDestinationTownName(); + } + if ($data->isInitialized('destinationPostalCode') && null !== $data->getDestinationPostalCode()) { + $dataArray['destinationPostalCode'] = $data->getDestinationPostalCode(); + } + if ($data->isInitialized('residentialIndicator') && null !== $data->getResidentialIndicator()) { + $dataArray['residentialIndicator'] = $data->getResidentialIndicator(); + } + if ($data->isInitialized('shipDate') && null !== $data->getShipDate()) { + $dataArray['shipDate'] = $data->getShipDate(); + } + if ($data->isInitialized('shipTime') && null !== $data->getShipTime()) { + $dataArray['shipTime'] = $data->getShipTime(); + } + if ($data->isInitialized('weight') && null !== $data->getWeight()) { + $dataArray['weight'] = $data->getWeight(); + } + if ($data->isInitialized('weightUnitOfMeasure') && null !== $data->getWeightUnitOfMeasure()) { + $dataArray['weightUnitOfMeasure'] = $data->getWeightUnitOfMeasure(); + } + if ($data->isInitialized('shipmentContentsValue') && null !== $data->getShipmentContentsValue()) { + $dataArray['shipmentContentsValue'] = $data->getShipmentContentsValue(); + } + if ($data->isInitialized('shipmentContentsCurrencyCode') && null !== $data->getShipmentContentsCurrencyCode()) { + $dataArray['shipmentContentsCurrencyCode'] = $data->getShipmentContentsCurrencyCode(); + } + if ($data->isInitialized('billType') && null !== $data->getBillType()) { + $dataArray['billType'] = $data->getBillType(); + } + if ($data->isInitialized('avvFlag') && null !== $data->getAvvFlag()) { + $dataArray['avvFlag'] = $data->getAvvFlag(); + } + if ($data->isInitialized('numberOfPackages') && null !== $data->getNumberOfPackages()) { + $dataArray['numberOfPackages'] = $data->getNumberOfPackages(); + } + if ($data->isInitialized('dropOffAtFacilityIndicator') && null !== $data->getDropOffAtFacilityIndicator()) { + $dataArray['dropOffAtFacilityIndicator'] = $data->getDropOffAtFacilityIndicator(); + } + if ($data->isInitialized('holdForPickupIndicator') && null !== $data->getHoldForPickupIndicator()) { + $dataArray['holdForPickupIndicator'] = $data->getHoldForPickupIndicator(); + } + if ($data->isInitialized('returnUnfilterdServices') && null !== $data->getReturnUnfilterdServices()) { + $dataArray['returnUnfilterdServices'] = $data->getReturnUnfilterdServices(); + } + if ($data->isInitialized('maxList') && null !== $data->getMaxList()) { + $dataArray['maxList'] = $data->getMaxList(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\TimeInTransitRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/TimeInTransitResponseNormalizer.php b/src/Api/Normalizer/TimeInTransitResponseNormalizer.php index bde03867..9eb6f759 100644 --- a/src/Api/Normalizer/TimeInTransitResponseNormalizer.php +++ b/src/Api/Normalizer/TimeInTransitResponseNormalizer.php @@ -5,204 +5,101 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class TimeInTransitResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class TimeInTransitResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TimeInTransitResponse::class; + return $type === \ShipStream\Ups\Api\Model\TimeInTransitResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TimeInTransitResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TimeInTransitResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TimeInTransitResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('validationList', $data)) { - $object->setValidationList($this->denormalizer->denormalize($data['validationList'], \ShipStream\Ups\Api\Model\ValidationList::class, 'json', $context)); - unset($data['validationList']); - } - if (\array_key_exists('destinationPickList', $data)) { - $values = []; - foreach ($data['destinationPickList'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\CandidateAddress::class, 'json', $context); - } - $object->setDestinationPickList($values); - unset($data['destinationPickList']); - } - if (\array_key_exists('originPickList', $data)) { - $values_1 = []; - foreach ($data['originPickList'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\CandidateAddress::class, 'json', $context); - } - $object->setOriginPickList($values_1); - unset($data['originPickList']); - } - if (\array_key_exists('emsResponse', $data)) { - $object->setEmsResponse($this->denormalizer->denormalize($data['emsResponse'], \ShipStream\Ups\Api\Model\EmsResponse::class, 'json', $context)); - unset($data['emsResponse']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\TimeInTransitResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('validationList') && null !== $object->getValidationList()) { - $data['validationList'] = $this->normalizer->normalize($object->getValidationList(), 'json', $context); - } - if ($object->isInitialized('destinationPickList') && null !== $object->getDestinationPickList()) { - $values = []; - foreach ($object->getDestinationPickList() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['destinationPickList'] = $values; - } - if ($object->isInitialized('originPickList') && null !== $object->getOriginPickList()) { - $values_1 = []; - foreach ($object->getOriginPickList() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['originPickList'] = $values_1; - } - if ($object->isInitialized('emsResponse') && null !== $object->getEmsResponse()) { - $data['emsResponse'] = $this->normalizer->normalize($object->getEmsResponse(), 'json', $context); + if (\array_key_exists('validationList', $data)) { + $object->setValidationList($this->denormalizer->denormalize($data['validationList'], \ShipStream\Ups\Api\Model\ValidationList::class, 'json', $context)); + unset($data['validationList']); + } + if (\array_key_exists('destinationPickList', $data)) { + $values = []; + foreach ($data['destinationPickList'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\CandidateAddress::class, 'json', $context); } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setDestinationPickList($values); + unset($data['destinationPickList']); + } + if (\array_key_exists('originPickList', $data)) { + $values_1 = []; + foreach ($data['originPickList'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\CandidateAddress::class, 'json', $context); } - return $data; + $object->setOriginPickList($values_1); + unset($data['originPickList']); + } + if (\array_key_exists('emsResponse', $data)) { + $object->setEmsResponse($this->denormalizer->denormalize($data['emsResponse'], \ShipStream\Ups\Api\Model\EmsResponse::class, 'json', $context)); + unset($data['emsResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TimeInTransitResponse::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } } + return $object; } -} else { - class TimeInTransitResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TimeInTransitResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TimeInTransitResponse::class; + $dataArray = []; + if ($data->isInitialized('validationList') && null !== $data->getValidationList()) { + $dataArray['validationList'] = $this->normalizer->normalize($data->getValidationList(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TimeInTransitResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('validationList', $data)) { - $object->setValidationList($this->denormalizer->denormalize($data['validationList'], \ShipStream\Ups\Api\Model\ValidationList::class, 'json', $context)); - unset($data['validationList']); - } - if (\array_key_exists('destinationPickList', $data)) { - $values = []; - foreach ($data['destinationPickList'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\CandidateAddress::class, 'json', $context); - } - $object->setDestinationPickList($values); - unset($data['destinationPickList']); - } - if (\array_key_exists('originPickList', $data)) { - $values_1 = []; - foreach ($data['originPickList'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, \ShipStream\Ups\Api\Model\CandidateAddress::class, 'json', $context); - } - $object->setOriginPickList($values_1); - unset($data['originPickList']); - } - if (\array_key_exists('emsResponse', $data)) { - $object->setEmsResponse($this->denormalizer->denormalize($data['emsResponse'], \ShipStream\Ups\Api\Model\EmsResponse::class, 'json', $context)); - unset($data['emsResponse']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } + if ($data->isInitialized('destinationPickList') && null !== $data->getDestinationPickList()) { + $values = []; + foreach ($data->getDestinationPickList() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['destinationPickList'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('validationList') && null !== $object->getValidationList()) { - $data['validationList'] = $this->normalizer->normalize($object->getValidationList(), 'json', $context); - } - if ($object->isInitialized('destinationPickList') && null !== $object->getDestinationPickList()) { - $values = []; - foreach ($object->getDestinationPickList() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['destinationPickList'] = $values; - } - if ($object->isInitialized('originPickList') && null !== $object->getOriginPickList()) { - $values_1 = []; - foreach ($object->getOriginPickList() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['originPickList'] = $values_1; - } - if ($object->isInitialized('emsResponse') && null !== $object->getEmsResponse()) { - $data['emsResponse'] = $this->normalizer->normalize($object->getEmsResponse(), 'json', $context); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + if ($data->isInitialized('originPickList') && null !== $data->getOriginPickList()) { + $values_1 = []; + foreach ($data->getOriginPickList() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - return $data; + $dataArray['originPickList'] = $values_1; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TimeInTransitResponse::class => false]; + if ($data->isInitialized('emsResponse') && null !== $data->getEmsResponse()) { + $dataArray['emsResponse'] = $this->normalizer->normalize($data->getEmsResponse(), 'json', $context); } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\TimeInTransitResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/TimeInTransitServiceSummaryNormalizer.php b/src/Api/Normalizer/TimeInTransitServiceSummaryNormalizer.php index d56ae9b7..24396553 100644 --- a/src/Api/Normalizer/TimeInTransitServiceSummaryNormalizer.php +++ b/src/Api/Normalizer/TimeInTransitServiceSummaryNormalizer.php @@ -5,220 +5,109 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class TimeInTransitServiceSummaryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class TimeInTransitServiceSummaryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ServiceSummaryService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('GuaranteedIndicator', $data)) { - $object->setGuaranteedIndicator($data['GuaranteedIndicator']); - unset($data['GuaranteedIndicator']); - } - if (\array_key_exists('Disclaimer', $data)) { - $object->setDisclaimer($data['Disclaimer']); - unset($data['Disclaimer']); - } - if (\array_key_exists('EstimatedArrival', $data)) { - $object->setEstimatedArrival($this->denormalizer->denormalize($data['EstimatedArrival'], \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class, 'json', $context)); - unset($data['EstimatedArrival']); - } - if (\array_key_exists('SaturdayDelivery', $data)) { - $object->setSaturdayDelivery($data['SaturdayDelivery']); - unset($data['SaturdayDelivery']); - } - if (\array_key_exists('SaturdayDeliveryDisclaimer', $data)) { - $object->setSaturdayDeliveryDisclaimer($data['SaturdayDeliveryDisclaimer']); - unset($data['SaturdayDeliveryDisclaimer']); - } - if (\array_key_exists('SundayDelivery', $data)) { - $object->setSundayDelivery($data['SundayDelivery']); - unset($data['SundayDelivery']); - } - if (\array_key_exists('SundayDeliveryDisclaimer', $data)) { - $object->setSundayDeliveryDisclaimer($data['SundayDeliveryDisclaimer']); - unset($data['SundayDeliveryDisclaimer']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - if ($object->isInitialized('guaranteedIndicator') && null !== $object->getGuaranteedIndicator()) { - $data['GuaranteedIndicator'] = $object->getGuaranteedIndicator(); - } - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $data['Disclaimer'] = $object->getDisclaimer(); - } - $data['EstimatedArrival'] = $this->normalizer->normalize($object->getEstimatedArrival(), 'json', $context); - if ($object->isInitialized('saturdayDelivery') && null !== $object->getSaturdayDelivery()) { - $data['SaturdayDelivery'] = $object->getSaturdayDelivery(); - } - if ($object->isInitialized('saturdayDeliveryDisclaimer') && null !== $object->getSaturdayDeliveryDisclaimer()) { - $data['SaturdayDeliveryDisclaimer'] = $object->getSaturdayDeliveryDisclaimer(); - } - if ($object->isInitialized('sundayDelivery') && null !== $object->getSundayDelivery()) { - $data['SundayDelivery'] = $object->getSundayDelivery(); - } - if ($object->isInitialized('sundayDeliveryDisclaimer') && null !== $object->getSundayDeliveryDisclaimer()) { - $data['SundayDeliveryDisclaimer'] = $object->getSundayDeliveryDisclaimer(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Service', $data)) { + $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ServiceSummaryService::class, 'json', $context)); + unset($data['Service']); + } + if (\array_key_exists('GuaranteedIndicator', $data)) { + $object->setGuaranteedIndicator($data['GuaranteedIndicator']); + unset($data['GuaranteedIndicator']); + } + if (\array_key_exists('Disclaimer', $data)) { + $object->setDisclaimer($data['Disclaimer']); + unset($data['Disclaimer']); + } + if (\array_key_exists('EstimatedArrival', $data)) { + $object->setEstimatedArrival($this->denormalizer->denormalize($data['EstimatedArrival'], \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class, 'json', $context)); + unset($data['EstimatedArrival']); + } + if (\array_key_exists('SaturdayDelivery', $data)) { + $object->setSaturdayDelivery($data['SaturdayDelivery']); + unset($data['SaturdayDelivery']); + } + if (\array_key_exists('SaturdayDeliveryDisclaimer', $data)) { + $object->setSaturdayDeliveryDisclaimer($data['SaturdayDeliveryDisclaimer']); + unset($data['SaturdayDeliveryDisclaimer']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class => false]; + if (\array_key_exists('SundayDelivery', $data)) { + $object->setSundayDelivery($data['SundayDelivery']); + unset($data['SundayDelivery']); } + if (\array_key_exists('SundayDeliveryDisclaimer', $data)) { + $object->setSundayDeliveryDisclaimer($data['SundayDeliveryDisclaimer']); + unset($data['SundayDeliveryDisclaimer']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class TimeInTransitServiceSummaryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TimeInTransitServiceSummary(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Service', $data)) { - $object->setService($this->denormalizer->denormalize($data['Service'], \ShipStream\Ups\Api\Model\ServiceSummaryService::class, 'json', $context)); - unset($data['Service']); - } - if (\array_key_exists('GuaranteedIndicator', $data)) { - $object->setGuaranteedIndicator($data['GuaranteedIndicator']); - unset($data['GuaranteedIndicator']); - } - if (\array_key_exists('Disclaimer', $data)) { - $object->setDisclaimer($data['Disclaimer']); - unset($data['Disclaimer']); - } - if (\array_key_exists('EstimatedArrival', $data)) { - $object->setEstimatedArrival($this->denormalizer->denormalize($data['EstimatedArrival'], \ShipStream\Ups\Api\Model\ServiceSummaryEstimatedArrival::class, 'json', $context)); - unset($data['EstimatedArrival']); - } - if (\array_key_exists('SaturdayDelivery', $data)) { - $object->setSaturdayDelivery($data['SaturdayDelivery']); - unset($data['SaturdayDelivery']); - } - if (\array_key_exists('SaturdayDeliveryDisclaimer', $data)) { - $object->setSaturdayDeliveryDisclaimer($data['SaturdayDeliveryDisclaimer']); - unset($data['SaturdayDeliveryDisclaimer']); - } - if (\array_key_exists('SundayDelivery', $data)) { - $object->setSundayDelivery($data['SundayDelivery']); - unset($data['SundayDelivery']); - } - if (\array_key_exists('SundayDeliveryDisclaimer', $data)) { - $object->setSundayDeliveryDisclaimer($data['SundayDeliveryDisclaimer']); - unset($data['SundayDeliveryDisclaimer']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + $dataArray['Service'] = $this->normalizer->normalize($data->getService(), 'json', $context); + if ($data->isInitialized('guaranteedIndicator') && null !== $data->getGuaranteedIndicator()) { + $dataArray['GuaranteedIndicator'] = $data->getGuaranteedIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Service'] = $this->normalizer->normalize($object->getService(), 'json', $context); - if ($object->isInitialized('guaranteedIndicator') && null !== $object->getGuaranteedIndicator()) { - $data['GuaranteedIndicator'] = $object->getGuaranteedIndicator(); - } - if ($object->isInitialized('disclaimer') && null !== $object->getDisclaimer()) { - $data['Disclaimer'] = $object->getDisclaimer(); - } - $data['EstimatedArrival'] = $this->normalizer->normalize($object->getEstimatedArrival(), 'json', $context); - if ($object->isInitialized('saturdayDelivery') && null !== $object->getSaturdayDelivery()) { - $data['SaturdayDelivery'] = $object->getSaturdayDelivery(); - } - if ($object->isInitialized('saturdayDeliveryDisclaimer') && null !== $object->getSaturdayDeliveryDisclaimer()) { - $data['SaturdayDeliveryDisclaimer'] = $object->getSaturdayDeliveryDisclaimer(); - } - if ($object->isInitialized('sundayDelivery') && null !== $object->getSundayDelivery()) { - $data['SundayDelivery'] = $object->getSundayDelivery(); - } - if ($object->isInitialized('sundayDeliveryDisclaimer') && null !== $object->getSundayDeliveryDisclaimer()) { - $data['SundayDeliveryDisclaimer'] = $object->getSundayDeliveryDisclaimer(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('disclaimer') && null !== $data->getDisclaimer()) { + $dataArray['Disclaimer'] = $data->getDisclaimer(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class => false]; + $dataArray['EstimatedArrival'] = $this->normalizer->normalize($data->getEstimatedArrival(), 'json', $context); + if ($data->isInitialized('saturdayDelivery') && null !== $data->getSaturdayDelivery()) { + $dataArray['SaturdayDelivery'] = $data->getSaturdayDelivery(); } + if ($data->isInitialized('saturdayDeliveryDisclaimer') && null !== $data->getSaturdayDeliveryDisclaimer()) { + $dataArray['SaturdayDeliveryDisclaimer'] = $data->getSaturdayDeliveryDisclaimer(); + } + if ($data->isInitialized('sundayDelivery') && null !== $data->getSundayDelivery()) { + $dataArray['SundayDelivery'] = $data->getSundayDelivery(); + } + if ($data->isInitialized('sundayDeliveryDisclaimer') && null !== $data->getSundayDeliveryDisclaimer()) { + $dataArray['SundayDeliveryDisclaimer'] = $data->getSundayDeliveryDisclaimer(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\TimeInTransitServiceSummary::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/TrackApiResponseNormalizer.php b/src/Api/Normalizer/TrackApiResponseNormalizer.php index 22a30735..32dd5145 100644 --- a/src/Api/Normalizer/TrackApiResponseNormalizer.php +++ b/src/Api/Normalizer/TrackApiResponseNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class TrackApiResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class TrackApiResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TrackApiResponse::class; + return $type === \ShipStream\Ups\Api\Model\TrackApiResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackApiResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackApiResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TrackApiResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('trackResponse', $data)) { - $object->setTrackResponse($this->denormalizer->denormalize($data['trackResponse'], \ShipStream\Ups\Api\Model\TrackResponse::class, 'json', $context)); - unset($data['trackResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\TrackApiResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('trackResponse') && null !== $object->getTrackResponse()) { - $data['trackResponse'] = $this->normalizer->normalize($object->getTrackResponse(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('trackResponse', $data)) { + $object->setTrackResponse($this->denormalizer->denormalize($data['trackResponse'], \ShipStream\Ups\Api\Model\TrackResponse::class, 'json', $context)); + unset($data['trackResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TrackApiResponse::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class TrackApiResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TrackApiResponse::class; + $dataArray = []; + if ($data->isInitialized('trackResponse') && null !== $data->getTrackResponse()) { + $dataArray['trackResponse'] = $this->normalizer->normalize($data->getTrackResponse(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackApiResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TrackApiResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('trackResponse', $data)) { - $object->setTrackResponse($this->denormalizer->denormalize($data['trackResponse'], \ShipStream\Ups\Api\Model\TrackResponse::class, 'json', $context)); - unset($data['trackResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('trackResponse') && null !== $object->getTrackResponse()) { - $data['trackResponse'] = $this->normalizer->normalize($object->getTrackResponse(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TrackApiResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\TrackApiResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/TrackResponseNormalizer.php b/src/Api/Normalizer/TrackResponseNormalizer.php index b70b49ea..2e53f0af 100644 --- a/src/Api/Normalizer/TrackResponseNormalizer.php +++ b/src/Api/Normalizer/TrackResponseNormalizer.php @@ -5,146 +5,72 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class TrackResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class TrackResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TrackResponse::class; + return $type === \ShipStream\Ups\Api\Model\TrackResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TrackResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('shipment', $data)) { - $values = []; - foreach ($data['shipment'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Shipment::class, 'json', $context); - } - $object->setShipment($values); - unset($data['shipment']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\TrackResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('shipment') && null !== $object->getShipment()) { - $values = []; - foreach ($object->getShipment() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['shipment'] = $values; + if (\array_key_exists('shipment', $data)) { + $values = []; + foreach ($data['shipment'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Shipment::class, 'json', $context); } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setShipment($values); + unset($data['shipment']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TrackResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class TrackResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TrackResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TrackResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('shipment', $data)) { - $values = []; - foreach ($data['shipment'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\Shipment::class, 'json', $context); - } - $object->setShipment($values); - unset($data['shipment']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + $dataArray = []; + if ($data->isInitialized('shipment') && null !== $data->getShipment()) { + $values = []; + foreach ($data->getShipment() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $object; + $dataArray['shipment'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('shipment') && null !== $object->getShipment()) { - $values = []; - foreach ($object->getShipment() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['shipment'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TrackResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\TrackResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/TrackSubsServiceErrorResponseNormalizer.php b/src/Api/Normalizer/TrackSubsServiceErrorResponseNormalizer.php index 85e2df7c..e65a88d6 100644 --- a/src/Api/Normalizer/TrackSubsServiceErrorResponseNormalizer.php +++ b/src/Api/Normalizer/TrackSubsServiceErrorResponseNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class TrackSubsServiceErrorResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class TrackSubsServiceErrorResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class; + return $type === \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['response'], \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class, 'json', $context)); - unset($data['response']); - } - if (\array_key_exists('invalidTrackingNumbers', $data)) { - $values = []; - foreach ($data['invalidTrackingNumbers'] as $value) { - $values[] = $value; - } - $object->setInvalidTrackingNumbers($values); - unset($data['invalidTrackingNumbers']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('invalidTrackingNumbers') && null !== $object->getInvalidTrackingNumbers()) { - $values = []; - foreach ($object->getInvalidTrackingNumbers() as $value) { - $values[] = $value; - } - $data['invalidTrackingNumbers'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['response'], \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class, 'json', $context)); + unset($data['response']); + } + if (\array_key_exists('invalidTrackingNumbers', $data)) { + $values = []; + foreach ($data['invalidTrackingNumbers'] as $value) { + $values[] = $value; } - return $data; + $object->setInvalidTrackingNumbers($values); + unset($data['invalidTrackingNumbers']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class TrackSubsServiceErrorResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class; + $dataArray = []; + $dataArray['response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + if ($data->isInitialized('invalidTrackingNumbers') && null !== $data->getInvalidTrackingNumbers()) { + $values = []; + foreach ($data->getInvalidTrackingNumbers() as $value) { + $values[] = $value; + } + $dataArray['invalidTrackingNumbers'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['response'], \ShipStream\Ups\Api\Model\ErrorResponseWrapper::class, 'json', $context)); - unset($data['response']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('invalidTrackingNumbers', $data)) { - $values = []; - foreach ($data['invalidTrackingNumbers'] as $value) { - $values[] = $value; - } - $object->setInvalidTrackingNumbers($values); - unset($data['invalidTrackingNumbers']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('invalidTrackingNumbers') && null !== $object->getInvalidTrackingNumbers()) { - $values = []; - foreach ($object->getInvalidTrackingNumbers() as $value) { - $values[] = $value; - } - $data['invalidTrackingNumbers'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\TrackSubsServiceErrorResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/TrackSubsServiceRequestNormalizer.php b/src/Api/Normalizer/TrackSubsServiceRequestNormalizer.php index f292fde2..c6f07878 100644 --- a/src/Api/Normalizer/TrackSubsServiceRequestNormalizer.php +++ b/src/Api/Normalizer/TrackSubsServiceRequestNormalizer.php @@ -5,202 +5,100 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class TrackSubsServiceRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class TrackSubsServiceRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class; + return $type === \ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TrackSubsServiceRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('locale', $data)) { - $object->setLocale($data['locale']); - unset($data['locale']); - } - if (\array_key_exists('countryCode', $data)) { - $object->setCountryCode($data['countryCode']); - unset($data['countryCode']); - } - if (\array_key_exists('trackingNumberList', $data)) { - $values = []; - foreach ($data['trackingNumberList'] as $value) { - $values[] = $value; - } - $object->setTrackingNumberList($values); - unset($data['trackingNumberList']); - } - if (\array_key_exists('scanPreference', $data)) { - $values_1 = []; - foreach ($data['scanPreference'] as $value_1) { - $values_1[] = $value_1; - } - $object->setScanPreference($values_1); - unset($data['scanPreference']); - } - if (\array_key_exists('destination', $data)) { - $object->setDestination($this->denormalizer->denormalize($data['destination'], \ShipStream\Ups\Api\Model\Destination::class, 'json', $context)); - unset($data['destination']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\TrackSubsServiceRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['locale'] = $object->getLocale(); - $data['countryCode'] = $object->getCountryCode(); + if (\array_key_exists('locale', $data)) { + $object->setLocale($data['locale']); + unset($data['locale']); + } + if (\array_key_exists('countryCode', $data)) { + $object->setCountryCode($data['countryCode']); + unset($data['countryCode']); + } + if (\array_key_exists('trackingNumberList', $data)) { $values = []; - foreach ($object->getTrackingNumberList() as $value) { + foreach ($data['trackingNumberList'] as $value) { $values[] = $value; } - $data['trackingNumberList'] = $values; - if ($object->isInitialized('scanPreference') && null !== $object->getScanPreference()) { - $values_1 = []; - foreach ($object->getScanPreference() as $value_1) { - $values_1[] = $value_1; - } - $data['scanPreference'] = $values_1; - } - $data['destination'] = $this->normalizer->normalize($object->getDestination(), 'json', $context); - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setTrackingNumberList($values); + unset($data['trackingNumberList']); + } + if (\array_key_exists('scanPreference', $data)) { + $values_1 = []; + foreach ($data['scanPreference'] as $value_1) { + $values_1[] = $value_1; } - return $data; + $object->setScanPreference($values_1); + unset($data['scanPreference']); + } + if (\array_key_exists('destination', $data)) { + $object->setDestination($this->denormalizer->denormalize($data['destination'], \ShipStream\Ups\Api\Model\Destination::class, 'json', $context)); + unset($data['destination']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } } + return $object; } -} else { - class TrackSubsServiceRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class; + $dataArray = []; + $dataArray['locale'] = $data->getLocale(); + $dataArray['countryCode'] = $data->getCountryCode(); + $values = []; + foreach ($data->getTrackingNumberList() as $value) { + $values[] = $value; } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TrackSubsServiceRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('locale', $data)) { - $object->setLocale($data['locale']); - unset($data['locale']); - } - if (\array_key_exists('countryCode', $data)) { - $object->setCountryCode($data['countryCode']); - unset($data['countryCode']); - } - if (\array_key_exists('trackingNumberList', $data)) { - $values = []; - foreach ($data['trackingNumberList'] as $value) { - $values[] = $value; - } - $object->setTrackingNumberList($values); - unset($data['trackingNumberList']); - } - if (\array_key_exists('scanPreference', $data)) { - $values_1 = []; - foreach ($data['scanPreference'] as $value_1) { - $values_1[] = $value_1; - } - $object->setScanPreference($values_1); - unset($data['scanPreference']); - } - if (\array_key_exists('destination', $data)) { - $object->setDestination($this->denormalizer->denormalize($data['destination'], \ShipStream\Ups\Api\Model\Destination::class, 'json', $context)); - unset($data['destination']); + $dataArray['trackingNumberList'] = $values; + if ($data->isInitialized('scanPreference') && null !== $data->getScanPreference()) { + $values_1 = []; + foreach ($data->getScanPreference() as $value_1) { + $values_1[] = $value_1; } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; + $dataArray['scanPreference'] = $values_1; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['locale'] = $object->getLocale(); - $data['countryCode'] = $object->getCountryCode(); - $values = []; - foreach ($object->getTrackingNumberList() as $value) { - $values[] = $value; - } - $data['trackingNumberList'] = $values; - if ($object->isInitialized('scanPreference') && null !== $object->getScanPreference()) { - $values_1 = []; - foreach ($object->getScanPreference() as $value_1) { - $values_1[] = $value_1; - } - $data['scanPreference'] = $values_1; + $dataArray['destination'] = $this->normalizer->normalize($data->getDestination(), 'json', $context); + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; } - $data['destination'] = $this->normalizer->normalize($object->getDestination(), 'json', $context); - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\TrackSubsServiceRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/TrackSubsServiceResponseNormalizer.php b/src/Api/Normalizer/TrackSubsServiceResponseNormalizer.php index 9105a277..fd1d97a4 100644 --- a/src/Api/Normalizer/TrackSubsServiceResponseNormalizer.php +++ b/src/Api/Normalizer/TrackSubsServiceResponseNormalizer.php @@ -5,176 +5,87 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class TrackSubsServiceResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class TrackSubsServiceResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class; + return $type === \ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TrackSubsServiceResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('validTrackingNumbers', $data)) { - $values = []; - foreach ($data['validTrackingNumbers'] as $value) { - $values[] = $value; - } - $object->setValidTrackingNumbers($values); - unset($data['validTrackingNumbers']); - } - if (\array_key_exists('invalidTrackingNumbers', $data)) { - $values_1 = []; - foreach ($data['invalidTrackingNumbers'] as $value_1) { - $values_1[] = $value_1; - } - $object->setInvalidTrackingNumbers($values_1); - unset($data['invalidTrackingNumbers']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\TrackSubsServiceResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('validTrackingNumbers') && null !== $object->getValidTrackingNumbers()) { - $values = []; - foreach ($object->getValidTrackingNumbers() as $value) { - $values[] = $value; - } - $data['validTrackingNumbers'] = $values; + if (\array_key_exists('validTrackingNumbers', $data)) { + $values = []; + foreach ($data['validTrackingNumbers'] as $value) { + $values[] = $value; } - if ($object->isInitialized('invalidTrackingNumbers') && null !== $object->getInvalidTrackingNumbers()) { - $values_1 = []; - foreach ($object->getInvalidTrackingNumbers() as $value_1) { - $values_1[] = $value_1; - } - $data['invalidTrackingNumbers'] = $values_1; - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $object->setValidTrackingNumbers($values); + unset($data['validTrackingNumbers']); + } + if (\array_key_exists('invalidTrackingNumbers', $data)) { + $values_1 = []; + foreach ($data['invalidTrackingNumbers'] as $value_1) { + $values_1[] = $value_1; } - return $data; + $object->setInvalidTrackingNumbers($values_1); + unset($data['invalidTrackingNumbers']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } } + return $object; } -} else { - class TrackSubsServiceResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TrackSubsServiceResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('validTrackingNumbers', $data)) { - $values = []; - foreach ($data['validTrackingNumbers'] as $value) { - $values[] = $value; - } - $object->setValidTrackingNumbers($values); - unset($data['validTrackingNumbers']); - } - if (\array_key_exists('invalidTrackingNumbers', $data)) { - $values_1 = []; - foreach ($data['invalidTrackingNumbers'] as $value_1) { - $values_1[] = $value_1; - } - $object->setInvalidTrackingNumbers($values_1); - unset($data['invalidTrackingNumbers']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } + $dataArray = []; + if ($data->isInitialized('validTrackingNumbers') && null !== $data->getValidTrackingNumbers()) { + $values = []; + foreach ($data->getValidTrackingNumbers() as $value) { + $values[] = $value; } - return $object; + $dataArray['validTrackingNumbers'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('validTrackingNumbers') && null !== $object->getValidTrackingNumbers()) { - $values = []; - foreach ($object->getValidTrackingNumbers() as $value) { - $values[] = $value; - } - $data['validTrackingNumbers'] = $values; - } - if ($object->isInitialized('invalidTrackingNumbers') && null !== $object->getInvalidTrackingNumbers()) { - $values_1 = []; - foreach ($object->getInvalidTrackingNumbers() as $value_1) { - $values_1[] = $value_1; - } - $data['invalidTrackingNumbers'] = $values_1; - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + if ($data->isInitialized('invalidTrackingNumbers') && null !== $data->getInvalidTrackingNumbers()) { + $values_1 = []; + foreach ($data->getInvalidTrackingNumbers() as $value_1) { + $values_1[] = $value_1; } - return $data; + $dataArray['invalidTrackingNumbers'] = $values_1; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class => false]; + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\TrackSubsServiceResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/TrackingCandidatePickupDateRangeNormalizer.php b/src/Api/Normalizer/TrackingCandidatePickupDateRangeNormalizer.php index 6f029043..2a702068 100644 --- a/src/Api/Normalizer/TrackingCandidatePickupDateRangeNormalizer.php +++ b/src/Api/Normalizer/TrackingCandidatePickupDateRangeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class TrackingCandidatePickupDateRangeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class TrackingCandidatePickupDateRangeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class; + return $type === \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BeginDate', $data)) { - $object->setBeginDate($data['BeginDate']); - unset($data['BeginDate']); - } - if (\array_key_exists('EndDate', $data)) { - $object->setEndDate($data['EndDate']); - unset($data['EndDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['BeginDate'] = $object->getBeginDate(); - $data['EndDate'] = $object->getEndDate(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class => false]; - } - } -} else { - class TrackingCandidatePickupDateRangeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class; + if (\array_key_exists('BeginDate', $data)) { + $object->setBeginDate($data['BeginDate']); + unset($data['BeginDate']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class; + if (\array_key_exists('EndDate', $data)) { + $object->setEndDate($data['EndDate']); + unset($data['EndDate']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('BeginDate', $data)) { - $object->setBeginDate($data['BeginDate']); - unset($data['BeginDate']); - } - if (\array_key_exists('EndDate', $data)) { - $object->setEndDate($data['EndDate']); - unset($data['EndDate']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['BeginDate'] = $object->getBeginDate(); - $data['EndDate'] = $object->getEndDate(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['BeginDate'] = $data->getBeginDate(); + $dataArray['EndDate'] = $data->getEndDate(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\TrackingCandidatePickupDateRange::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/TransportationChargesDiscountAmountNormalizer.php b/src/Api/Normalizer/TransportationChargesDiscountAmountNormalizer.php index 5d6bf4cc..2049782e 100644 --- a/src/Api/Normalizer/TransportationChargesDiscountAmountNormalizer.php +++ b/src/Api/Normalizer/TransportationChargesDiscountAmountNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class TransportationChargesDiscountAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class TransportationChargesDiscountAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class; + return $type === \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class => false]; - } - } -} else { - class TransportationChargesDiscountAmountNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\TransportationChargesDiscountAmount::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/TransportationChargesGrossChargeNormalizer.php b/src/Api/Normalizer/TransportationChargesGrossChargeNormalizer.php index 33febf78..6b740539 100644 --- a/src/Api/Normalizer/TransportationChargesGrossChargeNormalizer.php +++ b/src/Api/Normalizer/TransportationChargesGrossChargeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class TransportationChargesGrossChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class TransportationChargesGrossChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class; + return $type === \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class => false]; - } - } -} else { - class TransportationChargesGrossChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TransportationChargesGrossCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\TransportationChargesGrossCharge::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/TransportationChargesNetChargeNormalizer.php b/src/Api/Normalizer/TransportationChargesNetChargeNormalizer.php index 97bf6d77..b2b55ad3 100644 --- a/src/Api/Normalizer/TransportationChargesNetChargeNormalizer.php +++ b/src/Api/Normalizer/TransportationChargesNetChargeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class TransportationChargesNetChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class TransportationChargesNetChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class; + return $type === \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TransportationChargesNetCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\TransportationChargesNetCharge(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class => false]; - } - } -} else { - class TransportationChargesNetChargeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TransportationChargesNetCharge(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\TransportationChargesNetCharge::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/TransportationPickUpSchedulePickUpNormalizer.php b/src/Api/Normalizer/TransportationPickUpSchedulePickUpNormalizer.php index e5d5f270..5b99977b 100644 --- a/src/Api/Normalizer/TransportationPickUpSchedulePickUpNormalizer.php +++ b/src/Api/Normalizer/TransportationPickUpSchedulePickUpNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class TransportationPickUpSchedulePickUpNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class TransportationPickUpSchedulePickUpNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class; + return $type === \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DayOfWeek', $data)) { - $object->setDayOfWeek($data['DayOfWeek']); - unset($data['DayOfWeek']); - } - if (\array_key_exists('PickUpDetails', $data)) { - $object->setPickUpDetails($this->denormalizer->denormalize($data['PickUpDetails'], \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class, 'json', $context)); - unset($data['PickUpDetails']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['DayOfWeek'] = $object->getDayOfWeek(); - $data['PickUpDetails'] = $this->normalizer->normalize($object->getPickUpDetails(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class => false]; - } - } -} else { - class TransportationPickUpSchedulePickUpNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class; + if (\array_key_exists('DayOfWeek', $data)) { + $object->setDayOfWeek($data['DayOfWeek']); + unset($data['DayOfWeek']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class; + if (\array_key_exists('PickUpDetails', $data)) { + $object->setPickUpDetails($this->denormalizer->denormalize($data['PickUpDetails'], \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class, 'json', $context)); + unset($data['PickUpDetails']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DayOfWeek', $data)) { - $object->setDayOfWeek($data['DayOfWeek']); - unset($data['DayOfWeek']); - } - if (\array_key_exists('PickUpDetails', $data)) { - $object->setPickUpDetails($this->denormalizer->denormalize($data['PickUpDetails'], \ShipStream\Ups\Api\Model\PickUpPickUpDetails::class, 'json', $context)); - unset($data['PickUpDetails']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['DayOfWeek'] = $object->getDayOfWeek(); - $data['PickUpDetails'] = $this->normalizer->normalize($object->getPickUpDetails(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['DayOfWeek'] = $data->getDayOfWeek(); + $dataArray['PickUpDetails'] = $this->normalizer->normalize($data->getPickUpDetails(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\TransportationPickUpSchedulePickUp::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UAPAddressAddressNormalizer.php b/src/Api/Normalizer/UAPAddressAddressNormalizer.php index 2fbb7dc7..26d4a2d8 100644 --- a/src/Api/Normalizer/UAPAddressAddressNormalizer.php +++ b/src/Api/Normalizer/UAPAddressAddressNormalizer.php @@ -5,214 +5,106 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UAPAddressAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UAPAddressAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UAPAddressAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UAPAddressAddress::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UAPAddressAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine1', $data)) { - $object->setAddressLine1($data['AddressLine1']); - unset($data['AddressLine1']); - } - if (\array_key_exists('AddressLine2', $data)) { - $object->setAddressLine2($data['AddressLine2']); - unset($data['AddressLine2']); - } - if (\array_key_exists('AddressLine3', $data)) { - $object->setAddressLine3($data['AddressLine3']); - unset($data['AddressLine3']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + return $type === \ShipStream\Ups\Api\Model\UAPAddressAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UAPAddressAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\UAPAddressAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('addressLine1') && null !== $object->getAddressLine1()) { - $data['AddressLine1'] = $object->getAddressLine1(); - } - if ($object->isInitialized('addressLine2') && null !== $object->getAddressLine2()) { - $data['AddressLine2'] = $object->getAddressLine2(); - } - if ($object->isInitialized('addressLine3') && null !== $object->getAddressLine3()) { - $data['AddressLine3'] = $object->getAddressLine3(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('AddressLine1', $data)) { + $object->setAddressLine1($data['AddressLine1']); + unset($data['AddressLine1']); + } + if (\array_key_exists('AddressLine2', $data)) { + $object->setAddressLine2($data['AddressLine2']); + unset($data['AddressLine2']); + } + if (\array_key_exists('AddressLine3', $data)) { + $object->setAddressLine3($data['AddressLine3']); + unset($data['AddressLine3']); + } + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); + } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UAPAddressAddress::class => false]; + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class UAPAddressAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UAPAddressAddress::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UAPAddressAddress::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UAPAddressAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine1', $data)) { - $object->setAddressLine1($data['AddressLine1']); - unset($data['AddressLine1']); - } - if (\array_key_exists('AddressLine2', $data)) { - $object->setAddressLine2($data['AddressLine2']); - unset($data['AddressLine2']); - } - if (\array_key_exists('AddressLine3', $data)) { - $object->setAddressLine3($data['AddressLine3']); - unset($data['AddressLine3']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + $dataArray = []; + if ($data->isInitialized('addressLine1') && null !== $data->getAddressLine1()) { + $dataArray['AddressLine1'] = $data->getAddressLine1(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('addressLine1') && null !== $object->getAddressLine1()) { - $data['AddressLine1'] = $object->getAddressLine1(); - } - if ($object->isInitialized('addressLine2') && null !== $object->getAddressLine2()) { - $data['AddressLine2'] = $object->getAddressLine2(); - } - if ($object->isInitialized('addressLine3') && null !== $object->getAddressLine3()) { - $data['AddressLine3'] = $object->getAddressLine3(); - } - if ($object->isInitialized('city') && null !== $object->getCity()) { - $data['City'] = $object->getCity(); - } - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - if ($object->isInitialized('countryCode') && null !== $object->getCountryCode()) { - $data['CountryCode'] = $object->getCountryCode(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if ($data->isInitialized('addressLine2') && null !== $data->getAddressLine2()) { + $dataArray['AddressLine2'] = $data->getAddressLine2(); + } + if ($data->isInitialized('addressLine3') && null !== $data->getAddressLine3()) { + $dataArray['AddressLine3'] = $data->getAddressLine3(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UAPAddressAddress::class => false]; + if ($data->isInitialized('city') && null !== $data->getCity()) { + $dataArray['City'] = $data->getCity(); } + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); + } + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); + } + if ($data->isInitialized('countryCode') && null !== $data->getCountryCode()) { + $dataArray['CountryCode'] = $data->getCountryCode(); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UAPAddressAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UPSFiledPOANormalizer.php b/src/Api/Normalizer/UPSFiledPOANormalizer.php index 0fb9e439..2550b095 100644 --- a/src/Api/Normalizer/UPSFiledPOANormalizer.php +++ b/src/Api/Normalizer/UPSFiledPOANormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UPSFiledPOANormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UPSFiledPOANormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UPSFiledPOA::class; + return $type === \ShipStream\Ups\Api\Model\UPSFiledPOA::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UPSFiledPOA::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UPSFiledPOA::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UPSFiledPOA(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\UPSFiledPOA(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UPSFiledPOA::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class UPSFiledPOANormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UPSFiledPOA::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UPSFiledPOA::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UPSFiledPOA(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UPSFiledPOA::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UPSFiledPOA::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UPSPremierHandlingInstructionsNormalizer.php b/src/Api/Normalizer/UPSPremierHandlingInstructionsNormalizer.php index 595bbc77..5ea5a89e 100644 --- a/src/Api/Normalizer/UPSPremierHandlingInstructionsNormalizer.php +++ b/src/Api/Normalizer/UPSPremierHandlingInstructionsNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UPSPremierHandlingInstructionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UPSPremierHandlingInstructionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class; + return $type === \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Instruction', $data)) { - $object->setInstruction($data['Instruction']); - unset($data['Instruction']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Instruction'] = $object->getInstruction(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Instruction', $data)) { + $object->setInstruction($data['Instruction']); + unset($data['Instruction']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class UPSPremierHandlingInstructionsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Instruction'] = $data->getInstruction(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Instruction', $data)) { - $object->setInstruction($data['Instruction']); - unset($data['Instruction']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Instruction'] = $object->getInstruction(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UPSPremierHandlingInstructions::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UPSPremiumCareFormLanguageForUPSPremiumCareNormalizer.php b/src/Api/Normalizer/UPSPremiumCareFormLanguageForUPSPremiumCareNormalizer.php index 14d0fc1f..fac3726e 100644 --- a/src/Api/Normalizer/UPSPremiumCareFormLanguageForUPSPremiumCareNormalizer.php +++ b/src/Api/Normalizer/UPSPremiumCareFormLanguageForUPSPremiumCareNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UPSPremiumCareFormLanguageForUPSPremiumCareNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UPSPremiumCareFormLanguageForUPSPremiumCareNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class; + return $type === \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Language', $data)) { - $values = []; - foreach ($data['Language'] as $value) { - $values[] = $value; - } - $object->setLanguage($values); - unset($data['Language']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('Language', $data)) { $values = []; - foreach ($object->getLanguage() as $value) { + foreach ($data['Language'] as $value) { $values[] = $value; } - $data['Language'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setLanguage($values); + unset($data['Language']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class UPSPremiumCareFormLanguageForUPSPremiumCareNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class; + $dataArray = []; + $values = []; + foreach ($data->getLanguage() as $value) { + $values[] = $value; } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + $dataArray['Language'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - $object = new \ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Language', $data)) { - $values = []; - foreach ($data['Language'] as $value) { - $values[] = $value; - } - $object->setLanguage($values); - unset($data['Language']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getLanguage() as $value) { - $values[] = $value; - } - $data['Language'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UPSPremiumCareFormLanguageForUPSPremiumCare::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UltimateConsigneeAddressNormalizer.php b/src/Api/Normalizer/UltimateConsigneeAddressNormalizer.php index d3d0c41a..b8dd072b 100644 --- a/src/Api/Normalizer/UltimateConsigneeAddressNormalizer.php +++ b/src/Api/Normalizer/UltimateConsigneeAddressNormalizer.php @@ -5,204 +5,101 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UltimateConsigneeAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UltimateConsigneeAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class; + return $type === \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UltimateConsigneeAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\UltimateConsigneeAddress(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('AddressLine', $data)) { $values = []; - foreach ($object->getAddressLine() as $value) { + foreach ($data['AddressLine'] as $value) { $values[] = $value; } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class => false]; + if (\array_key_exists('City', $data)) { + $object->setCity($data['City']); + unset($data['City']); } + if (\array_key_exists('StateProvinceCode', $data)) { + $object->setStateProvinceCode($data['StateProvinceCode']); + unset($data['StateProvinceCode']); + } + if (\array_key_exists('Town', $data)) { + $object->setTown($data['Town']); + unset($data['Town']); + } + if (\array_key_exists('PostalCode', $data)) { + $object->setPostalCode($data['PostalCode']); + unset($data['PostalCode']); + } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class UltimateConsigneeAddressNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class; + $dataArray = []; + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class; + $dataArray['AddressLine'] = $values; + $dataArray['City'] = $data->getCity(); + if ($data->isInitialized('stateProvinceCode') && null !== $data->getStateProvinceCode()) { + $dataArray['StateProvinceCode'] = $data->getStateProvinceCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UltimateConsigneeAddress(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('City', $data)) { - $object->setCity($data['City']); - unset($data['City']); - } - if (\array_key_exists('StateProvinceCode', $data)) { - $object->setStateProvinceCode($data['StateProvinceCode']); - unset($data['StateProvinceCode']); - } - if (\array_key_exists('Town', $data)) { - $object->setTown($data['Town']); - unset($data['Town']); - } - if (\array_key_exists('PostalCode', $data)) { - $object->setPostalCode($data['PostalCode']); - unset($data['PostalCode']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + if ($data->isInitialized('town') && null !== $data->getTown()) { + $dataArray['Town'] = $data->getTown(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - $data['City'] = $object->getCity(); - if ($object->isInitialized('stateProvinceCode') && null !== $object->getStateProvinceCode()) { - $data['StateProvinceCode'] = $object->getStateProvinceCode(); - } - if ($object->isInitialized('town') && null !== $object->getTown()) { - $data['Town'] = $object->getTown(); - } - if ($object->isInitialized('postalCode') && null !== $object->getPostalCode()) { - $data['PostalCode'] = $object->getPostalCode(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('postalCode') && null !== $data->getPostalCode()) { + $dataArray['PostalCode'] = $data->getPostalCode(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class => false]; + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UltimateConsigneeAddress::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UltimateConsigneeUltimateConsigneeTypeNormalizer.php b/src/Api/Normalizer/UltimateConsigneeUltimateConsigneeTypeNormalizer.php index 8c307756..41225365 100644 --- a/src/Api/Normalizer/UltimateConsigneeUltimateConsigneeTypeNormalizer.php +++ b/src/Api/Normalizer/UltimateConsigneeUltimateConsigneeTypeNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UltimateConsigneeUltimateConsigneeTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UltimateConsigneeUltimateConsigneeTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class; + return $type === \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class UltimateConsigneeUltimateConsigneeTypeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UltimateConsigneeUltimateConsigneeType::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UnitUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/UnitUnitOfMeasurementNormalizer.php index a0b80a46..1f363bea 100644 --- a/src/Api/Normalizer/UnitUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/UnitUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UnitUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UnitUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class UnitUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UnitUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UnitUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UpdatedAddressAddressExtendedInformationNormalizer.php b/src/Api/Normalizer/UpdatedAddressAddressExtendedInformationNormalizer.php index 58e7a33c..4e1d13f7 100644 --- a/src/Api/Normalizer/UpdatedAddressAddressExtendedInformationNormalizer.php +++ b/src/Api/Normalizer/UpdatedAddressAddressExtendedInformationNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UpdatedAddressAddressExtendedInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UpdatedAddressAddressExtendedInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class; + return $type === \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('Low', $data)) { - $object->setLow($data['Low']); - unset($data['Low']); - } - if (\array_key_exists('High', $data)) { - $object->setHigh($data['High']); - unset($data['High']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['Type'] = $object->getType(); - } - if ($object->isInitialized('low') && null !== $object->getLow()) { - $data['Low'] = $object->getLow(); - } - if ($object->isInitialized('high') && null !== $object->getHigh()) { - $data['High'] = $object->getHigh(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Type', $data)) { + $object->setType($data['Type']); + unset($data['Type']); + } + if (\array_key_exists('Low', $data)) { + $object->setLow($data['Low']); + unset($data['Low']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class => false]; + if (\array_key_exists('High', $data)) { + $object->setHigh($data['High']); + unset($data['High']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class UpdatedAddressAddressExtendedInformationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class; + $dataArray = []; + if ($data->isInitialized('type') && null !== $data->getType()) { + $dataArray['Type'] = $data->getType(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class; + if ($data->isInitialized('low') && null !== $data->getLow()) { + $dataArray['Low'] = $data->getLow(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Type', $data)) { - $object->setType($data['Type']); - unset($data['Type']); - } - if (\array_key_exists('Low', $data)) { - $object->setLow($data['Low']); - unset($data['Low']); - } - if (\array_key_exists('High', $data)) { - $object->setHigh($data['High']); - unset($data['High']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('high') && null !== $data->getHigh()) { + $dataArray['High'] = $data->getHigh(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('type') && null !== $object->getType()) { - $data['Type'] = $object->getType(); - } - if ($object->isInitialized('low') && null !== $object->getLow()) { - $data['Low'] = $object->getLow(); - } - if ($object->isInitialized('high') && null !== $object->getHigh()) { - $data['High'] = $object->getHigh(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UpdatedAddressAddressExtendedInformation::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UploadRequestNormalizer.php b/src/Api/Normalizer/UploadRequestNormalizer.php index 88d9d2e8..2178f28a 100644 --- a/src/Api/Normalizer/UploadRequestNormalizer.php +++ b/src/Api/Normalizer/UploadRequestNormalizer.php @@ -5,162 +5,80 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UploadRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UploadRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UploadRequest::class; + return $type === \ShipStream\Ups\Api\Model\UploadRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UploadRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\UploadRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('UserCreatedForm', $data)) { - $values = []; - foreach ($data['UserCreatedForm'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class, 'json', $context); - } - $object->setUserCreatedForm($values); - unset($data['UserCreatedForm']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\UploadRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['ShipperNumber'] = $object->getShipperNumber(); + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\UploadRequestRequest::class, 'json', $context)); + unset($data['Request']); + } + if (\array_key_exists('ShipperNumber', $data)) { + $object->setShipperNumber($data['ShipperNumber']); + unset($data['ShipperNumber']); + } + if (\array_key_exists('UserCreatedForm', $data)) { $values = []; - foreach ($object->getUserCreatedForm() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['UserCreatedForm'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data['UserCreatedForm'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class, 'json', $context); } - return $data; + $object->setUserCreatedForm($values); + unset($data['UserCreatedForm']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UploadRequest::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class UploadRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UploadRequest::class; + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['ShipperNumber'] = $data->getShipperNumber(); + $values = []; + foreach ($data->getUserCreatedForm() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadRequest::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UploadRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\UploadRequestRequest::class, 'json', $context)); - unset($data['Request']); + $dataArray['UserCreatedForm'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('ShipperNumber', $data)) { - $object->setShipperNumber($data['ShipperNumber']); - unset($data['ShipperNumber']); - } - if (\array_key_exists('UserCreatedForm', $data)) { - $values = []; - foreach ($data['UserCreatedForm'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class, 'json', $context); - } - $object->setUserCreatedForm($values); - unset($data['UserCreatedForm']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['ShipperNumber'] = $object->getShipperNumber(); - $values = []; - foreach ($object->getUserCreatedForm() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['UserCreatedForm'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UploadRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UploadRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UploadRequestRequestNormalizer.php b/src/Api/Normalizer/UploadRequestRequestNormalizer.php index 5242c153..82bf60b3 100644 --- a/src/Api/Normalizer/UploadRequestRequestNormalizer.php +++ b/src/Api/Normalizer/UploadRequestRequestNormalizer.php @@ -5,158 +5,78 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UploadRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UploadRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UploadRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\UploadRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UploadRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\UploadRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); + } + if (\array_key_exists('SubVersion', $data)) { + $object->setSubVersion($data['SubVersion']); + unset($data['SubVersion']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UploadRequestRequest::class => false]; + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class UploadRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UploadRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('requestOption') && null !== $data->getRequestOption()) { + $dataArray['RequestOption'] = $data->getRequestOption(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadRequestRequest::class; + if ($data->isInitialized('subVersion') && null !== $data->getSubVersion()) { + $dataArray['SubVersion'] = $data->getSubVersion(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UploadRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UploadRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UploadRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UploadRequestUserCreatedFormNormalizer.php b/src/Api/Normalizer/UploadRequestUserCreatedFormNormalizer.php index 33aa5425..5d2a8fd0 100644 --- a/src/Api/Normalizer/UploadRequestUserCreatedFormNormalizer.php +++ b/src/Api/Normalizer/UploadRequestUserCreatedFormNormalizer.php @@ -5,156 +5,77 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UploadRequestUserCreatedFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UploadRequestUserCreatedFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class; + return $type === \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UserCreatedFormFileName', $data)) { - $object->setUserCreatedFormFileName($data['UserCreatedFormFileName']); - unset($data['UserCreatedFormFileName']); - } - if (\array_key_exists('UserCreatedFormFile', $data)) { - $object->setUserCreatedFormFile($data['UserCreatedFormFile']); - unset($data['UserCreatedFormFile']); - } - if (\array_key_exists('UserCreatedFormFileFormat', $data)) { - $object->setUserCreatedFormFileFormat($data['UserCreatedFormFileFormat']); - unset($data['UserCreatedFormFileFormat']); - } - if (\array_key_exists('UserCreatedFormDocumentType', $data)) { - $object->setUserCreatedFormDocumentType($data['UserCreatedFormDocumentType']); - unset($data['UserCreatedFormDocumentType']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['UserCreatedFormFileName'] = $object->getUserCreatedFormFileName(); - $data['UserCreatedFormFile'] = $object->getUserCreatedFormFile(); - $data['UserCreatedFormFileFormat'] = $object->getUserCreatedFormFileFormat(); - $data['UserCreatedFormDocumentType'] = $object->getUserCreatedFormDocumentType(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('UserCreatedFormFileName', $data)) { + $object->setUserCreatedFormFileName($data['UserCreatedFormFileName']); + unset($data['UserCreatedFormFileName']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class => false]; + if (\array_key_exists('UserCreatedFormFile', $data)) { + $object->setUserCreatedFormFile($data['UserCreatedFormFile']); + unset($data['UserCreatedFormFile']); } - } -} else { - class UploadRequestUserCreatedFormNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class; + if (\array_key_exists('UserCreatedFormFileFormat', $data)) { + $object->setUserCreatedFormFileFormat($data['UserCreatedFormFileFormat']); + unset($data['UserCreatedFormFileFormat']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class; + if (\array_key_exists('UserCreatedFormDocumentType', $data)) { + $object->setUserCreatedFormDocumentType($data['UserCreatedFormDocumentType']); + unset($data['UserCreatedFormDocumentType']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('UserCreatedFormFileName', $data)) { - $object->setUserCreatedFormFileName($data['UserCreatedFormFileName']); - unset($data['UserCreatedFormFileName']); - } - if (\array_key_exists('UserCreatedFormFile', $data)) { - $object->setUserCreatedFormFile($data['UserCreatedFormFile']); - unset($data['UserCreatedFormFile']); - } - if (\array_key_exists('UserCreatedFormFileFormat', $data)) { - $object->setUserCreatedFormFileFormat($data['UserCreatedFormFileFormat']); - unset($data['UserCreatedFormFileFormat']); - } - if (\array_key_exists('UserCreatedFormDocumentType', $data)) { - $object->setUserCreatedFormDocumentType($data['UserCreatedFormDocumentType']); - unset($data['UserCreatedFormDocumentType']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['UserCreatedFormFileName'] = $object->getUserCreatedFormFileName(); - $data['UserCreatedFormFile'] = $object->getUserCreatedFormFile(); - $data['UserCreatedFormFileFormat'] = $object->getUserCreatedFormFileFormat(); - $data['UserCreatedFormDocumentType'] = $object->getUserCreatedFormDocumentType(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['UserCreatedFormFileName'] = $data->getUserCreatedFormFileName(); + $dataArray['UserCreatedFormFile'] = $data->getUserCreatedFormFile(); + $dataArray['UserCreatedFormFileFormat'] = $data->getUserCreatedFormFileFormat(); + $dataArray['UserCreatedFormDocumentType'] = $data->getUserCreatedFormDocumentType(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UploadRequestUserCreatedForm::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UploadResponseFormsHistoryDocumentIDNormalizer.php b/src/Api/Normalizer/UploadResponseFormsHistoryDocumentIDNormalizer.php index 6d6cbd68..7dc6459a 100644 --- a/src/Api/Normalizer/UploadResponseFormsHistoryDocumentIDNormalizer.php +++ b/src/Api/Normalizer/UploadResponseFormsHistoryDocumentIDNormalizer.php @@ -5,142 +5,70 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UploadResponseFormsHistoryDocumentIDNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UploadResponseFormsHistoryDocumentIDNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class; + return $type === \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DocumentID', $data)) { - $values = []; - foreach ($data['DocumentID'] as $value) { - $values[] = $value; - } - $object->setDocumentID($values); - unset($data['DocumentID']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; + if (\array_key_exists('DocumentID', $data)) { $values = []; - foreach ($object->getDocumentID() as $value) { + foreach ($data['DocumentID'] as $value) { $values[] = $value; } - $data['DocumentID'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setDocumentID($values); + unset($data['DocumentID']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class UploadResponseFormsHistoryDocumentIDNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class; + $dataArray = []; + $values = []; + foreach ($data->getDocumentID() as $value) { + $values[] = $value; } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + $dataArray['DocumentID'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - $object = new \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('DocumentID', $data)) { - $values = []; - foreach ($data['DocumentID'] as $value) { - $values[] = $value; - } - $object->setDocumentID($values); - unset($data['DocumentID']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $values = []; - foreach ($object->getDocumentID() as $value) { - $values[] = $value; - } - $data['DocumentID'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UploadResponseNormalizer.php b/src/Api/Normalizer/UploadResponseNormalizer.php index bc05d6f2..07d39666 100644 --- a/src/Api/Normalizer/UploadResponseNormalizer.php +++ b/src/Api/Normalizer/UploadResponseNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UploadResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UploadResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UploadResponse::class; + return $type === \ShipStream\Ups\Api\Model\UploadResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UploadResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\UploadResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('FormsHistoryDocumentID', $data)) { - $object->setFormsHistoryDocumentID($this->denormalizer->denormalize($data['FormsHistoryDocumentID'], \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class, 'json', $context)); - unset($data['FormsHistoryDocumentID']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\UploadResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('formsHistoryDocumentID') && null !== $object->getFormsHistoryDocumentID()) { - $data['FormsHistoryDocumentID'] = $this->normalizer->normalize($object->getFormsHistoryDocumentID(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\UploadResponseResponse::class, 'json', $context)); + unset($data['Response']); + } + if (\array_key_exists('FormsHistoryDocumentID', $data)) { + $object->setFormsHistoryDocumentID($this->denormalizer->denormalize($data['FormsHistoryDocumentID'], \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class, 'json', $context)); + unset($data['FormsHistoryDocumentID']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UploadResponse::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class UploadResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UploadResponse::class; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + if ($data->isInitialized('formsHistoryDocumentID') && null !== $data->getFormsHistoryDocumentID()) { + $dataArray['FormsHistoryDocumentID'] = $this->normalizer->normalize($data->getFormsHistoryDocumentID(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UploadResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\UploadResponseResponse::class, 'json', $context)); - unset($data['Response']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('FormsHistoryDocumentID', $data)) { - $object->setFormsHistoryDocumentID($this->denormalizer->denormalize($data['FormsHistoryDocumentID'], \ShipStream\Ups\Api\Model\UploadResponseFormsHistoryDocumentID::class, 'json', $context)); - unset($data['FormsHistoryDocumentID']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('formsHistoryDocumentID') && null !== $object->getFormsHistoryDocumentID()) { - $data['FormsHistoryDocumentID'] = $this->normalizer->normalize($object->getFormsHistoryDocumentID(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UploadResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UploadResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/UploadResponseResponseNormalizer.php b/src/Api/Normalizer/UploadResponseResponseNormalizer.php index e62754bf..1512a67c 100644 --- a/src/Api/Normalizer/UploadResponseResponseNormalizer.php +++ b/src/Api/Normalizer/UploadResponseResponseNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UploadResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class UploadResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UploadResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\UploadResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UploadResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\UploadResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); + } + if (\array_key_exists('Alert', $data)) { + $values = []; + foreach ($data['Alert'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); } - return $data; + $object->setAlert($values); + unset($data['Alert']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UploadResponseResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class UploadResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\UploadResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $values = []; + foreach ($data->getAlert() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Alert'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\UploadResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\UploadResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\UploadResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\UploadResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/VOIDSHIPMENTRequestWrapperNormalizer.php b/src/Api/Normalizer/VOIDSHIPMENTRequestWrapperNormalizer.php index 7b473a6f..d9373c75 100644 --- a/src/Api/Normalizer/VOIDSHIPMENTRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/VOIDSHIPMENTRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class VOIDSHIPMENTRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class VOIDSHIPMENTRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('VoidShipmentRequest', $data)) { - $object->setVoidShipmentRequest($this->denormalizer->denormalize($data['VoidShipmentRequest'], \ShipStream\Ups\Api\Model\VoidShipmentRequest::class, 'json', $context)); - unset($data['VoidShipmentRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['VoidShipmentRequest'] = $this->normalizer->normalize($object->getVoidShipmentRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('VoidShipmentRequest', $data)) { + $object->setVoidShipmentRequest($this->denormalizer->denormalize($data['VoidShipmentRequest'], \ShipStream\Ups\Api\Model\VoidShipmentRequest::class, 'json', $context)); + unset($data['VoidShipmentRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class VOIDSHIPMENTRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['VoidShipmentRequest'] = $this->normalizer->normalize($data->getVoidShipmentRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('VoidShipmentRequest', $data)) { - $object->setVoidShipmentRequest($this->denormalizer->denormalize($data['VoidShipmentRequest'], \ShipStream\Ups\Api\Model\VoidShipmentRequest::class, 'json', $context)); - unset($data['VoidShipmentRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['VoidShipmentRequest'] = $this->normalizer->normalize($object->getVoidShipmentRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\VOIDSHIPMENTRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/VOIDSHIPMENTResponseWrapperNormalizer.php b/src/Api/Normalizer/VOIDSHIPMENTResponseWrapperNormalizer.php index 95a15e98..ef29f2a4 100644 --- a/src/Api/Normalizer/VOIDSHIPMENTResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/VOIDSHIPMENTResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class VOIDSHIPMENTResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class VOIDSHIPMENTResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('VoidShipmentResponse', $data)) { - $object->setVoidShipmentResponse($this->denormalizer->denormalize($data['VoidShipmentResponse'], \ShipStream\Ups\Api\Model\VoidShipmentResponse::class, 'json', $context)); - unset($data['VoidShipmentResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['VoidShipmentResponse'] = $this->normalizer->normalize($object->getVoidShipmentResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('VoidShipmentResponse', $data)) { + $object->setVoidShipmentResponse($this->denormalizer->denormalize($data['VoidShipmentResponse'], \ShipStream\Ups\Api\Model\VoidShipmentResponse::class, 'json', $context)); + unset($data['VoidShipmentResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class VOIDSHIPMENTResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['VoidShipmentResponse'] = $this->normalizer->normalize($data->getVoidShipmentResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('VoidShipmentResponse', $data)) { - $object->setVoidShipmentResponse($this->denormalizer->denormalize($data['VoidShipmentResponse'], \ShipStream\Ups\Api\Model\VoidShipmentResponse::class, 'json', $context)); - unset($data['VoidShipmentResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['VoidShipmentResponse'] = $this->normalizer->normalize($object->getVoidShipmentResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\VOIDSHIPMENTResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ValidationListNormalizer.php b/src/Api/Normalizer/ValidationListNormalizer.php index e320c55d..3ebf5c3c 100644 --- a/src/Api/Normalizer/ValidationListNormalizer.php +++ b/src/Api/Normalizer/ValidationListNormalizer.php @@ -5,204 +5,107 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ValidationListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ValidationListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ValidationList::class; + return $type === \ShipStream\Ups\Api\Model\ValidationList::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ValidationList::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ValidationList::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ValidationList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('invalidFieldList', $data)) { - $values = []; - foreach ($data['invalidFieldList'] as $value) { - $values[] = $value; - } - $object->setInvalidFieldList($values); - unset($data['invalidFieldList']); - } - if (\array_key_exists('invalidFieldListCodes', $data)) { - $values_1 = []; - foreach ($data['invalidFieldListCodes'] as $value_1) { - $values_1[] = $value_1; - } - $object->setInvalidFieldListCodes($values_1); - unset($data['invalidFieldListCodes']); - } - if (\array_key_exists('destinationAmbiguous', $data)) { - $object->setDestinationAmbiguous($data['destinationAmbiguous']); - unset($data['destinationAmbiguous']); - } - if (\array_key_exists('originAmbiguous', $data)) { - $object->setOriginAmbiguous($data['originAmbiguous']); - unset($data['originAmbiguous']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } + $object = new \ShipStream\Ups\Api\Model\ValidationList(); + if (\array_key_exists('destinationAmbiguous', $data) && \is_int($data['destinationAmbiguous'])) { + $data['destinationAmbiguous'] = (bool) $data['destinationAmbiguous']; + } + if (\array_key_exists('originAmbiguous', $data) && \is_int($data['originAmbiguous'])) { + $data['originAmbiguous'] = (bool) $data['originAmbiguous']; + } + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('invalidFieldList') && null !== $object->getInvalidFieldList()) { - $values = []; - foreach ($object->getInvalidFieldList() as $value) { - $values[] = $value; - } - $data['invalidFieldList'] = $values; - } - if ($object->isInitialized('invalidFieldListCodes') && null !== $object->getInvalidFieldListCodes()) { - $values_1 = []; - foreach ($object->getInvalidFieldListCodes() as $value_1) { - $values_1[] = $value_1; - } - $data['invalidFieldListCodes'] = $values_1; + if (\array_key_exists('invalidFieldList', $data)) { + $values = []; + foreach ($data['invalidFieldList'] as $value) { + $values[] = $value; } - if ($object->isInitialized('destinationAmbiguous') && null !== $object->getDestinationAmbiguous()) { - $data['destinationAmbiguous'] = $object->getDestinationAmbiguous(); - } - if ($object->isInitialized('originAmbiguous') && null !== $object->getOriginAmbiguous()) { - $data['originAmbiguous'] = $object->getOriginAmbiguous(); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; + $object->setInvalidFieldList($values); + unset($data['invalidFieldList']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ValidationList::class => false]; + if (\array_key_exists('invalidFieldListCodes', $data)) { + $values_1 = []; + foreach ($data['invalidFieldListCodes'] as $value_1) { + $values_1[] = $value_1; + } + $object->setInvalidFieldListCodes($values_1); + unset($data['invalidFieldListCodes']); } - } -} else { - class ValidationListNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ValidationList::class; + if (\array_key_exists('destinationAmbiguous', $data)) { + $object->setDestinationAmbiguous($data['destinationAmbiguous']); + unset($data['destinationAmbiguous']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ValidationList::class; + if (\array_key_exists('originAmbiguous', $data)) { + $object->setOriginAmbiguous($data['originAmbiguous']); + unset($data['originAmbiguous']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ValidationList(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('invalidFieldList', $data)) { - $values = []; - foreach ($data['invalidFieldList'] as $value) { - $values[] = $value; - } - $object->setInvalidFieldList($values); - unset($data['invalidFieldList']); - } - if (\array_key_exists('invalidFieldListCodes', $data)) { - $values_1 = []; - foreach ($data['invalidFieldListCodes'] as $value_1) { - $values_1[] = $value_1; - } - $object->setInvalidFieldListCodes($values_1); - unset($data['invalidFieldListCodes']); + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; } - if (\array_key_exists('destinationAmbiguous', $data)) { - $object->setDestinationAmbiguous($data['destinationAmbiguous']); - unset($data['destinationAmbiguous']); - } - if (\array_key_exists('originAmbiguous', $data)) { - $object->setOriginAmbiguous($data['originAmbiguous']); - unset($data['originAmbiguous']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('invalidFieldList') && null !== $object->getInvalidFieldList()) { - $values = []; - foreach ($object->getInvalidFieldList() as $value) { - $values[] = $value; - } - $data['invalidFieldList'] = $values; - } - if ($object->isInitialized('invalidFieldListCodes') && null !== $object->getInvalidFieldListCodes()) { - $values_1 = []; - foreach ($object->getInvalidFieldListCodes() as $value_1) { - $values_1[] = $value_1; - } - $data['invalidFieldListCodes'] = $values_1; - } - if ($object->isInitialized('destinationAmbiguous') && null !== $object->getDestinationAmbiguous()) { - $data['destinationAmbiguous'] = $object->getDestinationAmbiguous(); - } - if ($object->isInitialized('originAmbiguous') && null !== $object->getOriginAmbiguous()) { - $data['originAmbiguous'] = $object->getOriginAmbiguous(); + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + if ($data->isInitialized('invalidFieldList') && null !== $data->getInvalidFieldList()) { + $values = []; + foreach ($data->getInvalidFieldList() as $value) { + $values[] = $value; } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } + $dataArray['invalidFieldList'] = $values; + } + if ($data->isInitialized('invalidFieldListCodes') && null !== $data->getInvalidFieldListCodes()) { + $values_1 = []; + foreach ($data->getInvalidFieldListCodes() as $value_1) { + $values_1[] = $value_1; } - return $data; + $dataArray['invalidFieldListCodes'] = $values_1; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ValidationList::class => false]; + if ($data->isInitialized('destinationAmbiguous') && null !== $data->getDestinationAmbiguous()) { + $dataArray['destinationAmbiguous'] = $data->getDestinationAmbiguous(); } + if ($data->isInitialized('originAmbiguous') && null !== $data->getOriginAmbiguous()) { + $dataArray['originAmbiguous'] = $data->getOriginAmbiguous(); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_2; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ValidationList::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ValueCWTNormalizer.php b/src/Api/Normalizer/ValueCWTNormalizer.php index f65e5dec..13a81f13 100644 --- a/src/Api/Normalizer/ValueCWTNormalizer.php +++ b/src/Api/Normalizer/ValueCWTNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ValueCWTNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ValueCWTNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ValueCWT::class; + return $type === \ShipStream\Ups\Api\Model\ValueCWT::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ValueCWT::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ValueCWT::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ValueCWT(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ValueCWT(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ValueCWT::class => false]; - } - } -} else { - class ValueCWTNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ValueCWT::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ValueCWT::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ValueCWT(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ValueCWT::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ValueCWT::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/ValueCubeNormalizer.php b/src/Api/Normalizer/ValueCubeNormalizer.php index 0982eeda..bca4f946 100644 --- a/src/Api/Normalizer/ValueCubeNormalizer.php +++ b/src/Api/Normalizer/ValueCubeNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ValueCubeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ValueCubeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ValueCube::class; + return $type === \ShipStream\Ups\Api\Model\ValueCube::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ValueCube::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ValueCube::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ValueCube(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\ValueCube(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ValueCube::class => false]; - } - } -} else { - class ValueCubeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\ValueCube::class; + if (\array_key_exists('CurrencyCode', $data)) { + $object->setCurrencyCode($data['CurrencyCode']); + unset($data['CurrencyCode']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\ValueCube::class; + if (\array_key_exists('MonetaryValue', $data)) { + $object->setMonetaryValue($data['MonetaryValue']); + unset($data['MonetaryValue']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\ValueCube(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CurrencyCode', $data)) { - $object->setCurrencyCode($data['CurrencyCode']); - unset($data['CurrencyCode']); - } - if (\array_key_exists('MonetaryValue', $data)) { - $object->setMonetaryValue($data['MonetaryValue']); - unset($data['MonetaryValue']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['CurrencyCode'] = $object->getCurrencyCode(); - $data['MonetaryValue'] = $object->getMonetaryValue(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['CurrencyCode'] = $data->getCurrencyCode(); + $dataArray['MonetaryValue'] = $data->getMonetaryValue(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\ValueCube::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\ValueCube::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/VoidRequestTransactionReferenceNormalizer.php b/src/Api/Normalizer/VoidRequestTransactionReferenceNormalizer.php index 8fb31714..2371adb9 100644 --- a/src/Api/Normalizer/VoidRequestTransactionReferenceNormalizer.php +++ b/src/Api/Normalizer/VoidRequestTransactionReferenceNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class VoidRequestTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class VoidRequestTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class; + return $type === \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidRequestTransactionReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CustomerContext', $data)) { - $object->setCustomerContext($data['CustomerContext']); - unset($data['CustomerContext']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\VoidRequestTransactionReference(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('customerContext') && null !== $object->getCustomerContext()) { - $data['CustomerContext'] = $object->getCustomerContext(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CustomerContext', $data)) { + $object->setCustomerContext($data['CustomerContext']); + unset($data['CustomerContext']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class VoidRequestTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class; + $dataArray = []; + if ($data->isInitialized('customerContext') && null !== $data->getCustomerContext()) { + $dataArray['CustomerContext'] = $data->getCustomerContext(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidRequestTransactionReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CustomerContext', $data)) { - $object->setCustomerContext($data['CustomerContext']); - unset($data['CustomerContext']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('customerContext') && null !== $object->getCustomerContext()) { - $data['CustomerContext'] = $object->getCustomerContext(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/VoidResponseResponseStatusNormalizer.php b/src/Api/Normalizer/VoidResponseResponseStatusNormalizer.php index 0c5b3f0a..bf35ce55 100644 --- a/src/Api/Normalizer/VoidResponseResponseStatusNormalizer.php +++ b/src/Api/Normalizer/VoidResponseResponseStatusNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class VoidResponseResponseStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class VoidResponseResponseStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class; + return $type === \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidResponseResponseStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\VoidResponseResponseStatus(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class => false]; - } - } -} else { - class VoidResponseResponseStatusNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidResponseResponseStatus(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/VoidResponseTransactionReferenceNormalizer.php b/src/Api/Normalizer/VoidResponseTransactionReferenceNormalizer.php index 643278c2..4f39c58e 100644 --- a/src/Api/Normalizer/VoidResponseTransactionReferenceNormalizer.php +++ b/src/Api/Normalizer/VoidResponseTransactionReferenceNormalizer.php @@ -5,130 +5,64 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class VoidResponseTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class VoidResponseTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class; + return $type === \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidResponseTransactionReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CustomerContext', $data)) { - $object->setCustomerContext($data['CustomerContext']); - unset($data['CustomerContext']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\VoidResponseTransactionReference(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('customerContext') && null !== $object->getCustomerContext()) { - $data['CustomerContext'] = $object->getCustomerContext(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('CustomerContext', $data)) { + $object->setCustomerContext($data['CustomerContext']); + unset($data['CustomerContext']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class VoidResponseTransactionReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class; + $dataArray = []; + if ($data->isInitialized('customerContext') && null !== $data->getCustomerContext()) { + $dataArray['CustomerContext'] = $data->getCustomerContext(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidResponseTransactionReference(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('CustomerContext', $data)) { - $object->setCustomerContext($data['CustomerContext']); - unset($data['CustomerContext']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('customerContext') && null !== $object->getCustomerContext()) { - $data['CustomerContext'] = $object->getCustomerContext(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/VoidShipmentRequestNormalizer.php b/src/Api/Normalizer/VoidShipmentRequestNormalizer.php index fa24ed0d..1e699972 100644 --- a/src/Api/Normalizer/VoidShipmentRequestNormalizer.php +++ b/src/Api/Normalizer/VoidShipmentRequestNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class VoidShipmentRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class VoidShipmentRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentRequest::class; + return $type === \ShipStream\Ups\Api\Model\VoidShipmentRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('VoidShipment', $data)) { - $object->setVoidShipment($this->denormalizer->denormalize($data['VoidShipment'], \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class, 'json', $context)); - unset($data['VoidShipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\VoidShipmentRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['VoidShipment'] = $this->normalizer->normalize($object->getVoidShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentRequest::class => false]; - } - } -} else { - class VoidShipmentRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentRequest::class; + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class, 'json', $context)); + unset($data['Request']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentRequest::class; + if (\array_key_exists('VoidShipment', $data)) { + $object->setVoidShipment($this->denormalizer->denormalize($data['VoidShipment'], \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class, 'json', $context)); + unset($data['VoidShipment']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('VoidShipment', $data)) { - $object->setVoidShipment($this->denormalizer->denormalize($data['VoidShipment'], \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class, 'json', $context)); - unset($data['VoidShipment']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - $data['VoidShipment'] = $this->normalizer->normalize($object->getVoidShipment(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + $dataArray['VoidShipment'] = $this->normalizer->normalize($data->getVoidShipment(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\VoidShipmentRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/VoidShipmentRequestRequestNormalizer.php b/src/Api/Normalizer/VoidShipmentRequestRequestNormalizer.php index 08d419ee..af6465c7 100644 --- a/src/Api/Normalizer/VoidShipmentRequestRequestNormalizer.php +++ b/src/Api/Normalizer/VoidShipmentRequestRequestNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class VoidShipmentRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class VoidShipmentRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class VoidShipmentRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('requestOption') && null !== $data->getRequestOption()) { + $dataArray['RequestOption'] = $data->getRequestOption(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\VoidRequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('requestOption') && null !== $object->getRequestOption()) { - $data['RequestOption'] = $object->getRequestOption(); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\VoidShipmentRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/VoidShipmentRequestVoidShipmentNormalizer.php b/src/Api/Normalizer/VoidShipmentRequestVoidShipmentNormalizer.php index 3fa114e5..b726fe8f 100644 --- a/src/Api/Normalizer/VoidShipmentRequestVoidShipmentNormalizer.php +++ b/src/Api/Normalizer/VoidShipmentRequestVoidShipmentNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class VoidShipmentRequestVoidShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class VoidShipmentRequestVoidShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class; + return $type === \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShippingHistoryUserKey', $data)) { - $object->setShippingHistoryUserKey($data['ShippingHistoryUserKey']); - unset($data['ShippingHistoryUserKey']); - } - if (\array_key_exists('ShipmentIdentificationNumber', $data)) { - $object->setShipmentIdentificationNumber($data['ShipmentIdentificationNumber']); - unset($data['ShipmentIdentificationNumber']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $values = []; - foreach ($data['TrackingNumber'] as $value) { - $values[] = $value; - } - $object->setTrackingNumber($values); - unset($data['TrackingNumber']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('shippingHistoryUserKey') && null !== $object->getShippingHistoryUserKey()) { - $data['ShippingHistoryUserKey'] = $object->getShippingHistoryUserKey(); - } - $data['ShipmentIdentificationNumber'] = $object->getShipmentIdentificationNumber(); - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $values = []; - foreach ($object->getTrackingNumber() as $value) { - $values[] = $value; - } - $data['TrackingNumber'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ShippingHistoryUserKey', $data)) { + $object->setShippingHistoryUserKey($data['ShippingHistoryUserKey']); + unset($data['ShippingHistoryUserKey']); + } + if (\array_key_exists('ShipmentIdentificationNumber', $data)) { + $object->setShipmentIdentificationNumber($data['ShipmentIdentificationNumber']); + unset($data['ShipmentIdentificationNumber']); + } + if (\array_key_exists('TrackingNumber', $data)) { + $values = []; + foreach ($data['TrackingNumber'] as $value) { + $values[] = $value; } - return $data; + $object->setTrackingNumber($values); + unset($data['TrackingNumber']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class VoidShipmentRequestVoidShipmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class; + $dataArray = []; + if ($data->isInitialized('shippingHistoryUserKey') && null !== $data->getShippingHistoryUserKey()) { + $dataArray['ShippingHistoryUserKey'] = $data->getShippingHistoryUserKey(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ShippingHistoryUserKey', $data)) { - $object->setShippingHistoryUserKey($data['ShippingHistoryUserKey']); - unset($data['ShippingHistoryUserKey']); - } - if (\array_key_exists('ShipmentIdentificationNumber', $data)) { - $object->setShipmentIdentificationNumber($data['ShipmentIdentificationNumber']); - unset($data['ShipmentIdentificationNumber']); - } - if (\array_key_exists('TrackingNumber', $data)) { - $values = []; - foreach ($data['TrackingNumber'] as $value) { - $values[] = $value; - } - $object->setTrackingNumber($values); - unset($data['TrackingNumber']); + $dataArray['ShipmentIdentificationNumber'] = $data->getShipmentIdentificationNumber(); + if ($data->isInitialized('trackingNumber') && null !== $data->getTrackingNumber()) { + $values = []; + foreach ($data->getTrackingNumber() as $value) { + $values[] = $value; } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray['TrackingNumber'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('shippingHistoryUserKey') && null !== $object->getShippingHistoryUserKey()) { - $data['ShippingHistoryUserKey'] = $object->getShippingHistoryUserKey(); - } - $data['ShipmentIdentificationNumber'] = $object->getShipmentIdentificationNumber(); - if ($object->isInitialized('trackingNumber') && null !== $object->getTrackingNumber()) { - $values = []; - foreach ($object->getTrackingNumber() as $value) { - $values[] = $value; - } - $data['TrackingNumber'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\VoidShipmentRequestVoidShipment::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/VoidShipmentResponseNormalizer.php b/src/Api/Normalizer/VoidShipmentResponseNormalizer.php index 843fc9da..cb915105 100644 --- a/src/Api/Normalizer/VoidShipmentResponseNormalizer.php +++ b/src/Api/Normalizer/VoidShipmentResponseNormalizer.php @@ -5,166 +5,82 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class VoidShipmentResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class VoidShipmentResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentResponse::class; + return $type === \ShipStream\Ups\Api\Model\VoidShipmentResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('SummaryResult', $data)) { - $object->setSummaryResult($this->denormalizer->denormalize($data['SummaryResult'], \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class, 'json', $context)); - unset($data['SummaryResult']); - } - if (\array_key_exists('PackageLevelResult', $data)) { - $values = []; - foreach ($data['PackageLevelResult'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class, 'json', $context); - } - $object->setPackageLevelResult($values); - unset($data['PackageLevelResult']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\VoidShipmentResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['SummaryResult'] = $this->normalizer->normalize($object->getSummaryResult(), 'json', $context); - if ($object->isInitialized('packageLevelResult') && null !== $object->getPackageLevelResult()) { - $values = []; - foreach ($object->getPackageLevelResult() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PackageLevelResult'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class, 'json', $context)); + unset($data['Response']); + } + if (\array_key_exists('SummaryResult', $data)) { + $object->setSummaryResult($this->denormalizer->denormalize($data['SummaryResult'], \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class, 'json', $context)); + unset($data['SummaryResult']); + } + if (\array_key_exists('PackageLevelResult', $data)) { + $values = []; + foreach ($data['PackageLevelResult'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class, 'json', $context); } - return $data; + $object->setPackageLevelResult($values); + unset($data['PackageLevelResult']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class VoidShipmentResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentResponse::class; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + $dataArray['SummaryResult'] = $this->normalizer->normalize($data->getSummaryResult(), 'json', $context); + if ($data->isInitialized('packageLevelResult') && null !== $data->getPackageLevelResult()) { + $values = []; + foreach ($data->getPackageLevelResult() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['PackageLevelResult'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('SummaryResult', $data)) { - $object->setSummaryResult($this->denormalizer->denormalize($data['SummaryResult'], \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class, 'json', $context)); - unset($data['SummaryResult']); - } - if (\array_key_exists('PackageLevelResult', $data)) { - $values = []; - foreach ($data['PackageLevelResult'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class, 'json', $context); - } - $object->setPackageLevelResult($values); - unset($data['PackageLevelResult']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - $data['SummaryResult'] = $this->normalizer->normalize($object->getSummaryResult(), 'json', $context); - if ($object->isInitialized('packageLevelResult') && null !== $object->getPackageLevelResult()) { - $values = []; - foreach ($object->getPackageLevelResult() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['PackageLevelResult'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\VoidShipmentResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/VoidShipmentResponsePackageLevelResultNormalizer.php b/src/Api/Normalizer/VoidShipmentResponsePackageLevelResultNormalizer.php index 56385276..e907eaf1 100644 --- a/src/Api/Normalizer/VoidShipmentResponsePackageLevelResultNormalizer.php +++ b/src/Api/Normalizer/VoidShipmentResponsePackageLevelResultNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class VoidShipmentResponsePackageLevelResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class VoidShipmentResponsePackageLevelResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class; + return $type === \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('Status', $data)) { - $object->setStatus($this->denormalizer->denormalize($data['Status'], \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class, 'json', $context)); - unset($data['Status']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['TrackingNumber'] = $object->getTrackingNumber(); - $data['Status'] = $this->normalizer->normalize($object->getStatus(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class => false]; - } - } -} else { - class VoidShipmentResponsePackageLevelResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class; + if (\array_key_exists('TrackingNumber', $data)) { + $object->setTrackingNumber($data['TrackingNumber']); + unset($data['TrackingNumber']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class; + if (\array_key_exists('Status', $data)) { + $object->setStatus($this->denormalizer->denormalize($data['Status'], \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class, 'json', $context)); + unset($data['Status']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('TrackingNumber', $data)) { - $object->setTrackingNumber($data['TrackingNumber']); - unset($data['TrackingNumber']); - } - if (\array_key_exists('Status', $data)) { - $object->setStatus($this->denormalizer->denormalize($data['Status'], \ShipStream\Ups\Api\Model\PackageLevelResultStatus::class, 'json', $context)); - unset($data['Status']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['TrackingNumber'] = $object->getTrackingNumber(); - $data['Status'] = $this->normalizer->normalize($object->getStatus(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['TrackingNumber'] = $data->getTrackingNumber(); + $dataArray['Status'] = $this->normalizer->normalize($data->getStatus(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\VoidShipmentResponsePackageLevelResult::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/VoidShipmentResponseResponseNormalizer.php b/src/Api/Normalizer/VoidShipmentResponseResponseNormalizer.php index 69ae0290..ecf670b9 100644 --- a/src/Api/Normalizer/VoidShipmentResponseResponseNormalizer.php +++ b/src/Api/Normalizer/VoidShipmentResponseResponseNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class VoidShipmentResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class VoidShipmentResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class => false]; + if (\array_key_exists('Alert', $data)) { + $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); + unset($data['Alert']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class VoidShipmentResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $dataArray['Alert'] = $this->normalizer->normalize($data->getAlert(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\VoidResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Alert', $data)) { - $object->setAlert($this->denormalizer->denormalize($data['Alert'], \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context)); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\VoidResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $data['Alert'] = $this->normalizer->normalize($object->getAlert(), 'json', $context); - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\VoidShipmentResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/VoidShipmentResponseSummaryResultNormalizer.php b/src/Api/Normalizer/VoidShipmentResponseSummaryResultNormalizer.php index cd3a2fc8..97c37a41 100644 --- a/src/Api/Normalizer/VoidShipmentResponseSummaryResultNormalizer.php +++ b/src/Api/Normalizer/VoidShipmentResponseSummaryResultNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class VoidShipmentResponseSummaryResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class VoidShipmentResponseSummaryResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class; + return $type === \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Status', $data)) { - $object->setStatus($this->denormalizer->denormalize($data['Status'], \ShipStream\Ups\Api\Model\SummaryResultStatus::class, 'json', $context)); - unset($data['Status']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Status'] = $this->normalizer->normalize($object->getStatus(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Status', $data)) { + $object->setStatus($this->denormalizer->denormalize($data['Status'], \ShipStream\Ups\Api\Model\SummaryResultStatus::class, 'json', $context)); + unset($data['Status']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class VoidShipmentResponseSummaryResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['Status'] = $this->normalizer->normalize($data->getStatus(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Status', $data)) { - $object->setStatus($this->denormalizer->denormalize($data['Status'], \ShipStream\Ups\Api\Model\SummaryResultStatus::class, 'json', $context)); - unset($data['Status']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Status'] = $this->normalizer->normalize($object->getStatus(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\VoidShipmentResponseSummaryResult::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/WarningNormalizer.php b/src/Api/Normalizer/WarningNormalizer.php index d2997deb..5523eace 100644 --- a/src/Api/Normalizer/WarningNormalizer.php +++ b/src/Api/Normalizer/WarningNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class WarningNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class WarningNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Warning::class; + return $type === \ShipStream\Ups\Api\Model\Warning::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Warning::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Warning::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Warning(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('message', $data)) { - $object->setMessage($data['message']); - unset($data['message']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\Warning(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('message') && null !== $object->getMessage()) { - $data['message'] = $object->getMessage(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('code', $data)) { + $object->setCode($data['code']); + unset($data['code']); + } + if (\array_key_exists('message', $data)) { + $object->setMessage($data['message']); + unset($data['message']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Warning::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class WarningNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Warning::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Warning::class; + $dataArray = []; + if ($data->isInitialized('code') && null !== $data->getCode()) { + $dataArray['code'] = $data->getCode(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Warning(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('message', $data)) { - $object->setMessage($data['message']); - unset($data['message']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('message') && null !== $data->getMessage()) { + $dataArray['message'] = $data->getMessage(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('message') && null !== $object->getMessage()) { - $data['message'] = $object->getMessage(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Warning::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Warning::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/WeightNormalizer.php b/src/Api/Normalizer/WeightNormalizer.php index 7446e5d0..770f0feb 100644 --- a/src/Api/Normalizer/WeightNormalizer.php +++ b/src/Api/Normalizer/WeightNormalizer.php @@ -5,144 +5,71 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class WeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class WeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Weight::class; + return $type === \ShipStream\Ups\Api\Model\Weight::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Weight::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Weight::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Weight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('unitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($data['unitOfMeasurement']); - unset($data['unitOfMeasurement']); - } - if (\array_key_exists('weight', $data)) { - $object->setWeight($data['weight']); - unset($data['weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\Weight(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['unitOfMeasurement'] = $object->getUnitOfMeasurement(); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['weight'] = $object->getWeight(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('unitOfMeasurement', $data)) { + $object->setUnitOfMeasurement($data['unitOfMeasurement']); + unset($data['unitOfMeasurement']); + } + if (\array_key_exists('weight', $data)) { + $object->setWeight($data['weight']); + unset($data['weight']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Weight::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class WeightNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\Weight::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\Weight::class; + $dataArray = []; + if ($data->isInitialized('unitOfMeasurement') && null !== $data->getUnitOfMeasurement()) { + $dataArray['unitOfMeasurement'] = $data->getUnitOfMeasurement(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\Weight(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('unitOfMeasurement', $data)) { - $object->setUnitOfMeasurement($data['unitOfMeasurement']); - unset($data['unitOfMeasurement']); - } - if (\array_key_exists('weight', $data)) { - $object->setWeight($data['weight']); - unset($data['weight']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; + if ($data->isInitialized('weight') && null !== $data->getWeight()) { + $dataArray['weight'] = $data->getWeight(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('unitOfMeasurement') && null !== $object->getUnitOfMeasurement()) { - $data['unitOfMeasurement'] = $object->getUnitOfMeasurement(); - } - if ($object->isInitialized('weight') && null !== $object->getWeight()) { - $data['weight'] = $object->getWeight(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\Weight::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\Weight::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/WeightUnitOfMeasurementNormalizer.php b/src/Api/Normalizer/WeightUnitOfMeasurementNormalizer.php index a5645608..d299de9e 100644 --- a/src/Api/Normalizer/WeightUnitOfMeasurementNormalizer.php +++ b/src/Api/Normalizer/WeightUnitOfMeasurementNormalizer.php @@ -5,140 +5,69 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class WeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class WeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class; + return $type === \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); + } + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class WeightUnitOfMeasurementNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class; + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + if ($data->isInitialized('description') && null !== $data->getDescription()) { + $dataArray['Description'] = $data->getDescription(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\WeightUnitOfMeasurement(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['Description'] = $object->getDescription(); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\WeightUnitOfMeasurement::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/XAVRequestAddressKeyFormatNormalizer.php b/src/Api/Normalizer/XAVRequestAddressKeyFormatNormalizer.php index ef94d2d1..3262e961 100644 --- a/src/Api/Normalizer/XAVRequestAddressKeyFormatNormalizer.php +++ b/src/Api/Normalizer/XAVRequestAddressKeyFormatNormalizer.php @@ -5,280 +5,139 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class XAVRequestAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class XAVRequestAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class; + return $type === \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('Region', $data)) { - $object->setRegion($data['Region']); - unset($data['Region']); - } - if (\array_key_exists('PoliticalDivision2', $data) && $data['PoliticalDivision2'] !== null) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); - } - elseif (\array_key_exists('PoliticalDivision2', $data) && $data['PoliticalDivision2'] === null) { - $object->setPoliticalDivision2(null); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - if (\array_key_exists('PostcodeExtendedLow', $data) && $data['PostcodeExtendedLow'] !== null) { - $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); - unset($data['PostcodeExtendedLow']); - } - elseif (\array_key_exists('PostcodeExtendedLow', $data) && $data['PostcodeExtendedLow'] === null) { - $object->setPostcodeExtendedLow(null); - } - if (\array_key_exists('Urbanization', $data)) { - $object->setUrbanization($data['Urbanization']); - unset($data['Urbanization']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('region') && null !== $object->getRegion()) { - $data['Region'] = $object->getRegion(); - } - if ($object->isInitialized('politicalDivision2') && null !== $object->getPoliticalDivision2()) { - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - } - if ($object->isInitialized('politicalDivision1') && null !== $object->getPoliticalDivision1()) { - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - } - if ($object->isInitialized('postcodePrimaryLow') && null !== $object->getPostcodePrimaryLow()) { - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - } - if ($object->isInitialized('postcodeExtendedLow') && null !== $object->getPostcodeExtendedLow()) { - $data['PostcodeExtendedLow'] = $object->getPostcodeExtendedLow(); - } - if ($object->isInitialized('urbanization') && null !== $object->getUrbanization()) { - $data['Urbanization'] = $object->getUrbanization(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ConsigneeName', $data)) { + $object->setConsigneeName($data['ConsigneeName']); + unset($data['ConsigneeName']); + } + if (\array_key_exists('AttentionName', $data)) { + $object->setAttentionName($data['AttentionName']); + unset($data['AttentionName']); + } + if (\array_key_exists('AddressLine', $data)) { + $values = []; + foreach ($data['AddressLine'] as $value) { + $values[] = $value; } - return $data; + $object->setAddressLine($values); + unset($data['AddressLine']); + } + if (\array_key_exists('Region', $data)) { + $object->setRegion($data['Region']); + unset($data['Region']); + } + if (\array_key_exists('PoliticalDivision2', $data) && $data['PoliticalDivision2'] !== null) { + $object->setPoliticalDivision2($data['PoliticalDivision2']); + unset($data['PoliticalDivision2']); + } + elseif (\array_key_exists('PoliticalDivision2', $data) && $data['PoliticalDivision2'] === null) { + $object->setPoliticalDivision2(null); + } + if (\array_key_exists('PoliticalDivision1', $data)) { + $object->setPoliticalDivision1($data['PoliticalDivision1']); + unset($data['PoliticalDivision1']); + } + if (\array_key_exists('PostcodePrimaryLow', $data)) { + $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); + unset($data['PostcodePrimaryLow']); + } + if (\array_key_exists('PostcodeExtendedLow', $data) && $data['PostcodeExtendedLow'] !== null) { + $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); + unset($data['PostcodeExtendedLow']); + } + elseif (\array_key_exists('PostcodeExtendedLow', $data) && $data['PostcodeExtendedLow'] === null) { + $object->setPostcodeExtendedLow(null); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class => false]; + if (\array_key_exists('Urbanization', $data)) { + $object->setUrbanization($data['Urbanization']); + unset($data['Urbanization']); } + if (\array_key_exists('CountryCode', $data)) { + $object->setCountryCode($data['CountryCode']); + unset($data['CountryCode']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } -} else { - class XAVRequestAddressKeyFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class; + $dataArray = []; + if ($data->isInitialized('consigneeName') && null !== $data->getConsigneeName()) { + $dataArray['ConsigneeName'] = $data->getConsigneeName(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class; + if ($data->isInitialized('attentionName') && null !== $data->getAttentionName()) { + $dataArray['AttentionName'] = $data->getAttentionName(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ConsigneeName', $data)) { - $object->setConsigneeName($data['ConsigneeName']); - unset($data['ConsigneeName']); - } - if (\array_key_exists('AttentionName', $data)) { - $object->setAttentionName($data['AttentionName']); - unset($data['AttentionName']); - } - if (\array_key_exists('AddressLine', $data)) { - $values = []; - foreach ($data['AddressLine'] as $value) { - $values[] = $value; - } - $object->setAddressLine($values); - unset($data['AddressLine']); - } - if (\array_key_exists('Region', $data)) { - $object->setRegion($data['Region']); - unset($data['Region']); - } - if (\array_key_exists('PoliticalDivision2', $data) && $data['PoliticalDivision2'] !== null) { - $object->setPoliticalDivision2($data['PoliticalDivision2']); - unset($data['PoliticalDivision2']); + if ($data->isInitialized('addressLine') && null !== $data->getAddressLine()) { + $values = []; + foreach ($data->getAddressLine() as $value) { + $values[] = $value; } - elseif (\array_key_exists('PoliticalDivision2', $data) && $data['PoliticalDivision2'] === null) { - $object->setPoliticalDivision2(null); - } - if (\array_key_exists('PoliticalDivision1', $data)) { - $object->setPoliticalDivision1($data['PoliticalDivision1']); - unset($data['PoliticalDivision1']); - } - if (\array_key_exists('PostcodePrimaryLow', $data)) { - $object->setPostcodePrimaryLow($data['PostcodePrimaryLow']); - unset($data['PostcodePrimaryLow']); - } - if (\array_key_exists('PostcodeExtendedLow', $data) && $data['PostcodeExtendedLow'] !== null) { - $object->setPostcodeExtendedLow($data['PostcodeExtendedLow']); - unset($data['PostcodeExtendedLow']); - } - elseif (\array_key_exists('PostcodeExtendedLow', $data) && $data['PostcodeExtendedLow'] === null) { - $object->setPostcodeExtendedLow(null); - } - if (\array_key_exists('Urbanization', $data)) { - $object->setUrbanization($data['Urbanization']); - unset($data['Urbanization']); - } - if (\array_key_exists('CountryCode', $data)) { - $object->setCountryCode($data['CountryCode']); - unset($data['CountryCode']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray['AddressLine'] = $values; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('consigneeName') && null !== $object->getConsigneeName()) { - $data['ConsigneeName'] = $object->getConsigneeName(); - } - if ($object->isInitialized('attentionName') && null !== $object->getAttentionName()) { - $data['AttentionName'] = $object->getAttentionName(); - } - if ($object->isInitialized('addressLine') && null !== $object->getAddressLine()) { - $values = []; - foreach ($object->getAddressLine() as $value) { - $values[] = $value; - } - $data['AddressLine'] = $values; - } - if ($object->isInitialized('region') && null !== $object->getRegion()) { - $data['Region'] = $object->getRegion(); - } - if ($object->isInitialized('politicalDivision2') && null !== $object->getPoliticalDivision2()) { - $data['PoliticalDivision2'] = $object->getPoliticalDivision2(); - } - if ($object->isInitialized('politicalDivision1') && null !== $object->getPoliticalDivision1()) { - $data['PoliticalDivision1'] = $object->getPoliticalDivision1(); - } - if ($object->isInitialized('postcodePrimaryLow') && null !== $object->getPostcodePrimaryLow()) { - $data['PostcodePrimaryLow'] = $object->getPostcodePrimaryLow(); - } - if ($object->isInitialized('postcodeExtendedLow') && null !== $object->getPostcodeExtendedLow()) { - $data['PostcodeExtendedLow'] = $object->getPostcodeExtendedLow(); - } - if ($object->isInitialized('urbanization') && null !== $object->getUrbanization()) { - $data['Urbanization'] = $object->getUrbanization(); - } - $data['CountryCode'] = $object->getCountryCode(); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + if ($data->isInitialized('region') && null !== $data->getRegion()) { + $dataArray['Region'] = $data->getRegion(); + } + if ($data->isInitialized('politicalDivision2')) { + $dataArray['PoliticalDivision2'] = $data->getPoliticalDivision2(); + } + if ($data->isInitialized('politicalDivision1') && null !== $data->getPoliticalDivision1()) { + $dataArray['PoliticalDivision1'] = $data->getPoliticalDivision1(); + } + if ($data->isInitialized('postcodePrimaryLow') && null !== $data->getPostcodePrimaryLow()) { + $dataArray['PostcodePrimaryLow'] = $data->getPostcodePrimaryLow(); + } + if ($data->isInitialized('postcodeExtendedLow')) { + $dataArray['PostcodeExtendedLow'] = $data->getPostcodeExtendedLow(); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class => false]; + if ($data->isInitialized('urbanization') && null !== $data->getUrbanization()) { + $dataArray['Urbanization'] = $data->getUrbanization(); } + $dataArray['CountryCode'] = $data->getCountryCode(); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } + } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/XAVRequestNormalizer.php b/src/Api/Normalizer/XAVRequestNormalizer.php index 2eaa63a4..ee629aee 100644 --- a/src/Api/Normalizer/XAVRequestNormalizer.php +++ b/src/Api/Normalizer/XAVRequestNormalizer.php @@ -5,180 +5,89 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class XAVRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class XAVRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVRequest::class; + return $type === \ShipStream\Ups\Api\Model\XAVRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\XAVRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('RegionalRequestIndicator', $data)) { - $object->setRegionalRequestIndicator($data['RegionalRequestIndicator']); - unset($data['RegionalRequestIndicator']); - } - if (\array_key_exists('MaximumCandidateListSize', $data)) { - $object->setMaximumCandidateListSize($data['MaximumCandidateListSize']); - unset($data['MaximumCandidateListSize']); - } - if (\array_key_exists('AddressKeyFormat', $data)) { - $values = []; - foreach ($data['AddressKeyFormat'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class, 'json', $context); - } - $object->setAddressKeyFormat($values); - unset($data['AddressKeyFormat']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\XAVRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('regionalRequestIndicator') && null !== $object->getRegionalRequestIndicator()) { - $data['RegionalRequestIndicator'] = $object->getRegionalRequestIndicator(); - } - if ($object->isInitialized('maximumCandidateListSize') && null !== $object->getMaximumCandidateListSize()) { - $data['MaximumCandidateListSize'] = $object->getMaximumCandidateListSize(); - } + if (\array_key_exists('Request', $data)) { + $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\XAVRequestRequest::class, 'json', $context)); + unset($data['Request']); + } + if (\array_key_exists('RegionalRequestIndicator', $data)) { + $object->setRegionalRequestIndicator($data['RegionalRequestIndicator']); + unset($data['RegionalRequestIndicator']); + } + if (\array_key_exists('MaximumCandidateListSize', $data)) { + $object->setMaximumCandidateListSize($data['MaximumCandidateListSize']); + unset($data['MaximumCandidateListSize']); + } + if (\array_key_exists('AddressKeyFormat', $data)) { $values = []; - foreach ($object->getAddressKeyFormat() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['AddressKeyFormat'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + foreach ($data['AddressKeyFormat'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class, 'json', $context); } - return $data; + $object->setAddressKeyFormat($values); + unset($data['AddressKeyFormat']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVRequest::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class XAVRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVRequest::class; + $dataArray = []; + $dataArray['Request'] = $this->normalizer->normalize($data->getRequest(), 'json', $context); + if ($data->isInitialized('regionalRequestIndicator') && null !== $data->getRegionalRequestIndicator()) { + $dataArray['RegionalRequestIndicator'] = $data->getRegionalRequestIndicator(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVRequest::class; + if ($data->isInitialized('maximumCandidateListSize') && null !== $data->getMaximumCandidateListSize()) { + $dataArray['MaximumCandidateListSize'] = $data->getMaximumCandidateListSize(); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Request', $data)) { - $object->setRequest($this->denormalizer->denormalize($data['Request'], \ShipStream\Ups\Api\Model\XAVRequestRequest::class, 'json', $context)); - unset($data['Request']); - } - if (\array_key_exists('RegionalRequestIndicator', $data)) { - $object->setRegionalRequestIndicator($data['RegionalRequestIndicator']); - unset($data['RegionalRequestIndicator']); - } - if (\array_key_exists('MaximumCandidateListSize', $data)) { - $object->setMaximumCandidateListSize($data['MaximumCandidateListSize']); - unset($data['MaximumCandidateListSize']); - } - if (\array_key_exists('AddressKeyFormat', $data)) { - $values = []; - foreach ($data['AddressKeyFormat'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\XAVRequestAddressKeyFormat::class, 'json', $context); - } - $object->setAddressKeyFormat($values); - unset($data['AddressKeyFormat']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $values = []; + foreach ($data->getAddressKeyFormat() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Request'] = $this->normalizer->normalize($object->getRequest(), 'json', $context); - if ($object->isInitialized('regionalRequestIndicator') && null !== $object->getRegionalRequestIndicator()) { - $data['RegionalRequestIndicator'] = $object->getRegionalRequestIndicator(); - } - if ($object->isInitialized('maximumCandidateListSize') && null !== $object->getMaximumCandidateListSize()) { - $data['MaximumCandidateListSize'] = $object->getMaximumCandidateListSize(); - } - $values = []; - foreach ($object->getAddressKeyFormat() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + $dataArray['AddressKeyFormat'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - $data['AddressKeyFormat'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\XAVRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/XAVRequestRequestNormalizer.php b/src/Api/Normalizer/XAVRequestRequestNormalizer.php index 7735fd2a..a7df510f 100644 --- a/src/Api/Normalizer/XAVRequestRequestNormalizer.php +++ b/src/Api/Normalizer/XAVRequestRequestNormalizer.php @@ -5,154 +5,76 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class XAVRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class XAVRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVRequestRequest::class; + return $type === \ShipStream\Ups\Api\Model\XAVRequestRequest::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVRequestRequest::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVRequestRequest::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); - } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\XAVRequestRequest(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - $data['RequestOption'] = $object->getRequestOption(); - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('SubVersion', $data)) { + $object->setSubVersion($data['SubVersion']); + unset($data['SubVersion']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVRequestRequest::class => false]; + if (\array_key_exists('RequestOption', $data)) { + $object->setRequestOption($data['RequestOption']); + unset($data['RequestOption']); } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } -} else { - class XAVRequestRequestNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVRequestRequest::class; + $dataArray = []; + if ($data->isInitialized('subVersion') && null !== $data->getSubVersion()) { + $dataArray['SubVersion'] = $data->getSubVersion(); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVRequestRequest::class; + $dataArray['RequestOption'] = $data->getRequestOption(); + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVRequestRequest(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('SubVersion', $data)) { - $object->setSubVersion($data['SubVersion']); - unset($data['SubVersion']); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('RequestOption', $data)) { - $object->setRequestOption($data['RequestOption']); - unset($data['RequestOption']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\RequestTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('subVersion') && null !== $object->getSubVersion()) { - $data['SubVersion'] = $object->getSubVersion(); - } - $data['RequestOption'] = $object->getRequestOption(); - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVRequestRequest::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\XAVRequestRequest::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/XAVRequestWrapperNormalizer.php b/src/Api/Normalizer/XAVRequestWrapperNormalizer.php index 8e026040..6b1f0e31 100644 --- a/src/Api/Normalizer/XAVRequestWrapperNormalizer.php +++ b/src/Api/Normalizer/XAVRequestWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class XAVRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class XAVRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVRequestWrapper::class; + return $type === \ShipStream\Ups\Api\Model\XAVRequestWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVRequestWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVRequestWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('XAVRequest', $data)) { - $object->setXAVRequest($this->denormalizer->denormalize($data['XAVRequest'], \ShipStream\Ups\Api\Model\XAVRequest::class, 'json', $context)); - unset($data['XAVRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\XAVRequestWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['XAVRequest'] = $this->normalizer->normalize($object->getXAVRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('XAVRequest', $data)) { + $object->setXAVRequest($this->denormalizer->denormalize($data['XAVRequest'], \ShipStream\Ups\Api\Model\XAVRequest::class, 'json', $context)); + unset($data['XAVRequest']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVRequestWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class XAVRequestWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVRequestWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVRequestWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVRequestWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['XAVRequest'] = $this->normalizer->normalize($data->getXAVRequest(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('XAVRequest', $data)) { - $object->setXAVRequest($this->denormalizer->denormalize($data['XAVRequest'], \ShipStream\Ups\Api\Model\XAVRequest::class, 'json', $context)); - unset($data['XAVRequest']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['XAVRequest'] = $this->normalizer->normalize($object->getXAVRequest(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVRequestWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\XAVRequestWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/XAVResponseAddressClassificationNormalizer.php b/src/Api/Normalizer/XAVResponseAddressClassificationNormalizer.php index 4ea9f25c..4ce5e24a 100644 --- a/src/Api/Normalizer/XAVResponseAddressClassificationNormalizer.php +++ b/src/Api/Normalizer/XAVResponseAddressClassificationNormalizer.php @@ -5,136 +5,67 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class XAVResponseAddressClassificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class XAVResponseAddressClassificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class; + return $type === \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVResponseAddressClassification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\XAVResponseAddressClassification(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class => false]; - } - } -} else { - class XAVResponseAddressClassificationNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface - { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class; + if (\array_key_exists('Code', $data)) { + $object->setCode($data['Code']); + unset($data['Code']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class; + if (\array_key_exists('Description', $data)) { + $object->setDescription($data['Description']); + unset($data['Description']); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVResponseAddressClassification(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Code', $data)) { - $object->setCode($data['Code']); - unset($data['Code']); - } - if (\array_key_exists('Description', $data)) { - $object->setDescription($data['Description']); - unset($data['Description']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } - return $object; } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Code'] = $object->getCode(); - $data['Description'] = $object->getDescription(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } + return $object; + } + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $dataArray = []; + $dataArray['Code'] = $data->getCode(); + $dataArray['Description'] = $data->getDescription(); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/XAVResponseCandidateNormalizer.php b/src/Api/Normalizer/XAVResponseCandidateNormalizer.php index 97151755..1435de38 100644 --- a/src/Api/Normalizer/XAVResponseCandidateNormalizer.php +++ b/src/Api/Normalizer/XAVResponseCandidateNormalizer.php @@ -5,162 +5,80 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class XAVResponseCandidateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class XAVResponseCandidateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVResponseCandidate::class; + return $type === \ShipStream\Ups\Api\Model\XAVResponseCandidate::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponseCandidate::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponseCandidate::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVResponseCandidate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressClassification', $data) && $data['AddressClassification'] !== null) { - $object->setAddressClassification($this->denormalizer->denormalize($data['AddressClassification'], \ShipStream\Ups\Api\Model\CandidateAddressClassification::class, 'json', $context)); - unset($data['AddressClassification']); - } - elseif (\array_key_exists('AddressClassification', $data) && $data['AddressClassification'] === null) { - $object->setAddressClassification(null); - } - if (\array_key_exists('AddressKeyFormat', $data)) { - $values = []; - foreach ($data['AddressKeyFormat'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class, 'json', $context); - } - $object->setAddressKeyFormat($values); - unset($data['AddressKeyFormat']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\XAVResponseCandidate(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - if ($object->isInitialized('addressClassification') && null !== $object->getAddressClassification()) { - $data['AddressClassification'] = $this->normalizer->normalize($object->getAddressClassification(), 'json', $context); - } + if (\array_key_exists('AddressClassification', $data) && $data['AddressClassification'] !== null) { + $object->setAddressClassification($this->denormalizer->denormalize($data['AddressClassification'], \ShipStream\Ups\Api\Model\CandidateAddressClassification::class, 'json', $context)); + unset($data['AddressClassification']); + } + elseif (\array_key_exists('AddressClassification', $data) && $data['AddressClassification'] === null) { + $object->setAddressClassification(null); + } + if (\array_key_exists('AddressKeyFormat', $data)) { $values = []; - foreach ($object->getAddressKeyFormat() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + foreach ($data['AddressKeyFormat'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class, 'json', $context); } - $data['AddressKeyFormat'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; + $object->setAddressKeyFormat($values); + unset($data['AddressKeyFormat']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVResponseCandidate::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class XAVResponseCandidateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVResponseCandidate::class; + $dataArray = []; + if ($data->isInitialized('addressClassification')) { + $dataArray['AddressClassification'] = $this->normalizer->normalize($data->getAddressClassification(), 'json', $context); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponseCandidate::class; + $values = []; + foreach ($data->getAddressKeyFormat() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + $dataArray['AddressKeyFormat'] = $values; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVResponseCandidate(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('AddressClassification', $data) && $data['AddressClassification'] !== null) { - $object->setAddressClassification($this->denormalizer->denormalize($data['AddressClassification'], \ShipStream\Ups\Api\Model\CandidateAddressClassification::class, 'json', $context)); - unset($data['AddressClassification']); - } - elseif (\array_key_exists('AddressClassification', $data) && $data['AddressClassification'] === null) { - $object->setAddressClassification(null); - } - if (\array_key_exists('AddressKeyFormat', $data)) { - $values = []; - foreach ($data['AddressKeyFormat'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\CandidateAddressKeyFormat::class, 'json', $context); - } - $object->setAddressKeyFormat($values); - unset($data['AddressKeyFormat']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('addressClassification') && null !== $object->getAddressClassification()) { - $data['AddressClassification'] = $this->normalizer->normalize($object->getAddressClassification(), 'json', $context); - } - $values = []; - foreach ($object->getAddressKeyFormat() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['AddressKeyFormat'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVResponseCandidate::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\XAVResponseCandidate::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/XAVResponseNormalizer.php b/src/Api/Normalizer/XAVResponseNormalizer.php index 9bce7ab9..18b50605 100644 --- a/src/Api/Normalizer/XAVResponseNormalizer.php +++ b/src/Api/Normalizer/XAVResponseNormalizer.php @@ -5,242 +5,120 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class XAVResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class XAVResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponse::class; - } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\XAVResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('ValidAddressIndicator', $data) && $data['ValidAddressIndicator'] !== null) { - $object->setValidAddressIndicator($data['ValidAddressIndicator']); - unset($data['ValidAddressIndicator']); - } - elseif (\array_key_exists('ValidAddressIndicator', $data) && $data['ValidAddressIndicator'] === null) { - $object->setValidAddressIndicator(null); - } - if (\array_key_exists('AmbiguousAddressIndicator', $data) && $data['AmbiguousAddressIndicator'] !== null) { - $object->setAmbiguousAddressIndicator($data['AmbiguousAddressIndicator']); - unset($data['AmbiguousAddressIndicator']); - } - elseif (\array_key_exists('AmbiguousAddressIndicator', $data) && $data['AmbiguousAddressIndicator'] === null) { - $object->setAmbiguousAddressIndicator(null); - } - if (\array_key_exists('NoCandidatesIndicator', $data) && $data['NoCandidatesIndicator'] !== null) { - $object->setNoCandidatesIndicator($data['NoCandidatesIndicator']); - unset($data['NoCandidatesIndicator']); - } - elseif (\array_key_exists('NoCandidatesIndicator', $data) && $data['NoCandidatesIndicator'] === null) { - $object->setNoCandidatesIndicator(null); - } - if (\array_key_exists('AddressClassification', $data) && $data['AddressClassification'] !== null) { - $object->setAddressClassification($this->denormalizer->denormalize($data['AddressClassification'], \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class, 'json', $context)); - unset($data['AddressClassification']); - } - elseif (\array_key_exists('AddressClassification', $data) && $data['AddressClassification'] === null) { - $object->setAddressClassification(null); - } - if (\array_key_exists('Candidate', $data) && $data['Candidate'] !== null) { - $values = []; - foreach ($data['Candidate'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\XAVResponseCandidate::class, 'json', $context); - } - $object->setCandidate($values); - unset($data['Candidate']); - } - elseif (\array_key_exists('Candidate', $data) && $data['Candidate'] === null) { - $object->setCandidate(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + return $type === \ShipStream\Ups\Api\Model\XAVResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \ShipStream\Ups\Api\Model\XAVResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('validAddressIndicator') && null !== $object->getValidAddressIndicator()) { - $data['ValidAddressIndicator'] = $object->getValidAddressIndicator(); - } - if ($object->isInitialized('ambiguousAddressIndicator') && null !== $object->getAmbiguousAddressIndicator()) { - $data['AmbiguousAddressIndicator'] = $object->getAmbiguousAddressIndicator(); - } - if ($object->isInitialized('noCandidatesIndicator') && null !== $object->getNoCandidatesIndicator()) { - $data['NoCandidatesIndicator'] = $object->getNoCandidatesIndicator(); - } - if ($object->isInitialized('addressClassification') && null !== $object->getAddressClassification()) { - $data['AddressClassification'] = $this->normalizer->normalize($object->getAddressClassification(), 'json', $context); - } - if ($object->isInitialized('candidate') && null !== $object->getCandidate()) { - $values = []; - foreach ($object->getCandidate() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Candidate'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('Response', $data)) { + $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\XAVResponseResponse::class, 'json', $context)); + unset($data['Response']); + } + if (\array_key_exists('ValidAddressIndicator', $data) && $data['ValidAddressIndicator'] !== null) { + $object->setValidAddressIndicator($data['ValidAddressIndicator']); + unset($data['ValidAddressIndicator']); + } + elseif (\array_key_exists('ValidAddressIndicator', $data) && $data['ValidAddressIndicator'] === null) { + $object->setValidAddressIndicator(null); + } + if (\array_key_exists('AmbiguousAddressIndicator', $data) && $data['AmbiguousAddressIndicator'] !== null) { + $object->setAmbiguousAddressIndicator($data['AmbiguousAddressIndicator']); + unset($data['AmbiguousAddressIndicator']); + } + elseif (\array_key_exists('AmbiguousAddressIndicator', $data) && $data['AmbiguousAddressIndicator'] === null) { + $object->setAmbiguousAddressIndicator(null); + } + if (\array_key_exists('NoCandidatesIndicator', $data) && $data['NoCandidatesIndicator'] !== null) { + $object->setNoCandidatesIndicator($data['NoCandidatesIndicator']); + unset($data['NoCandidatesIndicator']); + } + elseif (\array_key_exists('NoCandidatesIndicator', $data) && $data['NoCandidatesIndicator'] === null) { + $object->setNoCandidatesIndicator(null); + } + if (\array_key_exists('AddressClassification', $data) && $data['AddressClassification'] !== null) { + $object->setAddressClassification($this->denormalizer->denormalize($data['AddressClassification'], \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class, 'json', $context)); + unset($data['AddressClassification']); + } + elseif (\array_key_exists('AddressClassification', $data) && $data['AddressClassification'] === null) { + $object->setAddressClassification(null); + } + if (\array_key_exists('Candidate', $data) && $data['Candidate'] !== null) { + $values = []; + foreach ($data['Candidate'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\XAVResponseCandidate::class, 'json', $context); } - return $data; + $object->setCandidate($values); + unset($data['Candidate']); + } + elseif (\array_key_exists('Candidate', $data) && $data['Candidate'] === null) { + $object->setCandidate(null); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class XAVResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVResponse::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponse::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('Response', $data)) { - $object->setResponse($this->denormalizer->denormalize($data['Response'], \ShipStream\Ups\Api\Model\XAVResponseResponse::class, 'json', $context)); - unset($data['Response']); - } - if (\array_key_exists('ValidAddressIndicator', $data) && $data['ValidAddressIndicator'] !== null) { - $object->setValidAddressIndicator($data['ValidAddressIndicator']); - unset($data['ValidAddressIndicator']); - } - elseif (\array_key_exists('ValidAddressIndicator', $data) && $data['ValidAddressIndicator'] === null) { - $object->setValidAddressIndicator(null); - } - if (\array_key_exists('AmbiguousAddressIndicator', $data) && $data['AmbiguousAddressIndicator'] !== null) { - $object->setAmbiguousAddressIndicator($data['AmbiguousAddressIndicator']); - unset($data['AmbiguousAddressIndicator']); - } - elseif (\array_key_exists('AmbiguousAddressIndicator', $data) && $data['AmbiguousAddressIndicator'] === null) { - $object->setAmbiguousAddressIndicator(null); - } - if (\array_key_exists('NoCandidatesIndicator', $data) && $data['NoCandidatesIndicator'] !== null) { - $object->setNoCandidatesIndicator($data['NoCandidatesIndicator']); - unset($data['NoCandidatesIndicator']); - } - elseif (\array_key_exists('NoCandidatesIndicator', $data) && $data['NoCandidatesIndicator'] === null) { - $object->setNoCandidatesIndicator(null); - } - if (\array_key_exists('AddressClassification', $data) && $data['AddressClassification'] !== null) { - $object->setAddressClassification($this->denormalizer->denormalize($data['AddressClassification'], \ShipStream\Ups\Api\Model\XAVResponseAddressClassification::class, 'json', $context)); - unset($data['AddressClassification']); - } - elseif (\array_key_exists('AddressClassification', $data) && $data['AddressClassification'] === null) { - $object->setAddressClassification(null); - } - if (\array_key_exists('Candidate', $data) && $data['Candidate'] !== null) { - $values = []; - foreach ($data['Candidate'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\XAVResponseCandidate::class, 'json', $context); - } - $object->setCandidate($values); - unset($data['Candidate']); - } - elseif (\array_key_exists('Candidate', $data) && $data['Candidate'] === null) { - $object->setCandidate(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; + $dataArray = []; + $dataArray['Response'] = $this->normalizer->normalize($data->getResponse(), 'json', $context); + if ($data->isInitialized('validAddressIndicator')) { + $dataArray['ValidAddressIndicator'] = $data->getValidAddressIndicator(); } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['Response'] = $this->normalizer->normalize($object->getResponse(), 'json', $context); - if ($object->isInitialized('validAddressIndicator') && null !== $object->getValidAddressIndicator()) { - $data['ValidAddressIndicator'] = $object->getValidAddressIndicator(); - } - if ($object->isInitialized('ambiguousAddressIndicator') && null !== $object->getAmbiguousAddressIndicator()) { - $data['AmbiguousAddressIndicator'] = $object->getAmbiguousAddressIndicator(); - } - if ($object->isInitialized('noCandidatesIndicator') && null !== $object->getNoCandidatesIndicator()) { - $data['NoCandidatesIndicator'] = $object->getNoCandidatesIndicator(); - } - if ($object->isInitialized('addressClassification') && null !== $object->getAddressClassification()) { - $data['AddressClassification'] = $this->normalizer->normalize($object->getAddressClassification(), 'json', $context); - } - if ($object->isInitialized('candidate') && null !== $object->getCandidate()) { - $values = []; - foreach ($object->getCandidate() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Candidate'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if ($data->isInitialized('ambiguousAddressIndicator')) { + $dataArray['AmbiguousAddressIndicator'] = $data->getAmbiguousAddressIndicator(); + } + if ($data->isInitialized('noCandidatesIndicator')) { + $dataArray['NoCandidatesIndicator'] = $data->getNoCandidatesIndicator(); + } + if ($data->isInitialized('addressClassification')) { + $dataArray['AddressClassification'] = $this->normalizer->normalize($data->getAddressClassification(), 'json', $context); + } + if ($data->isInitialized('candidate')) { + $values = []; + foreach ($data->getCandidate() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - return $data; + $dataArray['Candidate'] = $values; } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; + } } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\XAVResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/XAVResponseResponseNormalizer.php b/src/Api/Normalizer/XAVResponseResponseNormalizer.php index 94db7120..a0f3ceac 100644 --- a/src/Api/Normalizer/XAVResponseResponseNormalizer.php +++ b/src/Api/Normalizer/XAVResponseResponseNormalizer.php @@ -5,170 +5,84 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class XAVResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class XAVResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVResponseResponse::class; + return $type === \ShipStream\Ups\Api\Model\XAVResponseResponse::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponseResponse::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponseResponse::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); - } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } + $object = new \ShipStream\Ups\Api\Model\XAVResponseResponse(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } + if (\array_key_exists('ResponseStatus', $data)) { + $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); + unset($data['ResponseStatus']); + } + if (\array_key_exists('Alert', $data)) { + $values = []; + foreach ($data['Alert'] as $value) { + $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); } - return $data; + $object->setAlert($values); + unset($data['Alert']); + } + if (\array_key_exists('TransactionReference', $data)) { + $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); + unset($data['TransactionReference']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVResponseResponse::class => false]; + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + return $object; } -} else { - class XAVResponseResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVResponseResponse::class; + $dataArray = []; + $dataArray['ResponseStatus'] = $this->normalizer->normalize($data->getResponseStatus(), 'json', $context); + if ($data->isInitialized('alert') && null !== $data->getAlert()) { + $values = []; + foreach ($data->getAlert() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $dataArray['Alert'] = $values; } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponseResponse::class; + if ($data->isInitialized('transactionReference') && null !== $data->getTransactionReference()) { + $dataArray['TransactionReference'] = $this->normalizer->normalize($data->getTransactionReference(), 'json', $context); } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVResponseResponse(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('ResponseStatus', $data)) { - $object->setResponseStatus($this->denormalizer->denormalize($data['ResponseStatus'], \ShipStream\Ups\Api\Model\ResponseResponseStatus::class, 'json', $context)); - unset($data['ResponseStatus']); + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value_1; } - if (\array_key_exists('Alert', $data)) { - $values = []; - foreach ($data['Alert'] as $value) { - $values[] = $this->denormalizer->denormalize($value, \ShipStream\Ups\Api\Model\ResponseAlert::class, 'json', $context); - } - $object->setAlert($values); - unset($data['Alert']); - } - if (\array_key_exists('TransactionReference', $data)) { - $object->setTransactionReference($this->denormalizer->denormalize($data['TransactionReference'], \ShipStream\Ups\Api\Model\ResponseTransactionReference::class, 'json', $context)); - unset($data['TransactionReference']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['ResponseStatus'] = $this->normalizer->normalize($object->getResponseStatus(), 'json', $context); - if ($object->isInitialized('alert') && null !== $object->getAlert()) { - $values = []; - foreach ($object->getAlert() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['Alert'] = $values; - } - if ($object->isInitialized('transactionReference') && null !== $object->getTransactionReference()) { - $data['TransactionReference'] = $this->normalizer->normalize($object->getTransactionReference(), 'json', $context); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVResponseResponse::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\XAVResponseResponse::class => false]; } } \ No newline at end of file diff --git a/src/Api/Normalizer/XAVResponseWrapperNormalizer.php b/src/Api/Normalizer/XAVResponseWrapperNormalizer.php index 35b4c998..86952bfb 100644 --- a/src/Api/Normalizer/XAVResponseWrapperNormalizer.php +++ b/src/Api/Normalizer/XAVResponseWrapperNormalizer.php @@ -5,126 +5,62 @@ use Jane\Component\JsonSchemaRuntime\Reference; use ShipStream\Ups\Api\Runtime\Normalizer\CheckArray; use ShipStream\Ups\Api\Runtime\Normalizer\ValidatorTrait; -use Symfony\Component\Serializer\Exception\InvalidArgumentException; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -use Symfony\Component\HttpKernel\Kernel; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class XAVResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class XAVResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +{ + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use CheckArray; + use ValidatorTrait; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVResponseWrapper::class; + return $type === \ShipStream\Ups\Api\Model\XAVResponseWrapper::class; + } + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponseWrapper::class; + } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponseWrapper::class; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; - } - if (\array_key_exists('XAVResponse', $data)) { - $object->setXAVResponse($this->denormalizer->denormalize($data['XAVResponse'], \ShipStream\Ups\Api\Model\XAVResponse::class, 'json', $context)); - unset($data['XAVResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } + $object = new \ShipStream\Ups\Api\Model\XAVResponseWrapper(); + if (null === $data || false === \is_array($data)) { return $object; } - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $data = []; - $data['XAVResponse'] = $this->normalizer->normalize($object->getXAVResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; + if (\array_key_exists('XAVResponse', $data)) { + $object->setXAVResponse($this->denormalizer->denormalize($data['XAVResponse'], \ShipStream\Ups\Api\Model\XAVResponse::class, 'json', $context)); + unset($data['XAVResponse']); } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVResponseWrapper::class => false]; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + return $object; } -} else { - class XAVResponseWrapperNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use CheckArray; - use ValidatorTrait; - public function supportsDenormalization($data, $type, string $format = null, array $context = []): bool - { - return $type === \ShipStream\Ups\Api\Model\XAVResponseWrapper::class; - } - public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool - { - return is_object($data) && get_class($data) === \ShipStream\Ups\Api\Model\XAVResponseWrapper::class; - } - /** - * @return mixed - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \ShipStream\Ups\Api\Model\XAVResponseWrapper(); - if (null === $data || false === \is_array($data)) { - return $object; + $dataArray = []; + $dataArray['XAVResponse'] = $this->normalizer->normalize($data->getXAVResponse(), 'json', $context); + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $dataArray[$key] = $value; } - if (\array_key_exists('XAVResponse', $data)) { - $object->setXAVResponse($this->denormalizer->denormalize($data['XAVResponse'], \ShipStream\Ups\Api\Model\XAVResponse::class, 'json', $context)); - unset($data['XAVResponse']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; - } - } - return $object; - } - /** - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['XAVResponse'] = $this->normalizer->normalize($object->getXAVResponse(), 'json', $context); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; - } - } - return $data; - } - public function getSupportedTypes(?string $format = null): array - { - return [\ShipStream\Ups\Api\Model\XAVResponseWrapper::class => false]; } + return $dataArray; + } + public function getSupportedTypes(?string $format = null): array + { + return [\ShipStream\Ups\Api\Model\XAVResponseWrapper::class => false]; } } \ No newline at end of file diff --git a/src/Api/Runtime/Client/BaseEndpoint.php b/src/Api/Runtime/Client/BaseEndpoint.php index a5457b13..d4f7b509 100644 --- a/src/Api/Runtime/Client/BaseEndpoint.php +++ b/src/Api/Runtime/Client/BaseEndpoint.php @@ -8,10 +8,10 @@ use Symfony\Component\Serializer\SerializerInterface; abstract class BaseEndpoint implements Endpoint { - protected $formParameters = []; - protected $queryParameters = []; - protected $headerParameters = []; - protected $body; + protected array $formParameters = []; + protected array $queryParameters = []; + protected array $headerParameters = []; + protected mixed $body; abstract public function getMethod(): string; abstract public function getBody(SerializerInterface $serializer, $streamFactory = null): array; abstract public function getUri(): string; @@ -24,10 +24,19 @@ protected function getExtraHeaders(): array public function getQueryString(): string { $optionsResolved = $this->getQueryOptionsResolver()->resolve($this->queryParameters); - $optionsResolved = array_map(function ($value) { - return null !== $value ? $value : ''; + $optionsResolved = array_map(static function ($value) { + return $value ?? ''; }, $optionsResolved); - return http_build_query($optionsResolved, '', '&', PHP_QUERY_RFC3986); + $allowReserved = $this->getQueryAllowReserved(); + $queryParameters = []; + foreach ($optionsResolved as $key => $value) { + if (in_array($key, $allowReserved, true)) { + $queryParameters[] = rawurlencode($key) . '=' . $value; + } else { + $queryParameters[] = rawurlencode($key) . '=' . rawurlencode($value); + } + } + return implode('&', $queryParameters); } public function getHeaders(array $baseHeaders = []): array { @@ -37,6 +46,10 @@ protected function getQueryOptionsResolver(): OptionsResolver { return new OptionsResolver(); } + protected function getQueryAllowReserved(): array + { + return []; + } protected function getHeadersOptionsResolver(): OptionsResolver { return new OptionsResolver(); diff --git a/src/Api/Runtime/Client/Client.php b/src/Api/Runtime/Client/Client.php index 3bb28527..d7c6c8ef 100644 --- a/src/Api/Runtime/Client/Client.php +++ b/src/Api/Runtime/Client/Client.php @@ -13,22 +13,10 @@ abstract class Client { public const FETCH_RESPONSE = 'response'; public const FETCH_OBJECT = 'object'; - /** - * @var ClientInterface - */ - protected $httpClient; - /** - * @var RequestFactoryInterface - */ - protected $requestFactory; - /** - * @var SerializerInterface - */ - protected $serializer; - /** - * @var StreamFactoryInterface - */ - protected $streamFactory; + protected ClientInterface $httpClient; + protected RequestFactoryInterface $requestFactory; + protected SerializerInterface $serializer; + protected StreamFactoryInterface $streamFactory; public function __construct(ClientInterface $httpClient, RequestFactoryInterface $requestFactory, SerializerInterface $serializer, StreamFactoryInterface $streamFactory) { $this->httpClient = $httpClient; @@ -52,7 +40,7 @@ private function processEndpoint(Endpoint $endpoint): ResponseInterface { [$bodyHeaders, $body] = $endpoint->getBody($this->serializer, $this->streamFactory); $queryString = $endpoint->getQueryString(); - $uriGlue = false === strpos($endpoint->getUri(), '?') ? '?' : '&'; + $uriGlue = !str_contains($endpoint->getUri(), '?') ? '?' : '&'; $uri = $queryString !== '' ? $endpoint->getUri() . $uriGlue . $queryString : $endpoint->getUri(); $request = $this->requestFactory->createRequest($endpoint->getMethod(), $uri); if ($body) { diff --git a/src/Api/Runtime/Normalizer/ReferenceNormalizer.php b/src/Api/Runtime/Normalizer/ReferenceNormalizer.php index 7658d352..fb9194b6 100644 --- a/src/Api/Runtime/Normalizer/ReferenceNormalizer.php +++ b/src/Api/Runtime/Normalizer/ReferenceNormalizer.php @@ -3,46 +3,21 @@ namespace ShipStream\Ups\Api\Runtime\Normalizer; use Jane\Component\JsonSchemaRuntime\Reference; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -if (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4) { - class ReferenceNormalizer implements NormalizerInterface +class ReferenceNormalizer implements NormalizerInterface +{ + public function normalize(mixed $data, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null { - /** - * {@inheritdoc} - */ - public function normalize(mixed $object, string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null - { - $ref = []; - $ref['$ref'] = (string) $object->getReferenceUri(); - return $ref; - } - /** - * {@inheritdoc} - */ - public function supportsNormalization($data, $format = null): bool - { - return $data instanceof Reference; - } + $ref = []; + $ref['$ref'] = (string) $data->getReferenceUri(); + return $ref; } -} else { - class ReferenceNormalizer implements NormalizerInterface + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { - /** - * {@inheritdoc} - */ - public function normalize($object, $format = null, array $context = []) - { - $ref = []; - $ref['$ref'] = (string) $object->getReferenceUri(); - return $ref; - } - /** - * {@inheritdoc} - */ - public function supportsNormalization($data, $format = null): bool - { - return $data instanceof Reference; - } + return $data instanceof Reference; + } + public function getSupportedTypes(?string $format): array + { + return [Reference::class => false]; } } \ No newline at end of file diff --git a/src/Api/Runtime/Normalizer/ValidationException.php b/src/Api/Runtime/Normalizer/ValidationException.php index 90ec52fa..3f9889b4 100644 --- a/src/Api/Runtime/Normalizer/ValidationException.php +++ b/src/Api/Runtime/Normalizer/ValidationException.php @@ -6,11 +6,8 @@ use Symfony\Component\Validator\ConstraintViolationListInterface; class ValidationException extends RuntimeException { - /** @var ConstraintViolationListInterface */ - private $violationList; - public function __construct(ConstraintViolationListInterface $violationList) + public function __construct(private readonly ConstraintViolationListInterface $violationList) { - $this->violationList = $violationList; parent::__construct(sprintf('Model validation failed with %d errors.', $violationList->count()), 400); } public function getViolationList(): ConstraintViolationListInterface From aef217b8d271a6e9b12d6ab3306f49a89f03149c Mon Sep 17 00:00:00 2001 From: Mohamed ELIDRISSI <67818913+elidrissidev@users.noreply.github.com> Date: Tue, 30 Dec 2025 14:54:41 +0100 Subject: [PATCH 3/4] Update custom normalizers --- .../CandidateAddressKeyFormatNormalizer.php | 49 +++----- .../XAVResponseCandidateNormalizer.php | 50 ++------ .../XAVResponseNormalizer.php | 47 ++------ ...eptanceAuditPreCheckResponseNormalizer.php | 46 ++------ ...eCheckResponsePackageResultsNormalizer.php | 46 ++------ ...uditPreCheckResponseResponseNormalizer.php | 55 +++------ ...enceDataResponseChemicalDataNormalizer.php | 46 ++------ ...hemicalReferenceDataResponseNormalizer.php | 46 ++------ ...eferenceDataResponseResponseNormalizer.php | 46 ++------ .../LandedCostResponseShipmentNormalizer.php | 46 ++------ ...onBusinessClassificationListNormalizer.php | 46 ++------ ...nformationPrivateNetworkListNormalizer.php | 46 ++------ ...opLocationAdditionalCommentsNormalizer.php | 46 ++------ ...ropLocationLocationAttributeNormalizer.php | 46 ++------ .../DropLocationOperatingHoursNormalizer.php | 46 ++------ ...pLocationServiceOfferingListNormalizer.php | 46 ++------ ...LocatorResponseSearchResultsNormalizer.php | 64 +++------- .../OperatingHoursStandardHoursNormalizer.php | 46 ++------ ...TransportationPickUpScheduleNormalizer.php | 46 ++------ .../SearchResultsDropLocationNormalizer.php | 109 ++++++------------ .../StandardHoursDayOfWeekNormalizer.php | 55 +++------ .../DeleteResponseResponseNormalizer.php | 46 ++------ ...geRepositoryResponseResponseNormalizer.php | 46 ++------ ...sponseFormsHistoryDocumentIDNormalizer.php | 47 +++----- .../UploadResponseResponseNormalizer.php | 46 ++------ .../DropOffFacilitiesAddressNormalizer.php | 46 ++------ ...liticalDivision1ListResponseNormalizer.php | 46 ++------ ...esponseServiceCenterLocationNormalizer.php | 46 ++------ .../PickupPendingStatusResponseNormalizer.php | 46 ++------ ...PickupRateResponseRateResultNormalizer.php | 55 +++------ .../PickupRateResponseResponseNormalizer.php | 46 ++------ ...terLocationDropOffFacilitiesNormalizer.php | 46 ++------ ...NotificationResponseResponseNormalizer.php | 46 ++------ ...ocationAddressArtifactFormatNormalizer.php | 46 ++------ .../ExceptionUpdatedAddressNormalizer.php | 22 ---- .../QuantumView/ManifestPackageNormalizer.php | 46 ++------ ...ViewEventsSubscriptionEventsNormalizer.php | 46 ++------ ...iewResponseQuantumViewEventsNormalizer.php | 46 ++------ .../QuantumViewResponseResponseNormalizer.php | 46 ++------ ...iptionEventsSubscriptionFileNormalizer.php | 82 ++++--------- .../SubscriptionFileDeliveryNormalizer.php | 55 +++------ .../SubscriptionFileExceptionNormalizer.php | 55 +++------ .../SubscriptionFileGenericNormalizer.php | 55 +++------ .../SubscriptionFileManifestNormalizer.php | 55 +++------ .../SubscriptionFileOriginNormalizer.php | 55 +++------ ...etailElementLevelInformationNormalizer.php | 46 ++------ .../Rating/RateResponseNormalizer.php | 46 ++------ .../RateResponseRatedShipmentNormalizer.php | 91 +++++---------- .../Rating/RateResponseResponseNormalizer.php | 55 +++------ ...atedPackageNegotiatedChargesNormalizer.php | 46 ++------ ...hipmentNegotiatedRateChargesNormalizer.php | 55 +++------ .../RatedShipmentRatedPackageNormalizer.php | 64 +++------- src/Normalizer/ResponseErrorNormalizer.php | 53 +++------ .../LabelRecoveryResponseNormalizer.php | 46 ++------ .../ShipmentResponseResponseNormalizer.php | 51 +++----- ...pmentResponseShipmentResultsNormalizer.php | 49 +++----- .../FreightRateResponseNormalizer.php | 64 +++------- .../FreightRateResponseResponseNormalizer.php | 46 ++------ ...tShipResponseShipmentResultsNormalizer.php | 46 ++------ .../ShipmentResultsDocumentsNormalizer.php | 55 +++------ 60 files changed, 814 insertions(+), 2243 deletions(-) diff --git a/src/Normalizer/AddressValidation/CandidateAddressKeyFormatNormalizer.php b/src/Normalizer/AddressValidation/CandidateAddressKeyFormatNormalizer.php index 7f74bc33..07513254 100644 --- a/src/Normalizer/AddressValidation/CandidateAddressKeyFormatNormalizer.php +++ b/src/Normalizer/AddressValidation/CandidateAddressKeyFormatNormalizer.php @@ -3,47 +3,24 @@ namespace ShipStream\Ups\Normalizer\AddressValidation; use ShipStream\Ups\Api\Normalizer\CandidateAddressKeyFormatNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class CandidateAddressKeyFormatNormalizer extends BaseNormalizer +class CandidateAddressKeyFormatNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force AddressLine to always be an array even when the API returns a single value - // @see https://github.com/UPS-API/api-documentation/issues/3 - if (isset($data['AddressLine']) && ! is_array($data['AddressLine'])) { - $data['AddressLine'] = [$data['AddressLine']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class CandidateAddressKeyFormatNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force AddressLine to always be an array even when the API returns a single value - // @see https://github.com/UPS-API/api-documentation/issues/3 - if (isset($data['AddressLine']) && ! is_array($data['AddressLine'])) { - $data['AddressLine'] = [$data['AddressLine']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force AddressLine to always be an array even when the API returns a single value + // @see https://github.com/UPS-API/api-documentation/issues/3 + if (isset($data['AddressLine']) && ! is_array($data['AddressLine'])) { + $data['AddressLine'] = [$data['AddressLine']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/AddressValidation/XAVResponseCandidateNormalizer.php b/src/Normalizer/AddressValidation/XAVResponseCandidateNormalizer.php index 992d9e2f..6231bcb1 100644 --- a/src/Normalizer/AddressValidation/XAVResponseCandidateNormalizer.php +++ b/src/Normalizer/AddressValidation/XAVResponseCandidateNormalizer.php @@ -3,51 +3,25 @@ namespace ShipStream\Ups\Normalizer\AddressValidation; use ShipStream\Ups\Api\Normalizer\XAVResponseCandidateNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -/** - * Custom deserializer for "Candidate" object. - */ -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class XAVResponseCandidateNormalizer extends BaseNormalizer +class XAVResponseCandidateNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force AddressKeyFormat to always be an array even when the API returns a single value - // @see https://github.com/UPS-API/api-documentation/issues/3 - if (isset($data['AddressKeyFormat']) && !array_is_list($data['AddressKeyFormat'])) { - $data['AddressKeyFormat'] = [$data['AddressKeyFormat']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class XAVResponseCandidateNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force AddressKeyFormat to always be an array even when the API returns a single value - // @see https://github.com/UPS-API/api-documentation/issues/3 - if (isset($data['AddressKeyFormat']) && !array_is_list($data['AddressKeyFormat'])) { - $data['AddressKeyFormat'] = [$data['AddressKeyFormat']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force AddressKeyFormat to always be an array even when the API returns a single value + // @see https://github.com/UPS-API/api-documentation/issues/3 + if (isset($data['AddressKeyFormat']) && !array_is_list($data['AddressKeyFormat'])) { + $data['AddressKeyFormat'] = [$data['AddressKeyFormat']]; } + return parent::denormalize($data, $type, $format, $context); } } diff --git a/src/Normalizer/AddressValidation/XAVResponseNormalizer.php b/src/Normalizer/AddressValidation/XAVResponseNormalizer.php index 05f4e814..0db8cf80 100644 --- a/src/Normalizer/AddressValidation/XAVResponseNormalizer.php +++ b/src/Normalizer/AddressValidation/XAVResponseNormalizer.php @@ -3,47 +3,24 @@ namespace ShipStream\Ups\Normalizer\AddressValidation; use ShipStream\Ups\Api\Normalizer\XAVResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class XAVResponseNormalizer extends BaseNormalizer +class XAVResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Candidate to always be an array even when the API returns a single value - // @see https://github.com/UPS-API/api-documentation/issues/3 - if (isset($data['Candidate']) && !is_array($data['Candidate'])) { - $data['Candidate'] = [$data['Candidate']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class XAVResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Candidate to always be an array even when the API returns a single value - // @see https://github.com/UPS-API/api-documentation/issues/3 - if (isset($data['Candidate']) && !is_array($data['Candidate'])) { - $data['Candidate'] = [$data['Candidate']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Candidate to always be an array even when the API returns a single value + // @see https://github.com/UPS-API/api-documentation/issues/3 + if (isset($data['Candidate']) && !is_array($data['Candidate'])) { + $data['Candidate'] = [$data['Candidate']]; } + return parent::denormalize($data, $type, $format, $context); } } diff --git a/src/Normalizer/DangerousGoods/AcceptanceAuditPreCheckResponseNormalizer.php b/src/Normalizer/DangerousGoods/AcceptanceAuditPreCheckResponseNormalizer.php index d9ef8603..ab0e3123 100644 --- a/src/Normalizer/DangerousGoods/AcceptanceAuditPreCheckResponseNormalizer.php +++ b/src/Normalizer/DangerousGoods/AcceptanceAuditPreCheckResponseNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\DangerousGoods; use ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AcceptanceAuditPreCheckResponseNormalizer extends BaseNormalizer +class AcceptanceAuditPreCheckResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force PackageResults to always be an array even when the API returns a single value - if (isset($data['PackageResults']) && !array_is_list($data['PackageResults'])) { - $data['PackageResults'] = [$data['PackageResults']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class AcceptanceAuditPreCheckResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force PackageResults to always be an array even when the API returns a single value - if (isset($data['PackageResults']) && !array_is_list($data['PackageResults'])) { - $data['PackageResults'] = [$data['PackageResults']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force PackageResults to always be an array even when the API returns a single value + if (isset($data['PackageResults']) && !array_is_list($data['PackageResults'])) { + $data['PackageResults'] = [$data['PackageResults']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/DangerousGoods/AcceptanceAuditPreCheckResponsePackageResultsNormalizer.php b/src/Normalizer/DangerousGoods/AcceptanceAuditPreCheckResponsePackageResultsNormalizer.php index d53564fa..e5d93475 100644 --- a/src/Normalizer/DangerousGoods/AcceptanceAuditPreCheckResponsePackageResultsNormalizer.php +++ b/src/Normalizer/DangerousGoods/AcceptanceAuditPreCheckResponsePackageResultsNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\DangerousGoods; use ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponsePackageResultsNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AcceptanceAuditPreCheckResponsePackageResultsNormalizer extends BaseNormalizer +class AcceptanceAuditPreCheckResponsePackageResultsNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force ChemicalRecordResults to always be an array even when the API returns a single value - if (isset($data['ChemicalRecordResults']) && !array_is_list($data['ChemicalRecordResults'])) { - $data['ChemicalRecordResults'] = [$data['ChemicalRecordResults']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class AcceptanceAuditPreCheckResponsePackageResultsNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force ChemicalRecordResults to always be an array even when the API returns a single value - if (isset($data['ChemicalRecordResults']) && !array_is_list($data['ChemicalRecordResults'])) { - $data['ChemicalRecordResults'] = [$data['ChemicalRecordResults']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force ChemicalRecordResults to always be an array even when the API returns a single value + if (isset($data['ChemicalRecordResults']) && !array_is_list($data['ChemicalRecordResults'])) { + $data['ChemicalRecordResults'] = [$data['ChemicalRecordResults']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/DangerousGoods/AcceptanceAuditPreCheckResponseResponseNormalizer.php b/src/Normalizer/DangerousGoods/AcceptanceAuditPreCheckResponseResponseNormalizer.php index 1043b6b3..98e671af 100644 --- a/src/Normalizer/DangerousGoods/AcceptanceAuditPreCheckResponseResponseNormalizer.php +++ b/src/Normalizer/DangerousGoods/AcceptanceAuditPreCheckResponseResponseNormalizer.php @@ -3,52 +3,27 @@ namespace ShipStream\Ups\Normalizer\DangerousGoods; use ShipStream\Ups\Api\Normalizer\AcceptanceAuditPreCheckResponseResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AcceptanceAuditPreCheckResponseResponseNormalizer extends BaseNormalizer +class AcceptanceAuditPreCheckResponseResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Alert & AlertDetail to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } - if (isset($data['AlertDetail']) && !array_is_list($data['AlertDetail'])) { - $data['AlertDetail'] = [$data['AlertDetail']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class AcceptanceAuditPreCheckResponseResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Alert & AlertDetail to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } - if (isset($data['AlertDetail']) && !array_is_list($data['AlertDetail'])) { - $data['AlertDetail'] = [$data['AlertDetail']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Alert & AlertDetail to always be an array even when the API returns a single value + if (isset($data['Alert']) && !array_is_list($data['Alert'])) { + $data['Alert'] = [$data['Alert']]; + } + if (isset($data['AlertDetail']) && !array_is_list($data['AlertDetail'])) { + $data['AlertDetail'] = [$data['AlertDetail']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/DangerousGoods/ChemicalReferenceDataResponseChemicalDataNormalizer.php b/src/Normalizer/DangerousGoods/ChemicalReferenceDataResponseChemicalDataNormalizer.php index 87c95819..e68c119e 100644 --- a/src/Normalizer/DangerousGoods/ChemicalReferenceDataResponseChemicalDataNormalizer.php +++ b/src/Normalizer/DangerousGoods/ChemicalReferenceDataResponseChemicalDataNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\DangerousGoods; use ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataResponseChemicalDataNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ChemicalReferenceDataResponseChemicalDataNormalizer extends BaseNormalizer +class ChemicalReferenceDataResponseChemicalDataNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force PackageQuantityLimitDetail to always be an array even when the API returns a single value - if (isset($data['PackageQuantityLimitDetail']) && !array_is_list($data['PackageQuantityLimitDetail'])) { - $data['PackageQuantityLimitDetail'] = [$data['PackageQuantityLimitDetail']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class ChemicalReferenceDataResponseChemicalDataNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force PackageQuantityLimitDetail to always be an array even when the API returns a single value - if (isset($data['PackageQuantityLimitDetail']) && !array_is_list($data['PackageQuantityLimitDetail'])) { - $data['PackageQuantityLimitDetail'] = [$data['PackageQuantityLimitDetail']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force PackageQuantityLimitDetail to always be an array even when the API returns a single value + if (isset($data['PackageQuantityLimitDetail']) && !array_is_list($data['PackageQuantityLimitDetail'])) { + $data['PackageQuantityLimitDetail'] = [$data['PackageQuantityLimitDetail']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/DangerousGoods/ChemicalReferenceDataResponseNormalizer.php b/src/Normalizer/DangerousGoods/ChemicalReferenceDataResponseNormalizer.php index 14a34235..243d8779 100644 --- a/src/Normalizer/DangerousGoods/ChemicalReferenceDataResponseNormalizer.php +++ b/src/Normalizer/DangerousGoods/ChemicalReferenceDataResponseNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\DangerousGoods; use ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ChemicalReferenceDataResponseNormalizer extends BaseNormalizer +class ChemicalReferenceDataResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force ChemicalData to always be an array even when the API returns a single value - if (isset($data['ChemicalData']) && !array_is_list($data['ChemicalData'])) { - $data['ChemicalData'] = [$data['ChemicalData']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class ChemicalReferenceDataResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force ChemicalData to always be an array even when the API returns a single value - if (isset($data['ChemicalData']) && !array_is_list($data['ChemicalData'])) { - $data['ChemicalData'] = [$data['ChemicalData']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force ChemicalData to always be an array even when the API returns a single value + if (isset($data['ChemicalData']) && !array_is_list($data['ChemicalData'])) { + $data['ChemicalData'] = [$data['ChemicalData']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/DangerousGoods/ChemicalReferenceDataResponseResponseNormalizer.php b/src/Normalizer/DangerousGoods/ChemicalReferenceDataResponseResponseNormalizer.php index 6437171c..a9957b43 100644 --- a/src/Normalizer/DangerousGoods/ChemicalReferenceDataResponseResponseNormalizer.php +++ b/src/Normalizer/DangerousGoods/ChemicalReferenceDataResponseResponseNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\DangerousGoods; use ShipStream\Ups\Api\Normalizer\ChemicalReferenceDataResponseResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ChemicalReferenceDataResponseResponseNormalizer extends BaseNormalizer +class ChemicalReferenceDataResponseResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class ChemicalReferenceDataResponseResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Alert to always be an array even when the API returns a single value + if (isset($data['Alert']) && !array_is_list($data['Alert'])) { + $data['Alert'] = [$data['Alert']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/LandedCost/LandedCostResponseShipmentNormalizer.php b/src/Normalizer/LandedCost/LandedCostResponseShipmentNormalizer.php index d6fc508f..96963567 100644 --- a/src/Normalizer/LandedCost/LandedCostResponseShipmentNormalizer.php +++ b/src/Normalizer/LandedCost/LandedCostResponseShipmentNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\LandedCost; use ShipStream\Ups\Api\Normalizer\LandedCostResponseShipmentNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LandedCostResponseShipmentNormalizer extends BaseNormalizer +class LandedCostResponseShipmentNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force shipmentItems to always be an array even when the API returns a single value - if (isset($data['shipmentItems']) && !array_is_list($data['shipmentItems'])) { - $data['shipmentItems'] = [$data['shipmentItems']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class LandedCostResponseShipmentNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force shipmentItems to always be an array even when the API returns a single value - if (isset($data['shipmentItems']) && !array_is_list($data['shipmentItems'])) { - $data['shipmentItems'] = [$data['shipmentItems']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force shipmentItems to always be an array even when the API returns a single value + if (isset($data['shipmentItems']) && !array_is_list($data['shipmentItems'])) { + $data['shipmentItems'] = [$data['shipmentItems']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Locator/AccessPointInformationBusinessClassificationListNormalizer.php b/src/Normalizer/Locator/AccessPointInformationBusinessClassificationListNormalizer.php index 6bbb84fd..3a96fab5 100644 --- a/src/Normalizer/Locator/AccessPointInformationBusinessClassificationListNormalizer.php +++ b/src/Normalizer/Locator/AccessPointInformationBusinessClassificationListNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Locator; use ShipStream\Ups\Api\Normalizer\AccessPointInformationBusinessClassificationListNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AccessPointInformationBusinessClassificationListNormalizer extends BaseNormalizer +class AccessPointInformationBusinessClassificationListNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force BusinessClassification to always be an array even when the API returns a single value - if (isset($data['BusinessClassification']) && !array_is_list($data['BusinessClassification'])) { - $data['BusinessClassification'] = [$data['BusinessClassification']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class AccessPointInformationBusinessClassificationListNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force BusinessClassification to always be an array even when the API returns a single value - if (isset($data['BusinessClassification']) && !array_is_list($data['BusinessClassification'])) { - $data['BusinessClassification'] = [$data['BusinessClassification']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force BusinessClassification to always be an array even when the API returns a single value + if (isset($data['BusinessClassification']) && !array_is_list($data['BusinessClassification'])) { + $data['BusinessClassification'] = [$data['BusinessClassification']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Locator/AccessPointInformationPrivateNetworkListNormalizer.php b/src/Normalizer/Locator/AccessPointInformationPrivateNetworkListNormalizer.php index d9c9ec30..48ab6485 100644 --- a/src/Normalizer/Locator/AccessPointInformationPrivateNetworkListNormalizer.php +++ b/src/Normalizer/Locator/AccessPointInformationPrivateNetworkListNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Locator; use ShipStream\Ups\Api\Normalizer\AccessPointInformationPrivateNetworkListNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AccessPointInformationPrivateNetworkListNormalizer extends BaseNormalizer +class AccessPointInformationPrivateNetworkListNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force PrivateNetwork to always be an array even when the API returns a single value - if (isset($data['PrivateNetwork']) && !array_is_list($data['PrivateNetwork'])) { - $data['PrivateNetwork'] = [$data['PrivateNetwork']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class AccessPointInformationPrivateNetworkListNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force PrivateNetwork to always be an array even when the API returns a single value - if (isset($data['PrivateNetwork']) && !array_is_list($data['PrivateNetwork'])) { - $data['PrivateNetwork'] = [$data['PrivateNetwork']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force PrivateNetwork to always be an array even when the API returns a single value + if (isset($data['PrivateNetwork']) && !array_is_list($data['PrivateNetwork'])) { + $data['PrivateNetwork'] = [$data['PrivateNetwork']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Locator/DropLocationAdditionalCommentsNormalizer.php b/src/Normalizer/Locator/DropLocationAdditionalCommentsNormalizer.php index 0d90b9fd..2b316c6c 100644 --- a/src/Normalizer/Locator/DropLocationAdditionalCommentsNormalizer.php +++ b/src/Normalizer/Locator/DropLocationAdditionalCommentsNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Locator; use ShipStream\Ups\Api\Normalizer\DropLocationAdditionalCommentsNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationAdditionalCommentsNormalizer extends BaseNormalizer +class DropLocationAdditionalCommentsNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force CommentType to always be an array even when the API returns a single value - if (isset($data['CommentType']) && !array_is_list($data['CommentType'])) { - $data['CommentType'] = [$data['CommentType']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class DropLocationAdditionalCommentsNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force CommentType to always be an array even when the API returns a single value - if (isset($data['CommentType']) && !array_is_list($data['CommentType'])) { - $data['CommentType'] = [$data['CommentType']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force CommentType to always be an array even when the API returns a single value + if (isset($data['CommentType']) && !array_is_list($data['CommentType'])) { + $data['CommentType'] = [$data['CommentType']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Locator/DropLocationLocationAttributeNormalizer.php b/src/Normalizer/Locator/DropLocationLocationAttributeNormalizer.php index 0d26d795..856f9cc7 100644 --- a/src/Normalizer/Locator/DropLocationLocationAttributeNormalizer.php +++ b/src/Normalizer/Locator/DropLocationLocationAttributeNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Locator; use ShipStream\Ups\Api\Normalizer\DropLocationLocationAttributeNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationLocationAttributeNormalizer extends BaseNormalizer +class DropLocationLocationAttributeNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force OptionCode to always be an array even when the API returns a single value - if (isset($data['OptionCode']) && !array_is_list($data['OptionCode'])) { - $data['OptionCode'] = [$data['OptionCode']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class DropLocationLocationAttributeNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force OptionCode to always be an array even when the API returns a single value - if (isset($data['OptionCode']) && !array_is_list($data['OptionCode'])) { - $data['OptionCode'] = [$data['OptionCode']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force OptionCode to always be an array even when the API returns a single value + if (isset($data['OptionCode']) && !array_is_list($data['OptionCode'])) { + $data['OptionCode'] = [$data['OptionCode']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Locator/DropLocationOperatingHoursNormalizer.php b/src/Normalizer/Locator/DropLocationOperatingHoursNormalizer.php index 8523d3c5..f31d7ad1 100644 --- a/src/Normalizer/Locator/DropLocationOperatingHoursNormalizer.php +++ b/src/Normalizer/Locator/DropLocationOperatingHoursNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Locator; use ShipStream\Ups\Api\Normalizer\DropLocationOperatingHoursNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationOperatingHoursNormalizer extends BaseNormalizer +class DropLocationOperatingHoursNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force StandardHours to always be an array even when the API returns a single value - if (isset($data['StandardHours']) && !array_is_list($data['StandardHours'])) { - $data['StandardHours'] = [$data['StandardHours']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class DropLocationOperatingHoursNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force StandardHours to always be an array even when the API returns a single value - if (isset($data['StandardHours']) && !array_is_list($data['StandardHours'])) { - $data['StandardHours'] = [$data['StandardHours']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force StandardHours to always be an array even when the API returns a single value + if (isset($data['StandardHours']) && !array_is_list($data['StandardHours'])) { + $data['StandardHours'] = [$data['StandardHours']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Locator/DropLocationServiceOfferingListNormalizer.php b/src/Normalizer/Locator/DropLocationServiceOfferingListNormalizer.php index 293a3894..247450c9 100644 --- a/src/Normalizer/Locator/DropLocationServiceOfferingListNormalizer.php +++ b/src/Normalizer/Locator/DropLocationServiceOfferingListNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Locator; use ShipStream\Ups\Api\Normalizer\DropLocationServiceOfferingListNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropLocationServiceOfferingListNormalizer extends BaseNormalizer +class DropLocationServiceOfferingListNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force ServiceOffering to always be an array even when the API returns a single value - if (isset($data['ServiceOffering']) && !array_is_list($data['ServiceOffering'])) { - $data['ServiceOffering'] = [$data['ServiceOffering']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class DropLocationServiceOfferingListNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force ServiceOffering to always be an array even when the API returns a single value - if (isset($data['ServiceOffering']) && !array_is_list($data['ServiceOffering'])) { - $data['ServiceOffering'] = [$data['ServiceOffering']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force ServiceOffering to always be an array even when the API returns a single value + if (isset($data['ServiceOffering']) && !array_is_list($data['ServiceOffering'])) { + $data['ServiceOffering'] = [$data['ServiceOffering']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Locator/LocatorResponseSearchResultsNormalizer.php b/src/Normalizer/Locator/LocatorResponseSearchResultsNormalizer.php index b68519cd..443ffd50 100644 --- a/src/Normalizer/Locator/LocatorResponseSearchResultsNormalizer.php +++ b/src/Normalizer/Locator/LocatorResponseSearchResultsNormalizer.php @@ -3,58 +3,30 @@ namespace ShipStream\Ups\Normalizer\Locator; use ShipStream\Ups\Api\Normalizer\LocatorResponseSearchResultsNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LocatorResponseSearchResultsNormalizer extends BaseNormalizer +class LocatorResponseSearchResultsNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force attributes to always be an array even when the API returns a single value - if (isset($data['GeocodeCandidate']) && !array_is_list($data['GeocodeCandidate'])) { - $data['GeocodeCandidate'] = [$data['GeocodeCandidate']]; - } - if (isset($data['Disclaimer']) && !array_is_list($data['Disclaimer'])) { - $data['Disclaimer'] = [$data['Disclaimer']]; - } - if (isset($data['AvailableLocationAttributes']) && !array_is_list($data['AvailableLocationAttributes'])) { - $data['AvailableLocationAttributes'] = [$data['AvailableLocationAttributes']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class LocatorResponseSearchResultsNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force attributes to always be an array even when the API returns a single value - if (isset($data['GeocodeCandidate']) && !array_is_list($data['GeocodeCandidate'])) { - $data['GeocodeCandidate'] = [$data['GeocodeCandidate']]; - } - if (isset($data['Disclaimer']) && !array_is_list($data['Disclaimer'])) { - $data['Disclaimer'] = [$data['Disclaimer']]; - } - if (isset($data['AvailableLocationAttributes']) && !array_is_list($data['AvailableLocationAttributes'])) { - $data['AvailableLocationAttributes'] = [$data['AvailableLocationAttributes']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force attributes to always be an array even when the API returns a single value + if (isset($data['GeocodeCandidate']) && !array_is_list($data['GeocodeCandidate'])) { + $data['GeocodeCandidate'] = [$data['GeocodeCandidate']]; + } + if (isset($data['Disclaimer']) && !array_is_list($data['Disclaimer'])) { + $data['Disclaimer'] = [$data['Disclaimer']]; + } + if (isset($data['AvailableLocationAttributes']) && !array_is_list($data['AvailableLocationAttributes'])) { + $data['AvailableLocationAttributes'] = [$data['AvailableLocationAttributes']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Locator/OperatingHoursStandardHoursNormalizer.php b/src/Normalizer/Locator/OperatingHoursStandardHoursNormalizer.php index 4ba908e2..e05e5470 100644 --- a/src/Normalizer/Locator/OperatingHoursStandardHoursNormalizer.php +++ b/src/Normalizer/Locator/OperatingHoursStandardHoursNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Locator; use ShipStream\Ups\Api\Normalizer\OperatingHoursStandardHoursNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class OperatingHoursStandardHoursNormalizer extends BaseNormalizer +class OperatingHoursStandardHoursNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force DayOfWeek to always be an array even when the API returns a single value - if (isset($data['DayOfWeek']) && !array_is_list($data['DayOfWeek'])) { - $data['DayOfWeek'] = [$data['DayOfWeek']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class OperatingHoursStandardHoursNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force DayOfWeek to always be an array even when the API returns a single value - if (isset($data['DayOfWeek']) && !array_is_list($data['DayOfWeek'])) { - $data['DayOfWeek'] = [$data['DayOfWeek']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force DayOfWeek to always be an array even when the API returns a single value + if (isset($data['DayOfWeek']) && !array_is_list($data['DayOfWeek'])) { + $data['DayOfWeek'] = [$data['DayOfWeek']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Locator/OptionCodeTransportationPickUpScheduleNormalizer.php b/src/Normalizer/Locator/OptionCodeTransportationPickUpScheduleNormalizer.php index 319bf1c3..32338aed 100644 --- a/src/Normalizer/Locator/OptionCodeTransportationPickUpScheduleNormalizer.php +++ b/src/Normalizer/Locator/OptionCodeTransportationPickUpScheduleNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Locator; use ShipStream\Ups\Api\Normalizer\OptionCodeTransportationPickUpScheduleNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class OptionCodeTransportationPickUpScheduleNormalizer extends BaseNormalizer +class OptionCodeTransportationPickUpScheduleNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force PickUp to always be an array even when the API returns a single value - if (isset($data['PickUp']) && !array_is_list($data['PickUp'])) { - $data['PickUp'] = [$data['PickUp']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class OptionCodeTransportationPickUpScheduleNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force PickUp to always be an array even when the API returns a single value - if (isset($data['PickUp']) && !array_is_list($data['PickUp'])) { - $data['PickUp'] = [$data['PickUp']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force PickUp to always be an array even when the API returns a single value + if (isset($data['PickUp']) && !array_is_list($data['PickUp'])) { + $data['PickUp'] = [$data['PickUp']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Locator/SearchResultsDropLocationNormalizer.php b/src/Normalizer/Locator/SearchResultsDropLocationNormalizer.php index 191abe87..31761e0b 100644 --- a/src/Normalizer/Locator/SearchResultsDropLocationNormalizer.php +++ b/src/Normalizer/Locator/SearchResultsDropLocationNormalizer.php @@ -3,88 +3,45 @@ namespace ShipStream\Ups\Normalizer\Locator; use ShipStream\Ups\Api\Normalizer\SearchResultsDropLocationNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SearchResultsDropLocationNormalizer extends BaseNormalizer +class SearchResultsDropLocationNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force attributes to always be an array even when the API returns a single value - if (isset($data['PhoneNumber']) && !is_array($data['PhoneNumber'])) { - $data['PhoneNumber'] = [$data['PhoneNumber']]; - } - if (isset($data['LocationAttribute']) && !array_is_list($data['LocationAttribute'])) { - $data['LocationAttribute'] = [$data['LocationAttribute']]; - } - if (isset($data['SpecialInstructions']) && !array_is_list($data['SpecialInstructions'])) { - $data['SpecialInstructions'] = [$data['SpecialInstructions']]; - } - if (isset($data['LatestGroundDropOffTime']) && !is_array($data['LatestGroundDropOffTime'])) { - $data['LatestGroundDropOffTime'] = [$data['LatestGroundDropOffTime']]; - } - if (isset($data['LatestAirDropOffTime']) && !is_array($data['LatestAirDropOffTime'])) { - $data['LatestAirDropOffTime'] = [$data['LatestAirDropOffTime']]; - } - if (isset($data['Disclaimer']) && !is_array($data['Disclaimer'])) { - $data['Disclaimer'] = [$data['Disclaimer']]; - } - if (isset($data['LocalizedInstruction']) && !array_is_list($data['LocalizedInstruction'])) { - $data['LocalizedInstruction'] = [$data['LocalizedInstruction']]; - } - if (isset($data['PromotionInformation']) && !array_is_list($data['PromotionInformation'])) { - $data['PromotionInformation'] = [$data['PromotionInformation']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class SearchResultsDropLocationNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force attributes to always be an array even when the API returns a single value - if (isset($data['PhoneNumber']) && !is_array($data['PhoneNumber'])) { - $data['PhoneNumber'] = [$data['PhoneNumber']]; - } - if (isset($data['LocationAttribute']) && !array_is_list($data['LocationAttribute'])) { - $data['LocationAttribute'] = [$data['LocationAttribute']]; - } - if (isset($data['SpecialInstructions']) && !array_is_list($data['SpecialInstructions'])) { - $data['SpecialInstructions'] = [$data['SpecialInstructions']]; - } - if (isset($data['LatestGroundDropOffTime']) && !is_array($data['LatestGroundDropOffTime'])) { - $data['LatestGroundDropOffTime'] = [$data['LatestGroundDropOffTime']]; - } - if (isset($data['LatestAirDropOffTime']) && !is_array($data['LatestAirDropOffTime'])) { - $data['LatestAirDropOffTime'] = [$data['LatestAirDropOffTime']]; - } - if (isset($data['Disclaimer']) && !is_array($data['Disclaimer'])) { - $data['Disclaimer'] = [$data['Disclaimer']]; - } - if (isset($data['LocalizedInstruction']) && !array_is_list($data['LocalizedInstruction'])) { - $data['LocalizedInstruction'] = [$data['LocalizedInstruction']]; - } - if (isset($data['PromotionInformation']) && !array_is_list($data['PromotionInformation'])) { - $data['PromotionInformation'] = [$data['PromotionInformation']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force attributes to always be an array even when the API returns a single value + if (isset($data['PhoneNumber']) && !is_array($data['PhoneNumber'])) { + $data['PhoneNumber'] = [$data['PhoneNumber']]; + } + if (isset($data['LocationAttribute']) && !array_is_list($data['LocationAttribute'])) { + $data['LocationAttribute'] = [$data['LocationAttribute']]; + } + if (isset($data['SpecialInstructions']) && !array_is_list($data['SpecialInstructions'])) { + $data['SpecialInstructions'] = [$data['SpecialInstructions']]; + } + if (isset($data['LatestGroundDropOffTime']) && !is_array($data['LatestGroundDropOffTime'])) { + $data['LatestGroundDropOffTime'] = [$data['LatestGroundDropOffTime']]; + } + if (isset($data['LatestAirDropOffTime']) && !is_array($data['LatestAirDropOffTime'])) { + $data['LatestAirDropOffTime'] = [$data['LatestAirDropOffTime']]; + } + if (isset($data['Disclaimer']) && !is_array($data['Disclaimer'])) { + $data['Disclaimer'] = [$data['Disclaimer']]; + } + if (isset($data['LocalizedInstruction']) && !array_is_list($data['LocalizedInstruction'])) { + $data['LocalizedInstruction'] = [$data['LocalizedInstruction']]; + } + if (isset($data['PromotionInformation']) && !array_is_list($data['PromotionInformation'])) { + $data['PromotionInformation'] = [$data['PromotionInformation']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Locator/StandardHoursDayOfWeekNormalizer.php b/src/Normalizer/Locator/StandardHoursDayOfWeekNormalizer.php index 2115381f..9022b100 100644 --- a/src/Normalizer/Locator/StandardHoursDayOfWeekNormalizer.php +++ b/src/Normalizer/Locator/StandardHoursDayOfWeekNormalizer.php @@ -3,51 +3,26 @@ namespace ShipStream\Ups\Normalizer\Locator; use ShipStream\Ups\Api\Normalizer\StandardHoursDayOfWeekNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class StandardHoursDayOfWeekNormalizer extends BaseNormalizer +class StandardHoursDayOfWeekNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force OpenHours and CloseHours to always be an array even when the API returns a single value - if (isset($data['OpenHours']) && !is_array($data['OpenHours'])) { - $data['OpenHours'] = [$data['OpenHours']]; - } - if (isset($data['CloseHours']) && !is_array($data['CloseHours'])) { - $data['CloseHours'] = [$data['CloseHours']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class StandardHoursDayOfWeekNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force OpenHours and CloseHours to always be an array even when the API returns a single value - if (isset($data['OpenHours']) && !is_array($data['OpenHours'])) { - $data['OpenHours'] = [$data['OpenHours']]; - } - if (isset($data['CloseHours']) && !is_array($data['CloseHours'])) { - $data['CloseHours'] = [$data['CloseHours']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force OpenHours and CloseHours to always be an array even when the API returns a single value + if (isset($data['OpenHours']) && !is_array($data['OpenHours'])) { + $data['OpenHours'] = [$data['OpenHours']]; + } + if (isset($data['CloseHours']) && !is_array($data['CloseHours'])) { + $data['CloseHours'] = [$data['CloseHours']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Paperless/DeleteResponseResponseNormalizer.php b/src/Normalizer/Paperless/DeleteResponseResponseNormalizer.php index 1e7aa1c8..a367d5ce 100644 --- a/src/Normalizer/Paperless/DeleteResponseResponseNormalizer.php +++ b/src/Normalizer/Paperless/DeleteResponseResponseNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Paperless; use ShipStream\Ups\Api\Normalizer\DeleteResponseResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeleteResponseResponseNormalizer extends BaseNormalizer +class DeleteResponseResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class DeleteResponseResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Alert to always be an array even when the API returns a single value + if (isset($data['Alert']) && !array_is_list($data['Alert'])) { + $data['Alert'] = [$data['Alert']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Paperless/PushToImageRepositoryResponseResponseNormalizer.php b/src/Normalizer/Paperless/PushToImageRepositoryResponseResponseNormalizer.php index cc4096da..502c458c 100644 --- a/src/Normalizer/Paperless/PushToImageRepositoryResponseResponseNormalizer.php +++ b/src/Normalizer/Paperless/PushToImageRepositoryResponseResponseNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Paperless; use ShipStream\Ups\Api\Normalizer\PushToImageRepositoryResponseResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PushToImageRepositoryResponseResponseNormalizer extends BaseNormalizer +class PushToImageRepositoryResponseResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class PushToImageRepositoryResponseResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Alert to always be an array even when the API returns a single value + if (isset($data['Alert']) && !array_is_list($data['Alert'])) { + $data['Alert'] = [$data['Alert']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Paperless/UploadResponseFormsHistoryDocumentIDNormalizer.php b/src/Normalizer/Paperless/UploadResponseFormsHistoryDocumentIDNormalizer.php index 98fac5c9..ca68fe9a 100644 --- a/src/Normalizer/Paperless/UploadResponseFormsHistoryDocumentIDNormalizer.php +++ b/src/Normalizer/Paperless/UploadResponseFormsHistoryDocumentIDNormalizer.php @@ -3,45 +3,24 @@ namespace ShipStream\Ups\Normalizer\Paperless; use ShipStream\Ups\Api\Normalizer\UploadResponseFormsHistoryDocumentIDNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UploadResponseFormsHistoryDocumentIDNormalizer extends BaseNormalizer +class UploadResponseFormsHistoryDocumentIDNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class UploadResponseFormsHistoryDocumentIDNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force DocumentID to always be an array even when the API returns a single value - if (isset($data['DocumentID']) && !is_array($data['DocumentID'])) { - $data['DocumentID'] = [$data['DocumentID']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Alert to always be an array even when the API returns a single value + if (isset($data['Alert']) && !array_is_list($data['Alert'])) { + $data['Alert'] = [$data['Alert']]; } - }} \ No newline at end of file + return parent::denormalize($data, $type, $format, $context); + } +} diff --git a/src/Normalizer/Paperless/UploadResponseResponseNormalizer.php b/src/Normalizer/Paperless/UploadResponseResponseNormalizer.php index d84d6754..41b3d6d0 100644 --- a/src/Normalizer/Paperless/UploadResponseResponseNormalizer.php +++ b/src/Normalizer/Paperless/UploadResponseResponseNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Paperless; use ShipStream\Ups\Api\Normalizer\UploadResponseResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class UploadResponseResponseNormalizer extends BaseNormalizer +class UploadResponseResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class UploadResponseResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Alert to always be an array even when the API returns a single value + if (isset($data['Alert']) && !array_is_list($data['Alert'])) { + $data['Alert'] = [$data['Alert']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Pickup/DropOffFacilitiesAddressNormalizer.php b/src/Normalizer/Pickup/DropOffFacilitiesAddressNormalizer.php index b01226a7..e6aaf3f9 100644 --- a/src/Normalizer/Pickup/DropOffFacilitiesAddressNormalizer.php +++ b/src/Normalizer/Pickup/DropOffFacilitiesAddressNormalizer.php @@ -3,45 +3,23 @@ namespace ShipStream\Ups\Normalizer\Pickup; use ShipStream\Ups\Api\Normalizer\DropOffFacilitiesAddressNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DropOffFacilitiesAddressNormalizer extends BaseNormalizer +class DropOffFacilitiesAddressNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force AddressLine to always be an array even when the API returns a single value - if (isset($data['AddressLine']) && !is_array($data['AddressLine'])) { - $data['AddressLine'] = [$data['AddressLine']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class DropOffFacilitiesAddressNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force AddressLine to always be an array even when the API returns a single value - if (isset($data['AddressLine']) && !is_array($data['AddressLine'])) { - $data['AddressLine'] = [$data['AddressLine']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force AddressLine to always be an array even when the API returns a single value + if (isset($data['AddressLine']) && !is_array($data['AddressLine'])) { + $data['AddressLine'] = [$data['AddressLine']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Pickup/PickupGetPoliticalDivision1ListResponseNormalizer.php b/src/Normalizer/Pickup/PickupGetPoliticalDivision1ListResponseNormalizer.php index bc57723b..82b238a5 100644 --- a/src/Normalizer/Pickup/PickupGetPoliticalDivision1ListResponseNormalizer.php +++ b/src/Normalizer/Pickup/PickupGetPoliticalDivision1ListResponseNormalizer.php @@ -3,45 +3,23 @@ namespace ShipStream\Ups\Normalizer\Pickup; use ShipStream\Ups\Api\Normalizer\PickupGetPoliticalDivision1ListResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetPoliticalDivision1ListResponseNormalizer extends BaseNormalizer +class PickupGetPoliticalDivision1ListResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force PoliticalDivision1 to always be an array even when the API returns a single value - if (isset($data['PoliticalDivision1']) && !is_array($data['PoliticalDivision1'])) { - $data['PoliticalDivision1'] = [$data['PoliticalDivision1']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class PickupGetPoliticalDivision1ListResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force PoliticalDivision1 to always be an array even when the API returns a single value - if (isset($data['PoliticalDivision1']) && !is_array($data['PoliticalDivision1'])) { - $data['PoliticalDivision1'] = [$data['PoliticalDivision1']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force PoliticalDivision1 to always be an array even when the API returns a single value + if (isset($data['PoliticalDivision1']) && !is_array($data['PoliticalDivision1'])) { + $data['PoliticalDivision1'] = [$data['PoliticalDivision1']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Pickup/PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer.php b/src/Normalizer/Pickup/PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer.php index 51b95820..cd607598 100644 --- a/src/Normalizer/Pickup/PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer.php +++ b/src/Normalizer/Pickup/PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Pickup; use ShipStream\Ups\Api\Normalizer\PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer extends BaseNormalizer +class PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force DropOffFacilities to always be an array even when the API returns a single value - if (isset($data['DropOffFacilities']) && !array_is_list($data['DropOffFacilities'])) { - $data['DropOffFacilities'] = [$data['DropOffFacilities']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class PickupGetServiceCenterFacilitiesResponseServiceCenterLocationNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force DropOffFacilities to always be an array even when the API returns a single value - if (isset($data['DropOffFacilities']) && !array_is_list($data['DropOffFacilities'])) { - $data['DropOffFacilities'] = [$data['DropOffFacilities']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force DropOffFacilities to always be an array even when the API returns a single value + if (isset($data['DropOffFacilities']) && !array_is_list($data['DropOffFacilities'])) { + $data['DropOffFacilities'] = [$data['DropOffFacilities']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Pickup/PickupPendingStatusResponseNormalizer.php b/src/Normalizer/Pickup/PickupPendingStatusResponseNormalizer.php index deddbb15..57225a61 100644 --- a/src/Normalizer/Pickup/PickupPendingStatusResponseNormalizer.php +++ b/src/Normalizer/Pickup/PickupPendingStatusResponseNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Pickup; use ShipStream\Ups\Api\Normalizer\PickupPendingStatusResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupPendingStatusResponseNormalizer extends BaseNormalizer +class PickupPendingStatusResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force PendingStatus to always be an array even when the API returns a single value - if (isset($data['PendingStatus']) && !array_is_list($data['PendingStatus'])) { - $data['PendingStatus'] = [$data['PendingStatus']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class PickupPendingStatusResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force PendingStatus to always be an array even when the API returns a single value - if (isset($data['PendingStatus']) && !array_is_list($data['PendingStatus'])) { - $data['PendingStatus'] = [$data['PendingStatus']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force PendingStatus to always be an array even when the API returns a single value + if (isset($data['PendingStatus']) && !array_is_list($data['PendingStatus'])) { + $data['PendingStatus'] = [$data['PendingStatus']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Pickup/PickupRateResponseRateResultNormalizer.php b/src/Normalizer/Pickup/PickupRateResponseRateResultNormalizer.php index 1f5082f6..88084d1f 100644 --- a/src/Normalizer/Pickup/PickupRateResponseRateResultNormalizer.php +++ b/src/Normalizer/Pickup/PickupRateResponseRateResultNormalizer.php @@ -3,52 +3,27 @@ namespace ShipStream\Ups\Normalizer\Pickup; use ShipStream\Ups\Api\Normalizer\PickupRateResponseRateResultNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupRateResponseRateResultNormalizer extends BaseNormalizer +class PickupRateResponseRateResultNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force fields to always be an array even when the API returns a single value - if (isset($data['ChargeDetail']) && !array_is_list($data['ChargeDetail'])) { - $data['ChargeDetail'] = [$data['ChargeDetail']]; - } - if (isset($data['TaxCharges']) && !array_is_list($data['TaxCharges'])) { - $data['TaxCharges'] = [$data['TaxCharges']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class PickupRateResponseRateResultNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force fields to always be an array even when the API returns a single value - if (isset($data['ChargeDetail']) && !array_is_list($data['ChargeDetail'])) { - $data['ChargeDetail'] = [$data['ChargeDetail']]; - } - if (isset($data['TaxCharges']) && !array_is_list($data['TaxCharges'])) { - $data['TaxCharges'] = [$data['TaxCharges']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force fields to always be an array even when the API returns a single value + if (isset($data['ChargeDetail']) && !array_is_list($data['ChargeDetail'])) { + $data['ChargeDetail'] = [$data['ChargeDetail']]; + } + if (isset($data['TaxCharges']) && !array_is_list($data['TaxCharges'])) { + $data['TaxCharges'] = [$data['TaxCharges']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Pickup/PickupRateResponseResponseNormalizer.php b/src/Normalizer/Pickup/PickupRateResponseResponseNormalizer.php index bde938ac..1e0206ad 100644 --- a/src/Normalizer/Pickup/PickupRateResponseResponseNormalizer.php +++ b/src/Normalizer/Pickup/PickupRateResponseResponseNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Pickup; use ShipStream\Ups\Api\Normalizer\PickupRateResponseResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PickupRateResponseResponseNormalizer extends BaseNormalizer +class PickupRateResponseResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class PickupRateResponseResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Alert to always be an array even when the API returns a single value + if (isset($data['Alert']) && !array_is_list($data['Alert'])) { + $data['Alert'] = [$data['Alert']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Pickup/ServiceCenterLocationDropOffFacilitiesNormalizer.php b/src/Normalizer/Pickup/ServiceCenterLocationDropOffFacilitiesNormalizer.php index 750576b8..712f7433 100644 --- a/src/Normalizer/Pickup/ServiceCenterLocationDropOffFacilitiesNormalizer.php +++ b/src/Normalizer/Pickup/ServiceCenterLocationDropOffFacilitiesNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Pickup; use ShipStream\Ups\Api\Normalizer\ServiceCenterLocationDropOffFacilitiesNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ServiceCenterLocationDropOffFacilitiesNormalizer extends BaseNormalizer +class ServiceCenterLocationDropOffFacilitiesNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force LocalizedInstruction to always be an array even when the API returns a single value - if (isset($data['LocalizedInstruction']) && !array_is_list($data['LocalizedInstruction'])) { - $data['LocalizedInstruction'] = [$data['LocalizedInstruction']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class ServiceCenterLocationDropOffFacilitiesNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force LocalizedInstruction to always be an array even when the API returns a single value - if (isset($data['LocalizedInstruction']) && !array_is_list($data['LocalizedInstruction'])) { - $data['LocalizedInstruction'] = [$data['LocalizedInstruction']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force LocalizedInstruction to always be an array even when the API returns a single value + if (isset($data['LocalizedInstruction']) && !array_is_list($data['LocalizedInstruction'])) { + $data['LocalizedInstruction'] = [$data['LocalizedInstruction']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/PreNotification/PreNotificationResponseResponseNormalizer.php b/src/Normalizer/PreNotification/PreNotificationResponseResponseNormalizer.php index a5410b2c..d9b2e88f 100644 --- a/src/Normalizer/PreNotification/PreNotificationResponseResponseNormalizer.php +++ b/src/Normalizer/PreNotification/PreNotificationResponseResponseNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\PreNotification; use ShipStream\Ups\Api\Normalizer\PreNotificationResponseResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class PreNotificationResponseResponseNormalizer extends BaseNormalizer +class PreNotificationResponseResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class PreNotificationResponseResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Alert to always be an array even when the API returns a single value + if (isset($data['Alert']) && !array_is_list($data['Alert'])) { + $data['Alert'] = [$data['Alert']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/QuantumView/DeliveryLocationAddressArtifactFormatNormalizer.php b/src/Normalizer/QuantumView/DeliveryLocationAddressArtifactFormatNormalizer.php index 01d620d1..751f89b9 100644 --- a/src/Normalizer/QuantumView/DeliveryLocationAddressArtifactFormatNormalizer.php +++ b/src/Normalizer/QuantumView/DeliveryLocationAddressArtifactFormatNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\QuantumView; use ShipStream\Ups\Api\Normalizer\DeliveryLocationAddressArtifactFormatNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class DeliveryLocationAddressArtifactFormatNormalizer extends BaseNormalizer +class DeliveryLocationAddressArtifactFormatNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force AddressExtendedInformation to always be an array even when the API returns a single value - if (isset($data['AddressExtendedInformation']) && !array_is_list($data['AddressExtendedInformation'])) { - $data['AddressExtendedInformation'] = [$data['AddressExtendedInformation']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class DeliveryLocationAddressArtifactFormatNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force AddressExtendedInformation to always be an array even when the API returns a single value - if (isset($data['AddressExtendedInformation']) && !array_is_list($data['AddressExtendedInformation'])) { - $data['AddressExtendedInformation'] = [$data['AddressExtendedInformation']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force AddressExtendedInformation to always be an array even when the API returns a single value + if (isset($data['AddressExtendedInformation']) && !array_is_list($data['AddressExtendedInformation'])) { + $data['AddressExtendedInformation'] = [$data['AddressExtendedInformation']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/QuantumView/ExceptionUpdatedAddressNormalizer.php b/src/Normalizer/QuantumView/ExceptionUpdatedAddressNormalizer.php index ba46c41c..7e7b3660 100644 --- a/src/Normalizer/QuantumView/ExceptionUpdatedAddressNormalizer.php +++ b/src/Normalizer/QuantumView/ExceptionUpdatedAddressNormalizer.php @@ -3,11 +3,9 @@ namespace ShipStream\Ups\Normalizer\QuantumView; use ShipStream\Ups\Api\Normalizer\ExceptionUpdatedAddressNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { class ExceptionUpdatedAddressNormalizer extends BaseNormalizer { /** @@ -26,23 +24,3 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a return parent::denormalize($data, $type, $format, $context); } } -} else { - class ExceptionUpdatedAddressNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force AddressExtendedInformation to always be an array even when the API returns a single value - if (isset($data['AddressExtendedInformation']) && ! array_is_list($data['AddressExtendedInformation'])) { - $data['AddressExtendedInformation'] = [$data['AddressExtendedInformation']]; - } - return parent::denormalize($data, $type, $format, $context); - } - } -} \ No newline at end of file diff --git a/src/Normalizer/QuantumView/ManifestPackageNormalizer.php b/src/Normalizer/QuantumView/ManifestPackageNormalizer.php index 53b3f50a..7ce4aa2e 100644 --- a/src/Normalizer/QuantumView/ManifestPackageNormalizer.php +++ b/src/Normalizer/QuantumView/ManifestPackageNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\QuantumView; use ShipStream\Ups\Api\Normalizer\ManifestPackageNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ManifestPackageNormalizer extends BaseNormalizer +class ManifestPackageNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Activity to always be an array even when the API returns a single value - if (isset($data['Activity']) && !array_is_list($data['Activity'])) { - $data['Activity'] = [$data['Activity']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class ManifestPackageNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Activity to always be an array even when the API returns a single value - if (isset($data['Activity']) && !array_is_list($data['Activity'])) { - $data['Activity'] = [$data['Activity']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Activity to always be an array even when the API returns a single value + if (isset($data['Activity']) && !array_is_list($data['Activity'])) { + $data['Activity'] = [$data['Activity']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/QuantumView/QuantumViewEventsSubscriptionEventsNormalizer.php b/src/Normalizer/QuantumView/QuantumViewEventsSubscriptionEventsNormalizer.php index 796b1e81..888b59b4 100644 --- a/src/Normalizer/QuantumView/QuantumViewEventsSubscriptionEventsNormalizer.php +++ b/src/Normalizer/QuantumView/QuantumViewEventsSubscriptionEventsNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\QuantumView; use ShipStream\Ups\Api\Normalizer\QuantumViewEventsSubscriptionEventsNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class QuantumViewEventsSubscriptionEventsNormalizer extends BaseNormalizer +class QuantumViewEventsSubscriptionEventsNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force SubscriptionFile to always be an array even when the API returns a single value - if (isset($data['SubscriptionFile']) && !array_is_list($data['SubscriptionFile'])) { - $data['SubscriptionFile'] = [$data['SubscriptionFile']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class QuantumViewEventsSubscriptionEventsNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force SubscriptionFile to always be an array even when the API returns a single value - if (isset($data['SubscriptionFile']) && !array_is_list($data['SubscriptionFile'])) { - $data['SubscriptionFile'] = [$data['SubscriptionFile']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force SubscriptionFile to always be an array even when the API returns a single value + if (isset($data['SubscriptionFile']) && !array_is_list($data['SubscriptionFile'])) { + $data['SubscriptionFile'] = [$data['SubscriptionFile']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/QuantumView/QuantumViewResponseQuantumViewEventsNormalizer.php b/src/Normalizer/QuantumView/QuantumViewResponseQuantumViewEventsNormalizer.php index 2064daf4..516e67f6 100644 --- a/src/Normalizer/QuantumView/QuantumViewResponseQuantumViewEventsNormalizer.php +++ b/src/Normalizer/QuantumView/QuantumViewResponseQuantumViewEventsNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\QuantumView; use ShipStream\Ups\Api\Normalizer\QuantumViewResponseQuantumViewEventsNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class QuantumViewResponseQuantumViewEventsNormalizer extends BaseNormalizer +class QuantumViewResponseQuantumViewEventsNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force SubscriptionFile to always be an array even when the API returns a single value - if (isset($data['SubscriptionEvents']) && !array_is_list($data['SubscriptionEvents'])) { - $data['SubscriptionEvents'] = [$data['SubscriptionEvents']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class QuantumViewResponseQuantumViewEventsNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force SubscriptionFile to always be an array even when the API returns a single value - if (isset($data['SubscriptionEvents']) && !array_is_list($data['SubscriptionEvents'])) { - $data['SubscriptionEvents'] = [$data['SubscriptionEvents']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force SubscriptionFile to always be an array even when the API returns a single value + if (isset($data['SubscriptionEvents']) && !array_is_list($data['SubscriptionEvents'])) { + $data['SubscriptionEvents'] = [$data['SubscriptionEvents']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/QuantumView/QuantumViewResponseResponseNormalizer.php b/src/Normalizer/QuantumView/QuantumViewResponseResponseNormalizer.php index 0a71c930..a1098f71 100644 --- a/src/Normalizer/QuantumView/QuantumViewResponseResponseNormalizer.php +++ b/src/Normalizer/QuantumView/QuantumViewResponseResponseNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\QuantumView; use ShipStream\Ups\Api\Normalizer\QuantumViewResponseResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class QuantumViewResponseResponseNormalizer extends BaseNormalizer +class QuantumViewResponseResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Error to always be an array even when the API returns a single value - if (isset($data['Error']) && !array_is_list($data['Error'])) { - $data['Error'] = [$data['Error']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class QuantumViewResponseResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Error to always be an array even when the API returns a single value - if (isset($data['Error']) && !array_is_list($data['Error'])) { - $data['Error'] = [$data['Error']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Error to always be an array even when the API returns a single value + if (isset($data['Error']) && !array_is_list($data['Error'])) { + $data['Error'] = [$data['Error']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/QuantumView/SubscriptionEventsSubscriptionFileNormalizer.php b/src/Normalizer/QuantumView/SubscriptionEventsSubscriptionFileNormalizer.php index c6213c07..23fc4d85 100644 --- a/src/Normalizer/QuantumView/SubscriptionEventsSubscriptionFileNormalizer.php +++ b/src/Normalizer/QuantumView/SubscriptionEventsSubscriptionFileNormalizer.php @@ -3,70 +3,36 @@ namespace ShipStream\Ups\Normalizer\QuantumView; use ShipStream\Ups\Api\Normalizer\SubscriptionEventsSubscriptionFileNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionEventsSubscriptionFileNormalizer extends BaseNormalizer +class SubscriptionEventsSubscriptionFileNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Manifest to always be an array even when the API returns a single value - if (isset($data['Manifest']) && !array_is_list($data['Manifest'])) { - $data['Manifest'] = [$data['Manifest']]; - } - if (isset($data['Origin']) && !array_is_list($data['Origin'])) { - $data['Origin'] = [$data['Origin']]; - } - if (isset($data['Exception']) && !array_is_list($data['Exception'])) { - $data['Exception'] = [$data['Exception']]; - } - if (isset($data['Delivery']) && !array_is_list($data['Delivery'])) { - $data['Delivery'] = [$data['Delivery']]; - } - if (isset($data['Generic']) && !array_is_list($data['Generic'])) { - $data['Generic'] = [$data['Generic']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class SubscriptionEventsSubscriptionFileNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Manifest to always be an array even when the API returns a single value - if (isset($data['Manifest']) && !array_is_list($data['Manifest'])) { - $data['Manifest'] = [$data['Manifest']]; - } - if (isset($data['Origin']) && !array_is_list($data['Origin'])) { - $data['Origin'] = [$data['Origin']]; - } - if (isset($data['Exception']) && !array_is_list($data['Exception'])) { - $data['Exception'] = [$data['Exception']]; - } - if (isset($data['Delivery']) && !array_is_list($data['Delivery'])) { - $data['Delivery'] = [$data['Delivery']]; - } - if (isset($data['Generic']) && !array_is_list($data['Generic'])) { - $data['Generic'] = [$data['Generic']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Manifest to always be an array even when the API returns a single value + if (isset($data['Manifest']) && !array_is_list($data['Manifest'])) { + $data['Manifest'] = [$data['Manifest']]; + } + if (isset($data['Origin']) && !array_is_list($data['Origin'])) { + $data['Origin'] = [$data['Origin']]; + } + if (isset($data['Exception']) && !array_is_list($data['Exception'])) { + $data['Exception'] = [$data['Exception']]; + } + if (isset($data['Delivery']) && !array_is_list($data['Delivery'])) { + $data['Delivery'] = [$data['Delivery']]; + } + if (isset($data['Generic']) && !array_is_list($data['Generic'])) { + $data['Generic'] = [$data['Generic']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/QuantumView/SubscriptionFileDeliveryNormalizer.php b/src/Normalizer/QuantumView/SubscriptionFileDeliveryNormalizer.php index fe983f2b..ebf191c5 100644 --- a/src/Normalizer/QuantumView/SubscriptionFileDeliveryNormalizer.php +++ b/src/Normalizer/QuantumView/SubscriptionFileDeliveryNormalizer.php @@ -3,52 +3,27 @@ namespace ShipStream\Ups\Normalizer\QuantumView; use ShipStream\Ups\Api\Normalizer\SubscriptionFileDeliveryNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionFileDeliveryNormalizer extends BaseNormalizer +class SubscriptionFileDeliveryNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force fields to always be an array even when the API returns a single value - if (isset($data['PackageReferenceNumber']) && !array_is_list($data['PackageReferenceNumber'])) { - $data['PackageReferenceNumber'] = [$data['PackageReferenceNumber']]; - } - if (isset($data['ShipmentReferenceNumber']) && !array_is_list($data['ShipmentReferenceNumber'])) { - $data['ShipmentReferenceNumber'] = [$data['ShipmentReferenceNumber']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class SubscriptionFileDeliveryNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force fields to always be an array even when the API returns a single value - if (isset($data['PackageReferenceNumber']) && !array_is_list($data['PackageReferenceNumber'])) { - $data['PackageReferenceNumber'] = [$data['PackageReferenceNumber']]; - } - if (isset($data['ShipmentReferenceNumber']) && !array_is_list($data['ShipmentReferenceNumber'])) { - $data['ShipmentReferenceNumber'] = [$data['ShipmentReferenceNumber']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force fields to always be an array even when the API returns a single value + if (isset($data['PackageReferenceNumber']) && !array_is_list($data['PackageReferenceNumber'])) { + $data['PackageReferenceNumber'] = [$data['PackageReferenceNumber']]; + } + if (isset($data['ShipmentReferenceNumber']) && !array_is_list($data['ShipmentReferenceNumber'])) { + $data['ShipmentReferenceNumber'] = [$data['ShipmentReferenceNumber']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/QuantumView/SubscriptionFileExceptionNormalizer.php b/src/Normalizer/QuantumView/SubscriptionFileExceptionNormalizer.php index 5ea25090..874db63b 100644 --- a/src/Normalizer/QuantumView/SubscriptionFileExceptionNormalizer.php +++ b/src/Normalizer/QuantumView/SubscriptionFileExceptionNormalizer.php @@ -3,52 +3,27 @@ namespace ShipStream\Ups\Normalizer\QuantumView; use ShipStream\Ups\Api\Normalizer\SubscriptionFileExceptionNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionFileExceptionNormalizer extends BaseNormalizer +class SubscriptionFileExceptionNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force fields to always be an array even when the API returns a single value - if (isset($data['PackageReferenceNumber']) && !array_is_list($data['PackageReferenceNumber'])) { - $data['PackageReferenceNumber'] = [$data['PackageReferenceNumber']]; - } - if (isset($data['ShipmentReferenceNumber']) && !array_is_list($data['ShipmentReferenceNumber'])) { - $data['ShipmentReferenceNumber'] = [$data['ShipmentReferenceNumber']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class SubscriptionFileExceptionNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force fields to always be an array even when the API returns a single value - if (isset($data['PackageReferenceNumber']) && !array_is_list($data['PackageReferenceNumber'])) { - $data['PackageReferenceNumber'] = [$data['PackageReferenceNumber']]; - } - if (isset($data['ShipmentReferenceNumber']) && !array_is_list($data['ShipmentReferenceNumber'])) { - $data['ShipmentReferenceNumber'] = [$data['ShipmentReferenceNumber']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force fields to always be an array even when the API returns a single value + if (isset($data['PackageReferenceNumber']) && !array_is_list($data['PackageReferenceNumber'])) { + $data['PackageReferenceNumber'] = [$data['PackageReferenceNumber']]; + } + if (isset($data['ShipmentReferenceNumber']) && !array_is_list($data['ShipmentReferenceNumber'])) { + $data['ShipmentReferenceNumber'] = [$data['ShipmentReferenceNumber']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/QuantumView/SubscriptionFileGenericNormalizer.php b/src/Normalizer/QuantumView/SubscriptionFileGenericNormalizer.php index 56b5ce19..5bb8b270 100644 --- a/src/Normalizer/QuantumView/SubscriptionFileGenericNormalizer.php +++ b/src/Normalizer/QuantumView/SubscriptionFileGenericNormalizer.php @@ -3,52 +3,27 @@ namespace ShipStream\Ups\Normalizer\QuantumView; use ShipStream\Ups\Api\Normalizer\SubscriptionFileGenericNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionFileGenericNormalizer extends BaseNormalizer +class SubscriptionFileGenericNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force fields to always be an array even when the API returns a single value - if (isset($data['ShipmentReferenceNumber']) && !array_is_list($data['ShipmentReferenceNumber'])) { - $data['ShipmentReferenceNumber'] = [$data['ShipmentReferenceNumber']]; - } - if (isset($data['PackageReferenceNumber']) && !array_is_list($data['PackageReferenceNumber'])) { - $data['PackageReferenceNumber'] = [$data['PackageReferenceNumber']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class SubscriptionFileGenericNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force fields to always be an array even when the API returns a single value - if (isset($data['ShipmentReferenceNumber']) && !array_is_list($data['ShipmentReferenceNumber'])) { - $data['ShipmentReferenceNumber'] = [$data['ShipmentReferenceNumber']]; - } - if (isset($data['PackageReferenceNumber']) && !array_is_list($data['PackageReferenceNumber'])) { - $data['PackageReferenceNumber'] = [$data['PackageReferenceNumber']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force fields to always be an array even when the API returns a single value + if (isset($data['ShipmentReferenceNumber']) && !array_is_list($data['ShipmentReferenceNumber'])) { + $data['ShipmentReferenceNumber'] = [$data['ShipmentReferenceNumber']]; + } + if (isset($data['PackageReferenceNumber']) && !array_is_list($data['PackageReferenceNumber'])) { + $data['PackageReferenceNumber'] = [$data['PackageReferenceNumber']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/QuantumView/SubscriptionFileManifestNormalizer.php b/src/Normalizer/QuantumView/SubscriptionFileManifestNormalizer.php index 0bd13929..73ebe7ed 100644 --- a/src/Normalizer/QuantumView/SubscriptionFileManifestNormalizer.php +++ b/src/Normalizer/QuantumView/SubscriptionFileManifestNormalizer.php @@ -3,52 +3,27 @@ namespace ShipStream\Ups\Normalizer\QuantumView; use ShipStream\Ups\Api\Normalizer\SubscriptionFileManifestNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionFileManifestNormalizer extends BaseNormalizer +class SubscriptionFileManifestNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force fields to always be an array even when the API returns a single value - if (isset($data['ReferenceNumber']) && ! array_is_list($data['ReferenceNumber'])) { - $data['ReferenceNumber'] = [$data['ReferenceNumber']]; - } - if (isset($data['Package']) && ! array_is_list($data['Package'])) { - $data['Package'] = [$data['Package']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class SubscriptionFileManifestNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force fields to always be an array even when the API returns a single value - if (isset($data['ReferenceNumber']) && ! array_is_list($data['ReferenceNumber'])) { - $data['ReferenceNumber'] = [$data['ReferenceNumber']]; - } - if (isset($data['Package']) && ! array_is_list($data['Package'])) { - $data['Package'] = [$data['Package']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force fields to always be an array even when the API returns a single value + if (isset($data['ReferenceNumber']) && ! array_is_list($data['ReferenceNumber'])) { + $data['ReferenceNumber'] = [$data['ReferenceNumber']]; + } + if (isset($data['Package']) && ! array_is_list($data['Package'])) { + $data['Package'] = [$data['Package']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/QuantumView/SubscriptionFileOriginNormalizer.php b/src/Normalizer/QuantumView/SubscriptionFileOriginNormalizer.php index bfc3cc01..388ba98b 100644 --- a/src/Normalizer/QuantumView/SubscriptionFileOriginNormalizer.php +++ b/src/Normalizer/QuantumView/SubscriptionFileOriginNormalizer.php @@ -3,52 +3,27 @@ namespace ShipStream\Ups\Normalizer\QuantumView; use ShipStream\Ups\Api\Normalizer\SubscriptionFileOriginNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class SubscriptionFileOriginNormalizer extends BaseNormalizer +class SubscriptionFileOriginNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force fields to always be an array even when the API returns a single value - if (isset($data['PackageReferenceNumber']) && !array_is_list($data['PackageReferenceNumber'])) { - $data['PackageReferenceNumber'] = [$data['PackageReferenceNumber']]; - } - if (isset($data['ShipmentReferenceNumber']) && !array_is_list($data['ShipmentReferenceNumber'])) { - $data['ShipmentReferenceNumber'] = [$data['ShipmentReferenceNumber']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class SubscriptionFileOriginNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force fields to always be an array even when the API returns a single value - if (isset($data['PackageReferenceNumber']) && !array_is_list($data['PackageReferenceNumber'])) { - $data['PackageReferenceNumber'] = [$data['PackageReferenceNumber']]; - } - if (isset($data['ShipmentReferenceNumber']) && !array_is_list($data['ShipmentReferenceNumber'])) { - $data['ShipmentReferenceNumber'] = [$data['ShipmentReferenceNumber']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force fields to always be an array even when the API returns a single value + if (isset($data['PackageReferenceNumber']) && !array_is_list($data['PackageReferenceNumber'])) { + $data['PackageReferenceNumber'] = [$data['PackageReferenceNumber']]; + } + if (isset($data['ShipmentReferenceNumber']) && !array_is_list($data['ShipmentReferenceNumber'])) { + $data['ShipmentReferenceNumber'] = [$data['ShipmentReferenceNumber']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Rating/AlertDetailElementLevelInformationNormalizer.php b/src/Normalizer/Rating/AlertDetailElementLevelInformationNormalizer.php index 897c9d86..7aff7678 100644 --- a/src/Normalizer/Rating/AlertDetailElementLevelInformationNormalizer.php +++ b/src/Normalizer/Rating/AlertDetailElementLevelInformationNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Rating; use ShipStream\Ups\Api\Normalizer\AlertDetailElementLevelInformationNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class AlertDetailElementLevelInformationNormalizer extends BaseNormalizer +class AlertDetailElementLevelInformationNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force ElementLevelInformation to always be an array even when the API returns a single value - if (isset($data['ElementLevelInformation']) && !array_is_list($data['ElementLevelInformation'])) { - $data['ElementLevelInformation'] = [$data['ElementLevelInformation']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class AlertDetailElementLevelInformationNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force ElementLevelInformation to always be an array even when the API returns a single value - if (isset($data['ElementLevelInformation']) && !array_is_list($data['ElementLevelInformation'])) { - $data['ElementLevelInformation'] = [$data['ElementLevelInformation']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force ElementLevelInformation to always be an array even when the API returns a single value + if (isset($data['ElementLevelInformation']) && !array_is_list($data['ElementLevelInformation'])) { + $data['ElementLevelInformation'] = [$data['ElementLevelInformation']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Rating/RateResponseNormalizer.php b/src/Normalizer/Rating/RateResponseNormalizer.php index 58c4168d..47de850e 100644 --- a/src/Normalizer/Rating/RateResponseNormalizer.php +++ b/src/Normalizer/Rating/RateResponseNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Rating; use ShipStream\Ups\Api\Normalizer\RateResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateResponseNormalizer extends BaseNormalizer +class RateResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force RatedShipment to always be an array even when the API returns a single value - if (isset($data['RatedShipment']) && !array_is_list($data['RatedShipment'])) { - $data['RatedShipment'] = [$data['RatedShipment']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class RateResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force RatedShipment to always be an array even when the API returns a single value - if (isset($data['RatedShipment']) && !array_is_list($data['RatedShipment'])) { - $data['RatedShipment'] = [$data['RatedShipment']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force RatedShipment to always be an array even when the API returns a single value + if (isset($data['RatedShipment']) && !array_is_list($data['RatedShipment'])) { + $data['RatedShipment'] = [$data['RatedShipment']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Rating/RateResponseRatedShipmentNormalizer.php b/src/Normalizer/Rating/RateResponseRatedShipmentNormalizer.php index eccc1d11..b0d27442 100644 --- a/src/Normalizer/Rating/RateResponseRatedShipmentNormalizer.php +++ b/src/Normalizer/Rating/RateResponseRatedShipmentNormalizer.php @@ -3,76 +3,39 @@ namespace ShipStream\Ups\Normalizer\Rating; use ShipStream\Ups\Api\Normalizer\RateResponseRatedShipmentNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateResponseRatedShipmentNormalizer extends BaseNormalizer +class RateResponseRatedShipmentNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force fields to always be an array even when the API returns a single value - if (isset($data['Disclaimer']) && !array_is_list($data['Disclaimer'])) { - $data['Disclaimer'] = [$data['Disclaimer']]; - } - if (isset($data['RatedShipmentAlert']) && !array_is_list($data['RatedShipmentAlert'])) { - $data['RatedShipmentAlert'] = [$data['RatedShipmentAlert']]; - } - if (isset($data['ItemizedCharges']) && !array_is_list($data['ItemizedCharges'])) { - $data['ItemizedCharges'] = [$data['ItemizedCharges']]; - } - if (isset($data['TaxCharges']) && !array_is_list($data['TaxCharges'])) { - $data['TaxCharges'] = [$data['TaxCharges']]; - } - if (isset($data['RatedPackage']) && !array_is_list($data['RatedPackage'])) { - $data['RatedPackage'] = [$data['RatedPackage']]; - } - if (isset($data['HandlingUnits']) && !array_is_list($data['HandlingUnits'])) { - $data['HandlingUnits'] = [$data['HandlingUnits']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class RateResponseRatedShipmentNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force fields to always be an array even when the API returns a single value - if (isset($data['Disclaimer']) && !array_is_list($data['Disclaimer'])) { - $data['Disclaimer'] = [$data['Disclaimer']]; - } - if (isset($data['RatedShipmentAlert']) && !array_is_list($data['RatedShipmentAlert'])) { - $data['RatedShipmentAlert'] = [$data['RatedShipmentAlert']]; - } - if (isset($data['ItemizedCharges']) && !array_is_list($data['ItemizedCharges'])) { - $data['ItemizedCharges'] = [$data['ItemizedCharges']]; - } - if (isset($data['TaxCharges']) && !array_is_list($data['TaxCharges'])) { - $data['TaxCharges'] = [$data['TaxCharges']]; - } - if (isset($data['RatedPackage']) && !array_is_list($data['RatedPackage'])) { - $data['RatedPackage'] = [$data['RatedPackage']]; - } - if (isset($data['HandlingUnits']) && !array_is_list($data['HandlingUnits'])) { - $data['HandlingUnits'] = [$data['HandlingUnits']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force fields to always be an array even when the API returns a single value + if (isset($data['Disclaimer']) && !array_is_list($data['Disclaimer'])) { + $data['Disclaimer'] = [$data['Disclaimer']]; + } + if (isset($data['RatedShipmentAlert']) && !array_is_list($data['RatedShipmentAlert'])) { + $data['RatedShipmentAlert'] = [$data['RatedShipmentAlert']]; + } + if (isset($data['ItemizedCharges']) && !array_is_list($data['ItemizedCharges'])) { + $data['ItemizedCharges'] = [$data['ItemizedCharges']]; + } + if (isset($data['TaxCharges']) && !array_is_list($data['TaxCharges'])) { + $data['TaxCharges'] = [$data['TaxCharges']]; + } + if (isset($data['RatedPackage']) && !array_is_list($data['RatedPackage'])) { + $data['RatedPackage'] = [$data['RatedPackage']]; + } + if (isset($data['HandlingUnits']) && !array_is_list($data['HandlingUnits'])) { + $data['HandlingUnits'] = [$data['HandlingUnits']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Rating/RateResponseResponseNormalizer.php b/src/Normalizer/Rating/RateResponseResponseNormalizer.php index 257db1e3..8ef5da1f 100644 --- a/src/Normalizer/Rating/RateResponseResponseNormalizer.php +++ b/src/Normalizer/Rating/RateResponseResponseNormalizer.php @@ -3,52 +3,27 @@ namespace ShipStream\Ups\Normalizer\Rating; use ShipStream\Ups\Api\Normalizer\RateResponseResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RateResponseResponseNormalizer extends BaseNormalizer +class RateResponseResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force fields to always be an array even when the API returns a single value - if (isset($data['Alert']) && ! array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } - if (isset($data['AlertDetail']) && ! array_is_list($data['AlertDetail'])) { - $data['AlertDetail'] = [$data['AlertDetail']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class RateResponseResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force fields to always be an array even when the API returns a single value - if (isset($data['Alert']) && ! array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } - if (isset($data['AlertDetail']) && ! array_is_list($data['AlertDetail'])) { - $data['AlertDetail'] = [$data['AlertDetail']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force fields to always be an array even when the API returns a single value + if (isset($data['Alert']) && ! array_is_list($data['Alert'])) { + $data['Alert'] = [$data['Alert']]; + } + if (isset($data['AlertDetail']) && ! array_is_list($data['AlertDetail'])) { + $data['AlertDetail'] = [$data['AlertDetail']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Rating/RatedPackageNegotiatedChargesNormalizer.php b/src/Normalizer/Rating/RatedPackageNegotiatedChargesNormalizer.php index abc89a65..69b49184 100644 --- a/src/Normalizer/Rating/RatedPackageNegotiatedChargesNormalizer.php +++ b/src/Normalizer/Rating/RatedPackageNegotiatedChargesNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Rating; use ShipStream\Ups\Api\Normalizer\RatedPackageNegotiatedChargesNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedPackageNegotiatedChargesNormalizer extends BaseNormalizer +class RatedPackageNegotiatedChargesNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force ItemizedCharges to always be an array even when the API returns a single value - if (isset($data['ItemizedCharges']) && !array_is_list($data['ItemizedCharges'])) { - $data['ItemizedCharges'] = [$data['ItemizedCharges']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class RatedPackageNegotiatedChargesNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force ItemizedCharges to always be an array even when the API returns a single value - if (isset($data['ItemizedCharges']) && !array_is_list($data['ItemizedCharges'])) { - $data['ItemizedCharges'] = [$data['ItemizedCharges']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force ItemizedCharges to always be an array even when the API returns a single value + if (isset($data['ItemizedCharges']) && !array_is_list($data['ItemizedCharges'])) { + $data['ItemizedCharges'] = [$data['ItemizedCharges']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Rating/RatedShipmentNegotiatedRateChargesNormalizer.php b/src/Normalizer/Rating/RatedShipmentNegotiatedRateChargesNormalizer.php index 018b7f17..9866eaed 100644 --- a/src/Normalizer/Rating/RatedShipmentNegotiatedRateChargesNormalizer.php +++ b/src/Normalizer/Rating/RatedShipmentNegotiatedRateChargesNormalizer.php @@ -3,52 +3,27 @@ namespace ShipStream\Ups\Normalizer\Rating; use ShipStream\Ups\Api\Normalizer\RatedShipmentNegotiatedRateChargesNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentNegotiatedRateChargesNormalizer extends BaseNormalizer +class RatedShipmentNegotiatedRateChargesNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force fields to always be an array even when the API returns a single value - if (isset($data['ItemizedCharges']) && !array_is_list($data['ItemizedCharges'])) { - $data['ItemizedCharges'] = [$data['ItemizedCharges']]; - } - if (isset($data['TaxCharges']) && !array_is_list($data['TaxCharges'])) { - $data['TaxCharges'] = [$data['TaxCharges']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class RatedShipmentNegotiatedRateChargesNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force fields to always be an array even when the API returns a single value - if (isset($data['ItemizedCharges']) && !array_is_list($data['ItemizedCharges'])) { - $data['ItemizedCharges'] = [$data['ItemizedCharges']]; - } - if (isset($data['TaxCharges']) && !array_is_list($data['TaxCharges'])) { - $data['TaxCharges'] = [$data['TaxCharges']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force fields to always be an array even when the API returns a single value + if (isset($data['ItemizedCharges']) && !array_is_list($data['ItemizedCharges'])) { + $data['ItemizedCharges'] = [$data['ItemizedCharges']]; + } + if (isset($data['TaxCharges']) && !array_is_list($data['TaxCharges'])) { + $data['TaxCharges'] = [$data['TaxCharges']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Rating/RatedShipmentRatedPackageNormalizer.php b/src/Normalizer/Rating/RatedShipmentRatedPackageNormalizer.php index 2d0d3aad..f72b02e8 100644 --- a/src/Normalizer/Rating/RatedShipmentRatedPackageNormalizer.php +++ b/src/Normalizer/Rating/RatedShipmentRatedPackageNormalizer.php @@ -3,58 +3,30 @@ namespace ShipStream\Ups\Normalizer\Rating; use ShipStream\Ups\Api\Normalizer\RatedShipmentRatedPackageNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class RatedShipmentRatedPackageNormalizer extends BaseNormalizer +class RatedShipmentRatedPackageNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force fields to always be an array even when the API returns a single value - if (isset($data['Accessorial']) && !array_is_list($data['Accessorial'])) { - $data['Accessorial'] = [$data['Accessorial']]; - } - if (isset($data['ItemizedCharges']) && !array_is_list($data['ItemizedCharges'])) { - $data['ItemizedCharges'] = [$data['ItemizedCharges']]; - } - if (isset($data['RateModifier']) && !array_is_list($data['RateModifier'])) { - $data['RateModifier'] = [$data['RateModifier']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class RatedShipmentRatedPackageNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force fields to always be an array even when the API returns a single value - if (isset($data['Accessorial']) && !array_is_list($data['Accessorial'])) { - $data['Accessorial'] = [$data['Accessorial']]; - } - if (isset($data['ItemizedCharges']) && !array_is_list($data['ItemizedCharges'])) { - $data['ItemizedCharges'] = [$data['ItemizedCharges']]; - } - if (isset($data['RateModifier']) && !array_is_list($data['RateModifier'])) { - $data['RateModifier'] = [$data['RateModifier']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force fields to always be an array even when the API returns a single value + if (isset($data['Accessorial']) && !array_is_list($data['Accessorial'])) { + $data['Accessorial'] = [$data['Accessorial']]; + } + if (isset($data['ItemizedCharges']) && !array_is_list($data['ItemizedCharges'])) { + $data['ItemizedCharges'] = [$data['ItemizedCharges']]; + } + if (isset($data['RateModifier']) && !array_is_list($data['RateModifier'])) { + $data['RateModifier'] = [$data['RateModifier']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/ResponseErrorNormalizer.php b/src/Normalizer/ResponseErrorNormalizer.php index c24457b5..623ade1c 100644 --- a/src/Normalizer/ResponseErrorNormalizer.php +++ b/src/Normalizer/ResponseErrorNormalizer.php @@ -3,52 +3,27 @@ namespace ShipStream\Ups\Normalizer; use ShipStream\Ups\Api\Normalizer\ResponseErrorNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ResponseErrorNormalizer extends BaseNormalizer +class ResponseErrorNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force fields to always be an array even when the API returns a single value - if (isset($data['ErrorLocation']) && !array_is_list($data['ErrorLocation'])) { - $data['ErrorLocation'] = [$data['ErrorLocation']]; - } - if (isset($data['ErrorDigest']) && !is_array($data['ErrorDigest'])) { - $data['ErrorDigest'] = [$data['ErrorDigest']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class ResponseErrorNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force fields to always be an array even when the API returns a single value - if (isset($data['ErrorLocation']) && !array_is_list($data['ErrorLocation'])) { - $data['ErrorLocation'] = [$data['ErrorLocation']]; - } - if (isset($data['ErrorDigest']) && !is_array($data['ErrorDigest'])) { - $data['ErrorDigest'] = [$data['ErrorDigest']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force fields to always be an array even when the API returns a single value + if (isset($data['ErrorLocation']) && !array_is_list($data['ErrorLocation'])) { + $data['ErrorLocation'] = [$data['ErrorLocation']]; + } + if (isset($data['ErrorDigest']) && !is_array($data['ErrorDigest'])) { + $data['ErrorDigest'] = [$data['ErrorDigest']]; } + return parent::denormalize($data, $type, $format, $context); } } diff --git a/src/Normalizer/Shipping/LabelRecoveryResponseNormalizer.php b/src/Normalizer/Shipping/LabelRecoveryResponseNormalizer.php index 95579d6f..bc18f3d0 100644 --- a/src/Normalizer/Shipping/LabelRecoveryResponseNormalizer.php +++ b/src/Normalizer/Shipping/LabelRecoveryResponseNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\Shipping; use ShipStream\Ups\Api\Normalizer\LabelRecoveryResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class LabelRecoveryResponseNormalizer extends BaseNormalizer +class LabelRecoveryResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force LabelResults to always be an array even when the API returns a single value - if (isset($data['LabelResults']) && !array_is_list($data['LabelResults'])) { - $data['LabelResults'] = [$data['LabelResults']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class LabelRecoveryResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force LabelResults to always be an array even when the API returns a single value - if (isset($data['LabelResults']) && !array_is_list($data['LabelResults'])) { - $data['LabelResults'] = [$data['LabelResults']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force LabelResults to always be an array even when the API returns a single value + if (isset($data['LabelResults']) && !array_is_list($data['LabelResults'])) { + $data['LabelResults'] = [$data['LabelResults']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/Shipping/ShipmentResponseResponseNormalizer.php b/src/Normalizer/Shipping/ShipmentResponseResponseNormalizer.php index d082b6e4..7084fae1 100644 --- a/src/Normalizer/Shipping/ShipmentResponseResponseNormalizer.php +++ b/src/Normalizer/Shipping/ShipmentResponseResponseNormalizer.php @@ -3,48 +3,25 @@ namespace ShipStream\Ups\Normalizer\Shipping; use ShipStream\Ups\Api\Normalizer\ShipmentResponseResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResponseResponseNormalizer extends BaseNormalizer +class ShipmentResponseResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Alert to always be an array even when the API returns a single value - // @see https://github.com/UPS-API/api-documentation/issues/3 - if (isset($data['Alert']) && ! array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class ShipmentResponseResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Alert to always be an array even when the API returns a single value - // @see https://github.com/UPS-API/api-documentation/issues/3 - if (isset($data['Alert']) && ! array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Alert to always be an array even when the API returns a single value + // @see https://github.com/UPS-API/api-documentation/issues/3 + if (isset($data['Alert']) && ! array_is_list($data['Alert'])) { + $data['Alert'] = [$data['Alert']]; } - } -} \ No newline at end of file + return parent::denormalize($data, $type, $format, $context); + } +} diff --git a/src/Normalizer/Shipping/ShipmentResponseShipmentResultsNormalizer.php b/src/Normalizer/Shipping/ShipmentResponseShipmentResultsNormalizer.php index 7acb4a96..58a6d7a5 100644 --- a/src/Normalizer/Shipping/ShipmentResponseShipmentResultsNormalizer.php +++ b/src/Normalizer/Shipping/ShipmentResponseShipmentResultsNormalizer.php @@ -3,48 +3,25 @@ namespace ShipStream\Ups\Normalizer\Shipping; use ShipStream\Ups\Api\Normalizer\ShipmentResponseShipmentResultsNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResponseShipmentResultsNormalizer extends BaseNormalizer +class ShipmentResponseShipmentResultsNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force PackageResults to always be an array even when the API returns a single value - // @see https://github.com/UPS-API/api-documentation/issues/3 - if (isset($data['PackageResults']) && !array_is_list($data['PackageResults'])) { - $data['PackageResults'] = [$data['PackageResults']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class ShipmentResponseShipmentResultsNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force PackageResults to always be an array even when the API returns a single value - // @see https://github.com/UPS-API/api-documentation/issues/3 - if (isset($data['PackageResults']) && !array_is_list($data['PackageResults'])) { - $data['PackageResults'] = [$data['PackageResults']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force PackageResults to always be an array even when the API returns a single value + // @see https://github.com/UPS-API/api-documentation/issues/3 + if (isset($data['PackageResults']) && !array_is_list($data['PackageResults'])) { + $data['PackageResults'] = [$data['PackageResults']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/TForceFreightRating/FreightRateResponseNormalizer.php b/src/Normalizer/TForceFreightRating/FreightRateResponseNormalizer.php index 586a6e3e..aff06f5d 100644 --- a/src/Normalizer/TForceFreightRating/FreightRateResponseNormalizer.php +++ b/src/Normalizer/TForceFreightRating/FreightRateResponseNormalizer.php @@ -3,58 +3,30 @@ namespace ShipStream\Ups\Normalizer\TForceFreightRating; use ShipStream\Ups\Api\Normalizer\FreightRateResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseNormalizer extends BaseNormalizer +class FreightRateResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force fields to always be an array even when the API returns a single value - if (isset($data['Rate']) && !array_is_list($data['Rate'])) { - $data['Rate'] = [$data['Rate']]; - } - if (isset($data['Commodity']) && !array_is_list($data['Commodity'])) { - $data['Commodity'] = [$data['Commodity']]; - } - if (isset($data['AlternateRatesResponse']) && !array_is_list($data['AlternateRatesResponse'])) { - $data['AlternateRatesResponse'] = [$data['AlternateRatesResponse']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class FreightRateResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force fields to always be an array even when the API returns a single value - if (isset($data['Rate']) && !array_is_list($data['Rate'])) { - $data['Rate'] = [$data['Rate']]; - } - if (isset($data['Commodity']) && !array_is_list($data['Commodity'])) { - $data['Commodity'] = [$data['Commodity']]; - } - if (isset($data['AlternateRatesResponse']) && !array_is_list($data['AlternateRatesResponse'])) { - $data['AlternateRatesResponse'] = [$data['AlternateRatesResponse']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force fields to always be an array even when the API returns a single value + if (isset($data['Rate']) && !array_is_list($data['Rate'])) { + $data['Rate'] = [$data['Rate']]; + } + if (isset($data['Commodity']) && !array_is_list($data['Commodity'])) { + $data['Commodity'] = [$data['Commodity']]; + } + if (isset($data['AlternateRatesResponse']) && !array_is_list($data['AlternateRatesResponse'])) { + $data['AlternateRatesResponse'] = [$data['AlternateRatesResponse']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/TForceFreightRating/FreightRateResponseResponseNormalizer.php b/src/Normalizer/TForceFreightRating/FreightRateResponseResponseNormalizer.php index a64c3c72..1d3ea9ae 100644 --- a/src/Normalizer/TForceFreightRating/FreightRateResponseResponseNormalizer.php +++ b/src/Normalizer/TForceFreightRating/FreightRateResponseResponseNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\TForceFreightRating; use ShipStream\Ups\Api\Normalizer\FreightRateResponseResponseNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightRateResponseResponseNormalizer extends BaseNormalizer +class FreightRateResponseResponseNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class FreightRateResponseResponseNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Alert to always be an array even when the API returns a single value - if (isset($data['Alert']) && !array_is_list($data['Alert'])) { - $data['Alert'] = [$data['Alert']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Alert to always be an array even when the API returns a single value + if (isset($data['Alert']) && !array_is_list($data['Alert'])) { + $data['Alert'] = [$data['Alert']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/TForceFreightShipping/FreightShipResponseShipmentResultsNormalizer.php b/src/Normalizer/TForceFreightShipping/FreightShipResponseShipmentResultsNormalizer.php index 62661585..98911a29 100644 --- a/src/Normalizer/TForceFreightShipping/FreightShipResponseShipmentResultsNormalizer.php +++ b/src/Normalizer/TForceFreightShipping/FreightShipResponseShipmentResultsNormalizer.php @@ -3,46 +3,24 @@ namespace ShipStream\Ups\Normalizer\TForceFreightShipping; use ShipStream\Ups\Api\Normalizer\FreightShipResponseShipmentResultsNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class FreightShipResponseShipmentResultsNormalizer extends BaseNormalizer +class FreightShipResponseShipmentResultsNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force Rate to always be an array even when the API returns a single value - if (isset($data['Rate']) && ! array_is_list($data['Rate'])) { - $data['Rate'] = [$data['Rate']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class FreightShipResponseShipmentResultsNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force Rate to always be an array even when the API returns a single value - if (isset($data['Rate']) && ! array_is_list($data['Rate'])) { - $data['Rate'] = [$data['Rate']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force Rate to always be an array even when the API returns a single value + if (isset($data['Rate']) && ! array_is_list($data['Rate'])) { + $data['Rate'] = [$data['Rate']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} diff --git a/src/Normalizer/TForceFreightShipping/ShipmentResultsDocumentsNormalizer.php b/src/Normalizer/TForceFreightShipping/ShipmentResultsDocumentsNormalizer.php index 3d827263..e4ca5c1e 100644 --- a/src/Normalizer/TForceFreightShipping/ShipmentResultsDocumentsNormalizer.php +++ b/src/Normalizer/TForceFreightShipping/ShipmentResultsDocumentsNormalizer.php @@ -3,52 +3,27 @@ namespace ShipStream\Ups\Normalizer\TForceFreightShipping; use ShipStream\Ups\Api\Normalizer\ShipmentResultsDocumentsNormalizer as BaseNormalizer; -use Symfony\Component\HttpKernel\Kernel; use function array_is_list; use function is_array; -if (!class_exists(Kernel::class) or (Kernel::MAJOR_VERSION >= 7 or Kernel::MAJOR_VERSION === 6 and Kernel::MINOR_VERSION === 4)) { - class ShipmentResultsDocumentsNormalizer extends BaseNormalizer +class ShipmentResultsDocumentsNormalizer extends BaseNormalizer +{ + /** + * @inheritDoc + */ + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed { - /** - * @inheritDoc - */ - public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - - // Force fields to always be an array even when the API returns a single value - if (isset($data['Image']) && ! array_is_list($data['Image'])) { - $data['Image'] = [$data['Image']]; - } - if (isset($data['Forms']) && ! array_is_list($data['Forms'])) { - $data['Forms'] = [$data['Forms']]; - } + if ($data === null || is_array($data) === false) { return parent::denormalize($data, $type, $format, $context); } - } -} else { - class ShipmentResultsDocumentsNormalizer extends BaseNormalizer - { - /** - * @inheritDoc - */ - public function denormalize($data, $type, $format = null, array $context = []) - { - if ($data === null || is_array($data) === false) { - return parent::denormalize($data, $type, $format, $context); - } - // Force fields to always be an array even when the API returns a single value - if (isset($data['Image']) && ! array_is_list($data['Image'])) { - $data['Image'] = [$data['Image']]; - } - if (isset($data['Forms']) && ! array_is_list($data['Forms'])) { - $data['Forms'] = [$data['Forms']]; - } - return parent::denormalize($data, $type, $format, $context); + // Force fields to always be an array even when the API returns a single value + if (isset($data['Image']) && ! array_is_list($data['Image'])) { + $data['Image'] = [$data['Image']]; + } + if (isset($data['Forms']) && ! array_is_list($data['Forms'])) { + $data['Forms'] = [$data['Forms']]; } + return parent::denormalize($data, $type, $format, $context); } -} \ No newline at end of file +} From ea30c66ffa327a7d14516932cf0af92103a92366 Mon Sep 17 00:00:00 2001 From: Mohamed ELIDRISSI <67818913+elidrissidev@users.noreply.github.com> Date: Mon, 5 Jan 2026 10:46:56 +0100 Subject: [PATCH 4/4] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4d3fd7a1..2ada5b49 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ A PHP SDK for the UPS REST API, brought to you by [ShipStream](https://shipstrea composer require shipstream/ups-rest-php-sdk ``` -**Note:** The latest version is compatible only with PHP 8.x. For PHP 7.4 support, please append the `^1.0` version constraint to the above command. +**Note:** The latest version supports PHP 8.2 or above. For PHP 7.4 support, please append the `^1.0` version constraint to the above command. ## Basic Usage